fix issue: repo upload with revision manifest
f453ba8dc8d7a683acec3d17bed61755c8efd3fd does not work
while optimized-fetch is used.
just check if LocalMerge exists when local branch is created.
diff --git a/project.py b/project.py
index b973085..7fd17ed 100644
--- a/project.py
+++ b/project.py
@@ -1101,12 +1101,14 @@
gitcmd = GitCommand(self, cmd, bare=True)
ret = gitcmd.Wait()
- def _CreateRemoteBranch(self, branch, revid):
- remote = self.GetRemote(self.remote.name)
+ def _CreateLocalMergeBranch(self, branch, revid):
+ if not branch and not ID_RE.match(revid):
+ return
+ ref = os.path.join(self.gitdir, branch)
+ if os.path.exists(ref): return
try:
- self.work_git.rev_parse(remote.ToLocal(branch))
+ self.work_git.rev_parse(branch)
except GitError:
- ref = os.path.join(self.gitdir, remote.ToLocal(branch))
try:
os.makedirs(os.path.dirname(ref))
except OSError:
@@ -1482,6 +1484,9 @@
branch.merge = branch_merge
if not branch.merge.startswith('refs/') and not ID_RE.match(branch_merge):
branch.merge = R_HEADS + branch_merge
+ '''make sure local merge branch exists'''
+ self._CreateLocalMergeBranch(branch.LocalMerge, self.revisionExpr)
+
revid = self.GetRevisionId(all_refs)
if head.startswith(R_HEADS):
@@ -1855,8 +1860,6 @@
if is_sha1 or tag_name is not None:
if self._CheckForSha1():
- if self.upstream:
- self._CreateRemoteBranch(self.upstream, self.revisionExpr)
return True
if is_sha1 and not depth:
# When syncing a specific commit and --depth is not set: