diff options
| author | Conley Owens <cco3@android.com> | 2014-10-22 00:23:18 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-10-22 00:23:18 +0000 |
| commit | 7893b85509c1165d11ad951261aa9f49deb09eea (patch) | |
| tree | 24d95c707b9fd0d4e31509e9cf418a7e7828e7ee | |
| parent | b4e50e67e84cccd34a9759d2414c7215d657659a (diff) | |
| parent | 04e52d616625cc61d897a92d5e9a2c068465f8fc (diff) | |
| download | git-repo-7893b85509c1165d11ad951261aa9f49deb09eea.tar.gz | |
Merge changes I1f71be22,I5b119f11
* changes:
Always fetch the specific revision given
Support specifying non-HEADS refs as upstream
| -rw-r--r-- | docs/manifest-format.txt | 2 | ||||
| -rw-r--r-- | git_config.py | 6 | ||||
| -rw-r--r-- | project.py | 22 |
3 files changed, 17 insertions, 13 deletions
diff --git a/docs/manifest-format.txt b/docs/manifest-format.txt index d5c6a024..1aa93965 100644 --- a/docs/manifest-format.txt +++ b/docs/manifest-format.txt | |||
| @@ -244,7 +244,7 @@ whole ref space. | |||
| 244 | 244 | ||
| 245 | Attribute `sync-s`: Set to true to also sync sub-projects. | 245 | Attribute `sync-s`: Set to true to also sync sub-projects. |
| 246 | 246 | ||
| 247 | Attribute `upstream`: Name of the Git branch in which a sha1 | 247 | Attribute `upstream`: Name of the Git ref in which a sha1 |
| 248 | can be found. Used when syncing a revision locked manifest in | 248 | can be found. Used when syncing a revision locked manifest in |
| 249 | -c mode to avoid having to sync the entire ref space. | 249 | -c mode to avoid having to sync the entire ref space. |
| 250 | 250 | ||
diff --git a/git_config.py b/git_config.py index aa07d1b7..b4145e8c 100644 --- a/git_config.py +++ b/git_config.py | |||
| @@ -619,8 +619,6 @@ class Remote(object): | |||
| 619 | """ | 619 | """ |
| 620 | if IsId(rev): | 620 | if IsId(rev): |
| 621 | return rev | 621 | return rev |
| 622 | if rev.startswith(R_TAGS): | ||
| 623 | return rev | ||
| 624 | 622 | ||
| 625 | if not rev.startswith('refs/'): | 623 | if not rev.startswith('refs/'): |
| 626 | rev = R_HEADS + rev | 624 | rev = R_HEADS + rev |
| @@ -628,6 +626,10 @@ class Remote(object): | |||
| 628 | for spec in self.fetch: | 626 | for spec in self.fetch: |
| 629 | if spec.SourceMatches(rev): | 627 | if spec.SourceMatches(rev): |
| 630 | return spec.MapSource(rev) | 628 | return spec.MapSource(rev) |
| 629 | |||
| 630 | if not rev.startswith(R_HEADS): | ||
| 631 | return rev | ||
| 632 | |||
| 631 | raise GitError('remote %s does not have %s' % (self.name, rev)) | 633 | raise GitError('remote %s does not have %s' % (self.name, rev)) |
| 632 | 634 | ||
| 633 | def WritesTo(self, ref): | 635 | def WritesTo(self, ref): |
| @@ -1752,10 +1752,11 @@ class Project(object): | |||
| 1752 | if depth: | 1752 | if depth: |
| 1753 | current_branch_only = True | 1753 | current_branch_only = True |
| 1754 | 1754 | ||
| 1755 | if ID_RE.match(self.revisionExpr) is not None: | ||
| 1756 | is_sha1 = True | ||
| 1757 | |||
| 1755 | if current_branch_only: | 1758 | if current_branch_only: |
| 1756 | if ID_RE.match(self.revisionExpr) is not None: | 1759 | if self.revisionExpr.startswith(R_TAGS): |
| 1757 | is_sha1 = True | ||
| 1758 | elif self.revisionExpr.startswith(R_TAGS): | ||
| 1759 | # this is a tag and its sha1 value should never change | 1760 | # this is a tag and its sha1 value should never change |
| 1760 | tag_name = self.revisionExpr[len(R_TAGS):] | 1761 | tag_name = self.revisionExpr[len(R_TAGS):] |
| 1761 | 1762 | ||
| @@ -1838,13 +1839,14 @@ class Project(object): | |||
| 1838 | elif tag_name is not None: | 1839 | elif tag_name is not None: |
| 1839 | spec.append('tag') | 1840 | spec.append('tag') |
| 1840 | spec.append(tag_name) | 1841 | spec.append(tag_name) |
| 1841 | else: | 1842 | |
| 1842 | branch = self.revisionExpr | 1843 | branch = self.revisionExpr |
| 1843 | if is_sha1: | 1844 | if is_sha1: |
| 1844 | branch = self.upstream | 1845 | branch = self.upstream |
| 1845 | if branch.startswith(R_HEADS): | 1846 | if branch is not None and branch.strip(): |
| 1846 | branch = branch[len(R_HEADS):] | 1847 | if not branch.startswith('refs/'): |
| 1847 | spec.append(str((u'+refs/heads/%s:' % branch) + remote.ToLocal('refs/heads/%s' % branch))) | 1848 | branch = R_HEADS + branch |
| 1849 | spec.append(str((u'+%s:' % branch) + remote.ToLocal(branch))) | ||
| 1848 | cmd.extend(spec) | 1850 | cmd.extend(spec) |
| 1849 | 1851 | ||
| 1850 | shallowfetch = self.config.GetString('repo.shallowfetch') | 1852 | shallowfetch = self.config.GetString('repo.shallowfetch') |
