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 /project.py | |
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
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -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') |