summaryrefslogtreecommitdiff
path: root/lib/git
diff options
context:
space:
mode:
Diffstat (limited to 'lib/git')
-rw-r--r--lib/git/__init__.py4
-rw-r--r--lib/git/cmd.py6
-rw-r--r--lib/git/config.py2
-rw-r--r--lib/git/diff.py4
-rw-r--r--lib/git/exc.py (renamed from lib/git/errors.py)0
m---------lib/git/ext/gitdb0
-rw-r--r--lib/git/index/base.py32
-rw-r--r--lib/git/index/fun.py8
-rw-r--r--lib/git/index/typ.py14
-rw-r--r--lib/git/objects/__init__.py2
-rw-r--r--lib/git/objects/base.py4
-rw-r--r--lib/git/objects/blob.py15
-rw-r--r--lib/git/objects/commit.py6
-rw-r--r--lib/git/objects/tag.py2
-rw-r--r--lib/git/objects/tree.py20
-rw-r--r--lib/git/objects/util.py (renamed from lib/git/objects/utils.py)8
-rw-r--r--lib/git/refs.py29
-rw-r--r--lib/git/remote.py31
-rw-r--r--lib/git/repo.py9
-rw-r--r--lib/git/util.py (renamed from lib/git/utils.py)9
20 files changed, 115 insertions, 90 deletions
diff --git a/lib/git/__init__.py b/lib/git/__init__.py
index 7860a3c1..5ebeaa7d 100644
--- a/lib/git/__init__.py
+++ b/lib/git/__init__.py
@@ -28,12 +28,12 @@ from git.config import GitConfigParser
from git.objects import *
from git.refs import *
from git.diff import *
-from git.errors import *
+from git.exc import *
from git.cmd import Git
from git.repo import Repo
from git.remote import *
from git.index import *
-from git.utils import (
+from git.util import (
LockFile,
BlockingLockFile,
Stats
diff --git a/lib/git/cmd.py b/lib/git/cmd.py
index d0f2a19e..cd848e05 100644
--- a/lib/git/cmd.py
+++ b/lib/git/cmd.py
@@ -5,8 +5,8 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import os, sys
-from utils import *
-from errors import GitCommandError
+from util import *
+from exc import GitCommandError
from subprocess import (
call,
@@ -272,7 +272,7 @@ class Git(object):
This merely is a workaround as data will be copied from the
output pipe to the given output stream directly.
- :param **subprocess_kwargs:
+ :param subprocess_kwargs:
Keyword arguments to be passed to subprocess.Popen. Please note that
some of the valid kwargs are already set by this method, the ones you
specify may not be the same ones.
diff --git a/lib/git/config.py b/lib/git/config.py
index e4af57f0..92d64aea 100644
--- a/lib/git/config.py
+++ b/lib/git/config.py
@@ -13,7 +13,7 @@ import inspect
import cStringIO
from git.odict import OrderedDict
-from git.utils import LockFile
+from git.util import LockFile
__all__ = ('GitConfigParser', )
diff --git a/lib/git/diff.py b/lib/git/diff.py
index 79a0c3c1..788bf238 100644
--- a/lib/git/diff.py
+++ b/lib/git/diff.py
@@ -6,8 +6,8 @@
import re
from objects.blob import Blob
-from objects.utils import mode_str_to_int
-from errors import GitCommandError
+from objects.util import mode_str_to_int
+from exc import GitCommandError
from gitdb.util import hex_to_bin
diff --git a/lib/git/errors.py b/lib/git/exc.py
index 93919d5e..93919d5e 100644
--- a/lib/git/errors.py
+++ b/lib/git/exc.py
diff --git a/lib/git/ext/gitdb b/lib/git/ext/gitdb
-Subproject c265c97f9130d2225b923b427736796c0a0d957
+Subproject 7562fdd96ab995f6c25fc102ef40a285283c844
diff --git a/lib/git/index/base.py b/lib/git/index/base.py
index 03da52b7..4b3197a2 100644
--- a/lib/git/index/base.py
+++ b/lib/git/index/base.py
@@ -4,7 +4,7 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
"""Module containing Index implementation, allowing to perform all kinds of index
-manipulations such as querying and merging. """
+manipulations such as querying and merging."""
import tempfile
import os
import sys
@@ -36,7 +36,7 @@ from util import (
import git.objects
import git.diff as diff
-from git.errors import (
+from git.exc import (
GitCommandError,
CheckoutError
)
@@ -48,9 +48,9 @@ from git.objects import (
Commit,
)
-from git.objects.utils import Serializable
+from git.objects.util import Serializable
-from git.utils import (
+from git.util import (
IndexFileSHA1Writer,
LazyMixin,
LockedFD,
@@ -75,22 +75,26 @@ __all__ = ( 'IndexFile', 'CheckoutError' )
class IndexFile(LazyMixin, diff.Diffable, Serializable):
- """Implements an Index that can be manipulated using a native implementation in
+ """
+ Implements an Index that can be manipulated using a native implementation in
order to save git command function calls wherever possible.
-
+
It provides custom merging facilities allowing to merge without actually changing
your index or your working tree. This way you can perform own test-merges based
on the index only without having to deal with the working copy. This is useful
in case of partial working trees.
``Entries``
+
The index contains an entries dict whose keys are tuples of type IndexEntry
to facilitate access.
You may read the entries dict or manipulate it using IndexEntry instance, i.e.::
+
index.entries[index.entry_key(index_entry_instance)] = index_entry_instance
- Otherwise changes to it will be lost when changing the index using its methods.
- """
+
+ Make sure you use index.write() once you are done manipulating the index directly
+ before operating on it using the git command"""
__slots__ = ("repo", "version", "entries", "_extension_data", "_file_path")
_VERSION = 2 # latest version we support
S_IFGITLINK = 0160000 # a submodule
@@ -250,7 +254,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
:param repo: The repository treeish are located in.
- :param *tree_sha:
+ :param tree_sha:
20 byte or 40 byte tree sha or tree objects
:return:
@@ -276,7 +280,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
:param repo:
The repository treeish are located in.
- :param *treeish:
+ :param treeish:
One, two or three Tree Objects, Commits or 40 byte hexshas. The result
changes according to the amount of trees.
If 1 Tree is given, it will just be read into a new index
@@ -287,7 +291,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
being the common ancestor of tree 2 and tree 3. Tree 2 is the 'current' tree,
tree 3 is the 'other' one
- :param **kwargs:
+ :param kwargs:
Additional arguments passed to git-read-tree
:return:
@@ -790,7 +794,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
removing the respective file. This may fail if there are uncommited changes
in it.
- :param **kwargs:
+ :param kwargs:
Additional keyword arguments to be passed to git-rm, such
as 'r' to allow recurive removal of
@@ -828,7 +832,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
:param skip_errors:
If True, errors such as ones resulting from missing source files will
be skpped.
- :param **kwargs:
+ :param kwargs:
Additional arguments you would like to pass to git-mv, such as dry_run
or force.
@@ -924,7 +928,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
explicit paths are given. Otherwise progress information will be send
prior and after a file has been checked out
- :param **kwargs:
+ :param kwargs:
Additional arguments to be pasesd to git-checkout-index
:return:
diff --git a/lib/git/index/fun.py b/lib/git/index/fun.py
index ef950761..fac559c5 100644
--- a/lib/git/index/fun.py
+++ b/lib/git/index/fun.py
@@ -5,8 +5,8 @@ more versatile
from stat import S_IFDIR
from cStringIO import StringIO
-from git.utils import IndexFileSHA1Writer
-from git.errors import UnmergedEntriesError
+from git.util import IndexFileSHA1Writer
+from git.exc import UnmergedEntriesError
from git.objects.fun import (
tree_to_stream,
traverse_tree_recursive,
@@ -51,8 +51,10 @@ def write_cache(entries, stream, extension_data=None, ShaStreamCls=IndexFileSHA1
:param entries: **sorted** list of entries
:param stream: stream to wrap into the AdapterStreamCls - it is used for
final output.
+
:param ShaStreamCls: Type to use when writing to the stream. It produces a sha
while writing to it, before the data is passed on to the wrapped stream
+
:param extension_data: any kind of data to write as a trailer, it must begin
a 4 byte identifier, followed by its size ( 4 bytes )"""
# wrap the stream into a compatible writer
@@ -103,7 +105,7 @@ def read_header(stream):
def entry_key(*entry):
""":return: Key suitable to be used for the index.entries dictionary
- :param *entry: One instance of type BaseIndexEntry or the path and the stage"""
+ :param entry: One instance of type BaseIndexEntry or the path and the stage"""
if len(entry) == 1:
return (entry[0].path, entry[0].stage)
else:
diff --git a/lib/git/index/typ.py b/lib/git/index/typ.py
index 7654b402..3a01cd65 100644
--- a/lib/git/index/typ.py
+++ b/lib/git/index/typ.py
@@ -78,10 +78,10 @@ class BaseIndexEntry(tuple):
def stage(self):
"""Stage of the entry, either:
- 0 = default stage
- 1 = stage before a merge or common ancestor entry in case of a 3 way merge
- 2 = stage of entries from the 'left' side of the merge
- 3 = stage of entries from the right side of the merge
+ * 0 = default stage
+ * 1 = stage before a merge or common ancestor entry in case of a 3 way merge
+ * 2 = stage of entries from the 'left' side of the merge
+ * 3 = stage of entries from the right side of the merge
:note: For more information, see http://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html
"""
@@ -112,10 +112,10 @@ class IndexEntry(BaseIndexEntry):
See the properties for a mapping between names and tuple indices. """
@property
def ctime(self):
- """:return:
- Tuple(int_time_seconds_since_epoch, int_nano_seconds) of the
- file's creation time
"""
+ :return:
+ Tuple(int_time_seconds_since_epoch, int_nano_seconds) of the
+ file's creation time"""
return unpack(">LL", self[4])
@property
diff --git a/lib/git/objects/__init__.py b/lib/git/objects/__init__.py
index 209d8b51..85c7e38c 100644
--- a/lib/git/objects/__init__.py
+++ b/lib/git/objects/__init__.py
@@ -8,7 +8,7 @@ from blob import *
from tree import *
from commit import *
from submodule import *
-from utils import Actor
+from util import Actor
__all__ = [ name for name, obj in locals().items()
if not (name.startswith('_') or inspect.ismodule(obj)) ] \ No newline at end of file
diff --git a/lib/git/objects/base.py b/lib/git/objects/base.py
index 97b7898c..d4a46788 100644
--- a/lib/git/objects/base.py
+++ b/lib/git/objects/base.py
@@ -3,8 +3,8 @@
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
-from git.utils import LazyMixin, join_path_native, stream_copy
-from utils import get_object_type_by_name
+from git.util import LazyMixin, join_path_native, stream_copy
+from util import get_object_type_by_name
from gitdb.util import (
hex_to_bin,
bin_to_hex,
diff --git a/lib/git/objects/blob.py b/lib/git/objects/blob.py
index 8263e9a2..32f8c61c 100644
--- a/lib/git/objects/blob.py
+++ b/lib/git/objects/blob.py
@@ -14,21 +14,12 @@ class Blob(base.IndexObject):
DEFAULT_MIME_TYPE = "text/plain"
type = "blob"
- __slots__ = "data"
-
- def _set_cache_(self, attr):
- if attr == "data":
- ostream = self.repo.odb.stream(self.binsha)
- self.size = ostream.size
- self.data = ostream.read()
- # assert ostream.type == self.type, _assertion_msg_format % (self.binsha, ostream.type, self.type)
- else:
- super(Blob, self)._set_cache_(attr)
- # END handle data
+ __slots__ = tuple()
@property
def mime_type(self):
- """ :return:String describing the mime type of this file (based on the filename)
+ """
+ :return: String describing the mime type of this file (based on the filename)
:note: Defaults to 'text/plain' in case the actual file type is unknown. """
guesses = None
if self.path:
diff --git a/lib/git/objects/commit.py b/lib/git/objects/commit.py
index f88bb0e8..132d794b 100644
--- a/lib/git/objects/commit.py
+++ b/lib/git/objects/commit.py
@@ -4,7 +4,7 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
-from git.utils import (
+from git.util import (
Iterable,
Stats,
)
@@ -17,7 +17,7 @@ import base
from gitdb.util import (
hex_to_bin
)
-from utils import (
+from util import (
Traversable,
Serializable,
get_user_id,
@@ -182,11 +182,11 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
def iter_parents(self, paths='', **kwargs):
"""Iterate _all_ parents of this commit.
+
:param paths:
Optional path or list of paths limiting the Commits to those that
contain at least one of the paths
:param kwargs: All arguments allowed by git-rev-list
-
:return: Iterator yielding Commit objects which are parents of self """
# skip ourselves
skip = kwargs.get("skip", 1)
diff --git a/lib/git/objects/tag.py b/lib/git/objects/tag.py
index 702eae35..ea480fc2 100644
--- a/lib/git/objects/tag.py
+++ b/lib/git/objects/tag.py
@@ -6,7 +6,7 @@
""" Module containing all object based types. """
import base
from gitdb.util import hex_to_bin
-from utils import (
+from util import (
get_object_type_by_name,
parse_actor_and_date
)
diff --git a/lib/git/objects/tree.py b/lib/git/objects/tree.py
index 056d3da9..d6e16a31 100644
--- a/lib/git/objects/tree.py
+++ b/lib/git/objects/tree.py
@@ -3,7 +3,7 @@
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
-import utils
+import util
from base import IndexObject
from blob import Blob
@@ -23,8 +23,8 @@ from gitdb.util import (
__all__ = ("TreeModifier", "Tree")
class TreeModifier(object):
- """A utility class providing methods to alter the underlying cache in a list-like
- fashion.
+ """A utility class providing methods to alter the underlying cache in a list-like fashion.
+
Once all adjustments are complete, the _cache, which really is a refernce to
the cache of a tree, will be sorted. Assuring it will be in a serializable state"""
__slots__ = '_cache'
@@ -57,6 +57,7 @@ class TreeModifier(object):
exists, nothing will be done, but a ValueError will be raised if the
sha and mode of the existing item do not match the one you add, unless
force is True
+
:param sha: The 20 or 40 byte sha of the item to add
:param mode: int representing the stat compatible mode of the item
:param force: If True, an item with your name and information will overwrite
@@ -100,7 +101,7 @@ class TreeModifier(object):
#} END mutators
-class Tree(IndexObject, diff.Diffable, utils.Traversable, utils.Serializable):
+class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable):
"""Tree objects represent an ordered list of Blobs and other Trees.
``Tree as a list``::
@@ -203,16 +204,17 @@ class Tree(IndexObject, diff.Diffable, utils.Traversable, utils.Serializable):
@property
def cache(self):
- """:return: An object allowing to modify the internal cache. This can be used
- to change the tree's contents. When done, make sure you call ``set_done``
- on the tree modifier, or serialization behaviour will be incorrect.
- See the ``TreeModifier`` for more information on how to alter the cache"""
+ """
+ :return: An object allowing to modify the internal cache. This can be used
+ to change the tree's contents. When done, make sure you call ``set_done``
+ on the tree modifier, or serialization behaviour will be incorrect.
+ See the ``TreeModifier`` for more information on how to alter the cache"""
return TreeModifier(self._cache)
def traverse( self, predicate = lambda i,d: True,
prune = lambda i,d: False, depth = -1, branch_first=True,
visit_once = False, ignore_self=1 ):
- """For documentation, see utils.Traversable.traverse
+ """For documentation, see util.Traversable.traverse
Trees are set to visit_once = False to gain more performance in the traversal"""
return super(Tree, self).traverse(predicate, prune, depth, branch_first, visit_once, ignore_self)
diff --git a/lib/git/objects/utils.py b/lib/git/objects/util.py
index c0ddd6e6..fd648f09 100644
--- a/lib/git/objects/utils.py
+++ b/lib/git/objects/util.py
@@ -103,15 +103,15 @@ def verify_utctz(offset):
def parse_date(string_date):
"""
Parse the given date as one of the following
+
* Git internal format: timestamp offset
* RFC 2822: Thu, 07 Apr 2005 22:13:13 +0200.
* ISO 8601 2005-04-07T22:13:13
- The T can be a space as well
+ The T can be a space as well
- :return: Tuple(int(timestamp), int(offset), both in seconds since epoch
+ :return: Tuple(int(timestamp), int(offset)), both in seconds since epoch
:raise ValueError: If the format could not be understood
- :note: Date can also be YYYY.MM.DD, MM/DD/YYYY and DD.MM.YYYY
- """
+ :note: Date can also be YYYY.MM.DD, MM/DD/YYYY and DD.MM.YYYY"""
# git time
try:
if string_date.count(' ') == 1 and string_date.rfind(':') == -1:
diff --git a/lib/git/refs.py b/lib/git/refs.py
index 8258ca8d..343a0afb 100644
--- a/lib/git/refs.py
+++ b/lib/git/refs.py
@@ -10,8 +10,8 @@ from objects import (
Object,
Commit
)
-from objects.utils import get_object_type_by_name
-from utils import (
+from objects.util import get_object_type_by_name
+from util import (
LazyMixin,
Iterable,
join_path,
@@ -64,7 +64,8 @@ class SymbolicReference(object):
@property
def name(self):
- """:return:
+ """
+ :return:
In case of symbolic references, the shortest assumable name
is the path itself."""
return self.path
@@ -244,7 +245,8 @@ class SymbolicReference(object):
@property
def is_detached(self):
- """:return:
+ """
+ :return:
True if we are a detached reference, hence we point to a specific commit
instead to another reference"""
try:
@@ -256,8 +258,9 @@ class SymbolicReference(object):
@classmethod
def to_full_path(cls, path):
- """:return: string with a full path name which can be used to initialize
- a Reference instance, for instance by using ``Reference.from_path``"""
+ """
+ :return: string with a full path name which can be used to initialize
+ a Reference instance, for instance by using ``Reference.from_path``"""
if isinstance(path, SymbolicReference):
path = path.path
full_ref_path = path
@@ -369,6 +372,7 @@ class SymbolicReference(object):
:raise OSError:
If a (Symbolic)Reference with the same name but different contents
already exists.
+
:note: This does not alter the current HEAD, index or Working Tree"""
return cls._create(repo, path, False, reference, force)
@@ -563,17 +567,21 @@ class Reference(SymbolicReference, LazyMixin, Iterable):
@classmethod
def create(cls, repo, path, commit='HEAD', force=False ):
"""Create a new reference.
+
:param repo: Repository to create the reference in
:param path:
The relative path of the reference, i.e. 'new_branch' or
feature/feature1. The path prefix 'refs/' is implied if not
given explicitly
+
:param commit:
Commit to which the new reference should point, defaults to the
current HEAD
+
:param force:
if True, force creation even if a reference with that name already exists.
Raise OSError otherwise
+
:return: Newly created Reference
:note: This does not alter the current HEAD, index or Working Tree"""
@@ -666,15 +674,18 @@ class Head(Reference):
:param path:
The name or path of the head, i.e. 'new_branch' or
feature/feature1. The prefix refs/heads is implied.
+
:param commit:
Commit to which the new head should point, defaults to the
current HEAD
+
:param force:
if True, force creation even if branch with that name already exists.
- :param **kwargs:
+ :param kwargs:
Additional keyword arguments to be passed to git-branch, i.e.
track, no-track, l
+
:return: Newly created Head
:note: This does not alter the current HEAD, index or Working Tree"""
if cls is not Head:
@@ -734,7 +745,7 @@ class Head(Reference):
If True, changes to the index and the working tree will be discarded.
If False, GitCommandError will be raised in that situation.
- :param **kwargs:
+ :param kwargs:
Additional keyword arguments to be passed to git checkout, i.e.
b='new_branch' to create a new branch at the given spot.
@@ -818,7 +829,7 @@ class TagReference(Reference):
:param force:
If True, to force creation of a tag even though that tag already exists.
- :param **kwargs:
+ :param kwargs:
Additional keyword arguments to be passed to git-tag
:return: A new TagReference"""
diff --git a/lib/git/remote.py b/lib/git/remote.py
index 9c46a027..1598e55a 100644
--- a/lib/git/remote.py
+++ b/lib/git/remote.py
@@ -5,10 +5,10 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
"""Module implementing a remote object allowing easy access to git remotes"""
-from errors import GitCommandError
+from exc import GitCommandError
from objects import Commit
-from git.utils import (
+from git.util import (
LazyMixin,
Iterable,
IterableList
@@ -52,8 +52,10 @@ class _SectionConstraint(object):
class RemoteProgress(object):
- """Handler providing an interface to parse progress information emitted by git-push
- and git-fetch and to dispatch callbacks allowing subclasses to react to the progress."""
+ """
+ Handler providing an interface to parse progress information emitted by git-push
+ and git-fetch and to dispatch callbacks allowing subclasses to react to the progress.
+ """
BEGIN, END, COUNTING, COMPRESSING, WRITING = [ 1 << x for x in range(5) ]
STAGE_MASK = BEGIN|END
OP_MASK = COUNTING|COMPRESSING|WRITING
@@ -168,7 +170,8 @@ class RemoteProgress(object):
class PushInfo(object):
- """Carries information about the result of a push operation of a single head::
+ """
+ Carries information about the result of a push operation of a single head::
info = remote.push()[0]
info.flags # bitflags providing more information about the result
@@ -179,7 +182,8 @@ class PushInfo(object):
# the remote_ref_string. It can be a TagReference as well.
info.old_commit # commit at which the remote_ref was standing before we pushed
# it to local_ref.commit. Will be None if an error was indicated
- info.summary # summary line providing human readable english text about the push"""
+ info.summary # summary line providing human readable english text about the push
+ """
__slots__ = ('local_ref', 'remote_ref_string', 'flags', 'old_commit', '_remote', 'summary')
NEW_TAG, NEW_HEAD, NO_MATCH, REJECTED, REMOTE_REJECTED, REMOTE_FAILURE, DELETED, \
@@ -201,7 +205,8 @@ class PushInfo(object):
@property
def remote_ref(self):
- """:return:
+ """
+ :return:
Remote Reference or TagReference in the local repository corresponding
to the remote_ref_string kept in this instance."""
# translate heads to a local remote, tags stay as they are
@@ -266,7 +271,8 @@ class PushInfo(object):
class FetchInfo(object):
- """Carries information about the results of a fetch operation of a single head::
+ """
+ Carries information about the results of a fetch operation of a single head::
info = remote.fetch()[0]
info.ref # Symbolic Reference or RemoteReference to the changed
@@ -276,7 +282,8 @@ class FetchInfo(object):
# is 0 if ref is SymbolicReference
info.note # additional notes given by git-fetch intended for the user
info.old_commit # if info.flags & info.FORCED_UPDATE|info.FAST_FORWARD,
- # field is set to the previous location of ref, otherwise None"""
+ # field is set to the previous location of ref, otherwise None
+ """
__slots__ = ('ref','old_commit', 'flags', 'note')
NEW_TAG, NEW_HEAD, HEAD_UPTODATE, TAG_UPDATE, REJECTED, FORCED_UPDATE, \
@@ -501,7 +508,7 @@ class Remote(LazyMixin, Iterable):
:param repo: Repository instance that is to receive the new remote
:param name: Desired name of the remote
:param url: URL which corresponds to the remote's name
- :param **kwargs:
+ :param kwargs:
Additional arguments to be passed to the git-remote add command
:return: New Remote instance
@@ -644,7 +651,7 @@ class Remote(LazyMixin, Iterable):
Taken from the git manual
:param progress: See 'push' method
- :param **kwargs: Additional arguments to be passed to git-fetch
+ :param kwargs: Additional arguments to be passed to git-fetch
:return:
IterableList(FetchInfo, ...) list of FetchInfo instances providing detailed
information about the fetch results
@@ -675,7 +682,7 @@ class Remote(LazyMixin, Iterable):
progress information until the method returns.
If None, progress information will be discarded
- :param **kwargs: Additional arguments to be passed to git-push
+ :param kwargs: Additional arguments to be passed to git-push
:return:
IterableList(PushInfo, ...) iterable list of PushInfo instances, each
one informing about an individual head which had been updated on the remote
diff --git a/lib/git/repo.py b/lib/git/repo.py
index 9b25653f..d9b943cd 100644
--- a/lib/git/repo.py
+++ b/lib/git/repo.py
@@ -4,7 +4,7 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
-from errors import InvalidGitRepositoryError, NoSuchPathError
+from exc import InvalidGitRepositoryError, NoSuchPathError
from cmd import Git
from objects import Actor
from refs import *
@@ -669,7 +669,12 @@ class Repo(object):
path = prev_path
# END reset previous working dir
# END bad windows handling
- return Repo(path, odbt = odbt)
+
+ # our git command could have a different working dir than our actual
+ # environment, hence we prepend its working dir if required
+ if not os.path.isabs(path) and self.git.working_dir:
+ path = os.path.join(self.git._working_dir, path)
+ return Repo(os.path.abspath(path), odbt = odbt)
def archive(self, ostream, treeish=None, prefix=None, **kwargs):
diff --git a/lib/git/utils.py b/lib/git/util.py
index e49fcc2a..54c3414e 100644
--- a/lib/git/utils.py
+++ b/lib/git/util.py
@@ -269,7 +269,8 @@ class BlockingLockFile(LockFile):
class IterableList(list):
- """List of iterable objects allowing to query an object by id or by named index::
+ """
+ List of iterable objects allowing to query an object by id or by named index::
heads = repo.heads
heads.master
@@ -317,11 +318,13 @@ class Iterable(object):
@classmethod
def list_items(cls, repo, *args, **kwargs):
- """Find all items of this type - subclasses can specify args and kwargs differently.
+ """
+ Find all items of this type - subclasses can specify args and kwargs differently.
If no args are given, subclasses are obliged to return all items if no additional
arguments arg given.
- :note: Favor the iter_items method as it will
+ :note: Favor the iter_items method as it will
+
:return:list(Item,...) list of item instances"""
out_list = IterableList( cls._id_attribute_ )
out_list.extend(cls.iter_items(repo, *args, **kwargs))