aboutsummaryrefslogtreecommitdiff
path: root/git
diff options
context:
space:
mode:
Diffstat (limited to 'git')
-rw-r--r--git/cmd.py28
-rw-r--r--git/objects/commit.py2
-rw-r--r--git/remote.py2
-rw-r--r--git/repo/base.py5
-rw-r--r--git/test/test_remote.py12
5 files changed, 29 insertions, 20 deletions
diff --git a/git/cmd.py b/git/cmd.py
index a4faefe2..64c3d480 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -43,6 +43,10 @@ from .util import (
stream_copy,
)
+try:
+ PermissionError
+except NameError: # Python < 3.3
+ PermissionError = OSError
execute_kwargs = {'istream', 'with_extended_output',
'with_exceptions', 'as_process', 'stdout_as_string',
@@ -211,22 +215,15 @@ class Git(LazyMixin):
# test if the new git executable path is valid
- if sys.version_info < (3,):
- # - a GitCommandNotFound error is spawned by ourselves
- # - a OSError is spawned if the git executable provided
- # cannot be executed for whatever reason
- exceptions = (GitCommandNotFound, OSError)
- else:
- # - a GitCommandNotFound error is spawned by ourselves
- # - a PermissionError is spawned if the git executable provided
- # cannot be executed for whatever reason
- exceptions = (GitCommandNotFound, PermissionError)
-
+ # - a GitCommandNotFound error is spawned by ourselves
+ # - a PermissionError is spawned if the git executable provided
+ # cannot be executed for whatever reason
+
has_git = False
try:
cls().version()
has_git = True
- except exceptions:
+ except (GitCommandNotFound, PermissionError):
pass
# warn or raise exception if test failed
@@ -718,8 +715,11 @@ class Git(LazyMixin):
stdout_sink = (PIPE
if with_stdout
else getattr(subprocess, 'DEVNULL', None) or open(os.devnull, 'wb'))
- log.debug("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s)",
- command, cwd, universal_newlines, shell)
+ istream_ok = "None"
+ if istream:
+ istream_ok = "<valid stream>"
+ log.debug("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s, istream=%s)",
+ command, cwd, universal_newlines, shell, istream_ok)
try:
proc = Popen(command,
env=env,
diff --git a/git/objects/commit.py b/git/objects/commit.py
index b7d27d92..9736914a 100644
--- a/git/objects/commit.py
+++ b/git/objects/commit.py
@@ -81,7 +81,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable):
:param tree: Tree
Tree object
:param author: Actor
- is the author string ( will be implicitly converted into an Actor object )
+ is the author Actor object
:param authored_date: int_seconds_since_epoch
is the authored DateTime - use time.gmtime() to convert it into a
different format
diff --git a/git/remote.py b/git/remote.py
index 8aec68e1..0965c1f6 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -695,6 +695,8 @@ class Remote(LazyMixin, Iterable):
msg += "Will ignore extra progress lines or fetch head lines."
msg %= (l_fil, l_fhi)
log.debug(msg)
+ log.debug("info lines: " + str(fetch_info_lines))
+ log.debug("head info : " + str(fetch_head_info))
if l_fil < l_fhi:
fetch_head_info = fetch_head_info[:l_fil]
else:
diff --git a/git/repo/base.py b/git/repo/base.py
index 304faa76..5f42dd29 100644
--- a/git/repo/base.py
+++ b/git/repo/base.py
@@ -97,6 +97,7 @@ class Repo(object):
repo = Repo("/Users/mtrier/Development/git-python.git")
repo = Repo("~/Development/git-python.git")
repo = Repo("$REPOSITORIES/Development/git-python.git")
+ repo = Repo("C:\\Users\\mtrier\\Development\\git-python\\.git")
- In *Cygwin*, path may be a `'cygdrive/...'` prefixed path.
- If it evaluates to false, :envvar:`GIT_DIR` is used, and if this also evals to false,
@@ -558,11 +559,11 @@ class Repo(object):
return res
def is_ancestor(self, ancestor_rev, rev):
- """Check if a commit is an ancestor of another
+ """Check if a commit is an ancestor of another
:param ancestor_rev: Rev which should be an ancestor
:param rev: Rev to test against ancestor_rev
- :return: ``True``, ancestor_rev is an accestor to rev.
+ :return: ``True``, ancestor_rev is an ancestor to rev.
"""
try:
self.git.merge_base(ancestor_rev, rev, is_ancestor=True)
diff --git a/git/test/test_remote.py b/git/test/test_remote.py
index 7c1711c2..99949b9e 100644
--- a/git/test/test_remote.py
+++ b/git/test/test_remote.py
@@ -253,9 +253,15 @@ class TestRemote(TestBase):
self.assertEqual(tinfo.ref.commit, rtag.commit)
self.assertTrue(tinfo.flags & tinfo.NEW_TAG)
- # adjust tag commit
+ # adjust the local tag commit
Reference.set_object(rtag, rhead.commit.parents[0].parents[0])
- res = fetch_and_test(remote, tags=True)
+
+ # as of git 2.20 one cannot clobber local tags that have changed without
+ # specifying --force, and the test assumes you can clobber, so...
+ force = None
+ if rw_repo.git.version_info[:2] >= (2, 20):
+ force = True
+ res = fetch_and_test(remote, tags=True, force=force)
tinfo = res[str(rtag)]
self.assertEqual(tinfo.commit, rtag.commit)
self.assertTrue(tinfo.flags & tinfo.TAG_UPDATE)
@@ -632,7 +638,7 @@ class TestRemote(TestBase):
def test_fetch_error(self):
rem = self.rorepo.remote('origin')
- with self.assertRaisesRegex(GitCommandError, "Couldn't find remote ref __BAD_REF__"):
+ with self.assertRaisesRegex(GitCommandError, "[Cc]ouldn't find remote ref __BAD_REF__"):
rem.fetch('__BAD_REF__')
@with_rw_repo('0.1.6', bare=False)