| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -68,7 +68,7 @@ class FetchInfo(object): | |||
| 68 | 68 | BRANCH_UPTODATE, REJECTED, FORCED_UPDATE, FAST_FORWARD, NEW_TAG, \ | |
| 69 | 69 | TAG_UPDATE, NEW_BRANCH, ERROR = [ 1 << x for x in range(1,9) ] | |
| 70 | 70 | # %c %-*s %-*s -> %s (%s) | |
| 71 | - re_fetch_result = re.compile("^(.) (\[?[\w\s\.]+\]?)\s+(.+) -> (.+/[\w_\.-]+)( \(.*\)?$)?") | ||
| 71 | + re_fetch_result = re.compile("^\s*(.) (\[?[\w\s\.]+\]?)\s+(.+) -> (.+/[\w_\.-]+)( \(.*\)?$)?") | ||
| 72 | 72 | ||
| 73 | 73 | _flag_map = { '!' : ERROR, '+' : FORCED_UPDATE, '-' : TAG_UPDATE, '*' : 0, | |
| 74 | 74 | '=' : BRANCH_UPTODATE, ' ' : FAST_FORWARD } | |
@@ -110,7 +110,6 @@ def _from_line(cls, repo, line): | |||
| 110 | 110 | = means the head was up to date ( and not moved ) | |
| 111 | 111 | ' ' means a fast-forward | |
| 112 | 112 | """ | |
| 113 | - line = line.strip() | ||
| 114 | 113 | match = cls.re_fetch_result.match(line) | |
| 115 | 114 | if match is None: | |
| 116 | 115 | raise ValueError("Failed to parse line: %r" % line) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,17 +43,28 @@ def _test_fetch(self,remote, rw_repo, remote_repo): | |||
| 43 | 43 | ||
| 44 | 44 | res = remote.fetch() | |
| 45 | 45 | self._test_fetch_result(res, remote) | |
| 46 | + # all uptodate | ||
| 47 | + for info in res: | ||
| 48 | + assert info.flags & info.BRANCH_UPTODATE | ||
| 46 | 49 | ||
| 47 | 50 | # rewind remote head to trigger rejection | |
| 48 | 51 | # index must be false as remote is a bare repo | |
| 49 | - remote_repo.head.reset("HEAD~2", index=False) | ||
| 52 | + rhead = remote_repo.head | ||
| 53 | + remote_commit = rhead.commit | ||
| 54 | + rhead.reset("HEAD~2", index=False) | ||
| 50 | 55 | res = remote.fetch() | |
| 51 | 56 | self._test_fetch_result(res, remote) | |
| 52 | - master_info = res["%s/master" % remote] | ||
| 57 | + mkey = "%s/master" % remote | ||
| 58 | + master_info = res[mkey] | ||
| 53 | 59 | assert master_info.flags & Remote.FetchInfo.FORCED_UPDATE and master_info.note is not None | |
| 54 | 60 | ||
| 55 | - self.fail("test parsing of each individual flag") | ||
| 56 | - self.fail("tag handling") | ||
| 61 | + # normal fast forward - set head back to previous one | ||
| 62 | + rhead.commit = remote_commit | ||
| 63 | + res = remote.fetch() | ||
| 64 | + self._test_fetch_result(res, remote) | ||
| 65 | + assert res[mkey].flags & Remote.FetchInfo.FAST_FORWARD | ||
| 66 | + | ||
| 67 | + self.fail("tag handling, tag uptodate, new tag, new branch") | ||
| 57 | 68 | ||
| 58 | 69 | def _test_pull(self,remote, rw_repo, remote_repo): | |
| 59 | 70 | # pull is essentially a fetch + merge, hence we just do a light | |
| Back | FazBrowse Home | New Git URL |
0 commit comments