summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/git/remote.py3
-rw-r--r--test/git/test_remote.py19
2 files changed, 16 insertions, 6 deletions
diff --git a/lib/git/remote.py b/lib/git/remote.py
index 36c71e7a..d4ca9eb3 100644
--- a/lib/git/remote.py
+++ b/lib/git/remote.py
@@ -68,7 +68,7 @@ class Remote(LazyMixin, Iterable):
BRANCH_UPTODATE, REJECTED, FORCED_UPDATE, FAST_FORWARD, NEW_TAG, \
TAG_UPDATE, NEW_BRANCH, ERROR = [ 1 << x for x in range(1,9) ]
# %c %-*s %-*s -> %s (%s)
- re_fetch_result = re.compile("^(.) (\[?[\w\s\.]+\]?)\s+(.+) -> (.+/[\w_\.-]+)( \(.*\)?$)?")
+ re_fetch_result = re.compile("^\s*(.) (\[?[\w\s\.]+\]?)\s+(.+) -> (.+/[\w_\.-]+)( \(.*\)?$)?")
_flag_map = { '!' : ERROR, '+' : FORCED_UPDATE, '-' : TAG_UPDATE, '*' : 0,
'=' : BRANCH_UPTODATE, ' ' : FAST_FORWARD }
@@ -110,7 +110,6 @@ class Remote(LazyMixin, Iterable):
= means the head was up to date ( and not moved )
' ' means a fast-forward
"""
- line = line.strip()
match = cls.re_fetch_result.match(line)
if match is None:
raise ValueError("Failed to parse line: %r" % line)
diff --git a/test/git/test_remote.py b/test/git/test_remote.py
index 3b145468..1d343c74 100644
--- a/test/git/test_remote.py
+++ b/test/git/test_remote.py
@@ -43,17 +43,28 @@ class TestRemote(TestBase):
res = remote.fetch()
self._test_fetch_result(res, remote)
+ # all uptodate
+ for info in res:
+ assert info.flags & info.BRANCH_UPTODATE
# rewind remote head to trigger rejection
# index must be false as remote is a bare repo
- remote_repo.head.reset("HEAD~2", index=False)
+ rhead = remote_repo.head
+ remote_commit = rhead.commit
+ rhead.reset("HEAD~2", index=False)
res = remote.fetch()
self._test_fetch_result(res, remote)
- master_info = res["%s/master" % remote]
+ mkey = "%s/master" % remote
+ master_info = res[mkey]
assert master_info.flags & Remote.FetchInfo.FORCED_UPDATE and master_info.note is not None
- self.fail("test parsing of each individual flag")
- self.fail("tag handling")
+ # normal fast forward - set head back to previous one
+ rhead.commit = remote_commit
+ res = remote.fetch()
+ self._test_fetch_result(res, remote)
+ assert res[mkey].flags & Remote.FetchInfo.FAST_FORWARD
+
+ self.fail("tag handling, tag uptodate, new tag, new branch")
def _test_pull(self,remote, rw_repo, remote_repo):
# pull is essentially a fetch + merge, hence we just do a light