summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKian Cross <kian@kiancross.co.uk>2020-07-13 04:35:33 +0100
committerKian Cross <kian@kiancross.co.uk>2020-07-13 04:35:33 +0100
commit762d8fb447b79db7373e296e6c60c7b57d27c090 (patch)
treed677bfdd23198b7a3c4954a3ebebc4bbdf7c4864
parenta175068f3366bb12dba8231f2a017ca2f24024a8 (diff)
downloadgitpython-762d8fb447b79db7373e296e6c60c7b57d27c090.tar.gz
Fixed broken file paths.
-rw-r--r--doc/source/tutorial.rst96
1 files changed, 48 insertions, 48 deletions
diff --git a/doc/source/tutorial.rst b/doc/source/tutorial.rst
index a96d0d99..d548f882 100644
--- a/doc/source/tutorial.rst
+++ b/doc/source/tutorial.rst
@@ -10,14 +10,14 @@ GitPython Tutorial
GitPython provides object model access to your git repository. This tutorial is composed of multiple sections, most of which explains a real-life usecase.
-All code presented here originated from `test_docs.py <https://github.com/gitpython-developers/GitPython/blob/master/git/test/test_docs.py>`_ to assure correctness. Knowing this should also allow you to more easily run the code for your own testing purposes, all you need is a developer installation of git-python.
+All code presented here originated from `test_docs.py <https://github.com/gitpython-developers/GitPython/blob/master/test/test_docs.py>`_ to assure correctness. Knowing this should also allow you to more easily run the code for your own testing purposes, all you need is a developer installation of git-python.
Meet the Repo type
******************
The first step is to create a :class:`git.Repo <git.repo.base.Repo>` object to represent your repository.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [1-test_init_repo_object]
@@ -25,7 +25,7 @@ The first step is to create a :class:`git.Repo <git.repo.base.Repo>` object to r
In the above example, the directory ``self.rorepo.working_tree_dir`` equals ``/Users/mtrier/Development/git-python`` and is my working repository which contains the ``.git`` directory. You can also initialize GitPython with a *bare* repository.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [2-test_init_repo_object]
@@ -33,7 +33,7 @@ In the above example, the directory ``self.rorepo.working_tree_dir`` equals ``/U
A repo object provides high-level access to your data, it allows you to create and delete heads, tags and remotes and access the configuration of the repository.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [3-test_init_repo_object]
@@ -41,7 +41,7 @@ A repo object provides high-level access to your data, it allows you to create a
Query the active branch, query untracked files or whether the repository data has been modified.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [4-test_init_repo_object]
@@ -49,7 +49,7 @@ Query the active branch, query untracked files or whether the repository data ha
Clone from existing repositories or initialize new empty ones.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [5-test_init_repo_object]
@@ -57,7 +57,7 @@ Clone from existing repositories or initialize new empty ones.
Archive the repository contents to a tar file.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [6-test_init_repo_object]
@@ -70,7 +70,7 @@ And of course, there is much more you can do with this type, most of the followi
Query relevant repository paths ...
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [7-test_init_repo_object]
@@ -78,7 +78,7 @@ Query relevant repository paths ...
:class:`Heads <git.refs.head.Head>` Heads are branches in git-speak. :class:`References <git.refs.reference.Reference>` are pointers to a specific commit or to other references. Heads and :class:`Tags <git.refs.tag.TagReference>` are a kind of references. GitPython allows you to query them rather intuitively.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [8-test_init_repo_object]
@@ -86,7 +86,7 @@ Query relevant repository paths ...
You can also create new heads ...
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [9-test_init_repo_object]
@@ -94,7 +94,7 @@ You can also create new heads ...
... and tags ...
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [10-test_init_repo_object]
@@ -102,7 +102,7 @@ You can also create new heads ...
You can traverse down to :class:`git objects <git.objects.base.Object>` through references and other objects. Some objects like :class:`commits <git.objects.commit.Commit>` have additional meta-data to query.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [11-test_init_repo_object]
@@ -110,7 +110,7 @@ You can traverse down to :class:`git objects <git.objects.base.Object>` through
:class:`Remotes <git.remote.Remote>` allow to handle fetch, pull and push operations, while providing optional real-time progress information to :class:`progress delegates <git.util.RemoteProgress>`.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [12-test_init_repo_object]
@@ -118,7 +118,7 @@ You can traverse down to :class:`git objects <git.objects.base.Object>` through
The :class:`index <git.index.base.IndexFile>` is also called stage in git-speak. It is used to prepare new commits, and can be used to keep results of merge operations. Our index implementation allows to stream date into the index, which is useful for bare repositories that do not have a working tree.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [13-test_init_repo_object]
@@ -126,7 +126,7 @@ The :class:`index <git.index.base.IndexFile>` is also called stage in git-speak.
:class:`Submodules <git.objects.submodule.Submodule>` represent all aspects of git submodules, which allows you query all of their related information, and manipulate in various ways.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [14-test_init_repo_object]
@@ -138,7 +138,7 @@ Examining References
:class:`References <git.refs.reference.Reference>` are the tips of your commit graph from which you can easily examine the history of your project.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [1-test_references_and_objects]
@@ -146,7 +146,7 @@ Examining References
:class:`Tags <git.refs.tag.TagReference>` are (usually immutable) references to a commit and/or a tag object.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [2-test_references_and_objects]
@@ -154,7 +154,7 @@ Examining References
A :class:`symbolic reference <git.refs.symbolic.SymbolicReference>` is a special case of a reference as it points to another reference instead of a commit.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [3-test_references_and_objects]
@@ -162,7 +162,7 @@ A :class:`symbolic reference <git.refs.symbolic.SymbolicReference>` is a special
Access the :class:`reflog <git.refs.log.RefLog>` easily.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [4-test_references_and_objects]
@@ -172,7 +172,7 @@ Modifying References
********************
You can easily create and delete :class:`reference types <git.refs.reference.Reference>` or modify where they point to.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [5-test_references_and_objects]
@@ -180,7 +180,7 @@ You can easily create and delete :class:`reference types <git.refs.reference.Ref
Create or delete :class:`tags <git.refs.tag.TagReference>` the same way except you may not change them afterwards.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [6-test_references_and_objects]
@@ -188,7 +188,7 @@ Create or delete :class:`tags <git.refs.tag.TagReference>` the same way except y
Change the :class:`symbolic reference <git.refs.symbolic.SymbolicReference>` to switch branches cheaply (without adjusting the index or the working tree).
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [7-test_references_and_objects]
@@ -202,7 +202,7 @@ Git only knows 4 distinct object types being :class:`Blobs <git.objects.blob.Blo
In GitPython, all objects can be accessed through their common base, can be compared and hashed. They are usually not instantiated directly, but through references or specialized repository functions.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [8-test_references_and_objects]
@@ -210,7 +210,7 @@ In GitPython, all objects can be accessed through their common base, can be comp
Common fields are ...
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [9-test_references_and_objects]
@@ -218,7 +218,7 @@ Common fields are ...
:class:`Index objects <git.objects.base.IndexObject>` are objects that can be put into git's index. These objects are trees, blobs and submodules which additionally know about their path in the file system as well as their mode.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [10-test_references_and_objects]
@@ -226,7 +226,7 @@ Common fields are ...
Access :class:`blob <git.objects.blob.Blob>` data (or any object data) using streams.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [11-test_references_and_objects]
@@ -240,7 +240,7 @@ The Commit object
Obtain commits at the specified revision
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [12-test_references_and_objects]
@@ -248,7 +248,7 @@ Obtain commits at the specified revision
Iterate 50 commits, and if you need paging, you can specify a number of commits to skip.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [13-test_references_and_objects]
@@ -256,7 +256,7 @@ Iterate 50 commits, and if you need paging, you can specify a number of commits
A commit object carries all sorts of meta-data
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [14-test_references_and_objects]
@@ -264,7 +264,7 @@ A commit object carries all sorts of meta-data
Note: date time is represented in a ``seconds since epoch`` format. Conversion to human readable form can be accomplished with the various `time module <http://docs.python.org/library/time.html>`_ methods.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [15-test_references_and_objects]
@@ -272,7 +272,7 @@ Note: date time is represented in a ``seconds since epoch`` format. Conversion t
You can traverse a commit's ancestry by chaining calls to ``parents``
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [16-test_references_and_objects]
@@ -285,7 +285,7 @@ The Tree object
A :class:`tree <git.objects.tree.Tree>` records pointers to the contents of a directory. Let's say you want the root tree of the latest commit on the master branch
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [17-test_references_and_objects]
@@ -293,7 +293,7 @@ A :class:`tree <git.objects.tree.Tree>` records pointers to the contents of a di
Once you have a tree, you can get its contents
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [18-test_references_and_objects]
@@ -301,7 +301,7 @@ Once you have a tree, you can get its contents
It is useful to know that a tree behaves like a list with the ability to query entries by name
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [19-test_references_and_objects]
@@ -309,7 +309,7 @@ It is useful to know that a tree behaves like a list with the ability to query e
There is a convenience method that allows you to get a named sub-object from a tree with a syntax similar to how paths are written in a posix system
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [20-test_references_and_objects]
@@ -317,7 +317,7 @@ There is a convenience method that allows you to get a named sub-object from a t
You can also get a commit's root tree directly from the repository
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [21-test_references_and_objects]
@@ -325,7 +325,7 @@ You can also get a commit's root tree directly from the repository
As trees allow direct access to their intermediate child entries only, use the traverse method to obtain an iterator to retrieve entries recursively
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [22-test_references_and_objects]
@@ -338,7 +338,7 @@ The Index Object
The git index is the stage containing changes to be written with the next commit or where merges finally have to take place. You may freely access and manipulate this information using the :class:`IndexFile <git.index.base.IndexFile>` object.
Modify the index with ease
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [23-test_references_and_objects]
@@ -346,7 +346,7 @@ Modify the index with ease
Create new indices from other trees or as result of a merge. Write that result to a new index file for later inspection.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [24-test_references_and_objects]
@@ -357,7 +357,7 @@ Handling Remotes
:class:`Remotes <git.remote.Remote>` are used as alias for a foreign repository to ease pushing to and fetching from them
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [25-test_references_and_objects]
@@ -365,7 +365,7 @@ Handling Remotes
You can easily access configuration information for a remote by accessing options as if they where attributes. The modification of remote configuration is more explicit though.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [26-test_references_and_objects]
@@ -399,7 +399,7 @@ Submodule Handling
******************
:class:`Submodules <git.objects.submodule.base.Submodule>` can be conveniently handled using the methods provided by GitPython, and as an added benefit, GitPython provides functionality which behave smarter and less error prone than its original c-git implementation, that is GitPython tries hard to keep your repository consistent when updating submodules recursively or adjusting the existing configuration.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [1-test_submodules]
@@ -424,7 +424,7 @@ Diffs can generally be obtained by subclasses of :class:`Diffable <git.diff.Diff
Diffs can be made between the Index and Trees, Index and the working tree, trees and trees as well as trees and the working copy. If commits are involved, their tree will be used implicitly.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [27-test_references_and_objects]
@@ -432,7 +432,7 @@ Diffs can be made between the Index and Trees, Index and the working tree, trees
The item returned is a DiffIndex which is essentially a list of Diff objects. It provides additional filtering to ease finding what you might be looking for.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [28-test_references_and_objects]
@@ -456,7 +456,7 @@ Switching Branches
******************
To switch between branches similar to ``git checkout``, you effectively need to point your HEAD symbolic reference to the new branch and reset your index and working copy to match. A simple manual way to do it is the following one
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [29-test_references_and_objects]
@@ -464,7 +464,7 @@ To switch between branches similar to ``git checkout``, you effectively need to
The previous approach would brutally overwrite the user's changes in the working copy and index though and is less sophisticated than a ``git-checkout``. The latter will generally prevent you from destroying your work. Use the safer approach as follows.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [30-test_references_and_objects]
@@ -475,7 +475,7 @@ Initializing a repository
In this example, we will initialize an empty repository, add an empty file to the index, and commit the change.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: def test_add_file_and_commit
@@ -487,7 +487,7 @@ Using git directly
******************
In case you are missing functionality as it has not been wrapped, you may conveniently use the :class:`git <git.cmd.Git>` command directly. It is owned by each repository instance.
-.. literalinclude:: ../../git/test/test_docs.py
+.. literalinclude:: ../../test/test_docs.py
:language: python
:dedent: 8
:start-after: # [31-test_references_and_objects]