summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Pontillo <pontillo@gmail.com>2012-02-28 11:53:24 -0800
committerShawn O. Pearce <sop@google.com>2012-03-12 12:24:22 -0700
commitd3153825723b2bec3476e84f2e423c646fd4c598 (patch)
tree11436435822daca2da44674fc538b3a668c199a5
parent43bda84362b8fd8bb74a81003e8b49cff15ea5ed (diff)
downloadgit-repo-d3153825723b2bec3476e84f2e423c646fd4c598.tar.gz
Add 'rebase="false"' attribute to the <project/> XML.
This new attribute can prevent 'repo sync' from automatically rebasing. I hit a situation in where one of the git repositories I was tracking was actually an external repository that I wanted to pull commits into and merge myself. (NOT rebase, since that would lose the merge history.) In this case, I'm not using 'repo upload', I'm manually managing the merges to and from this repository. Everything was going great until I typed 'repo sync' and it rebased my manually-merged tree. Hence the option to skip it. Change-Id: I965e0dd1acb87f4a56752ebedc7e2de1c502dbf8
-rw-r--r--manifest_xml.py9
-rw-r--r--project.py7
2 files changed, 13 insertions, 3 deletions
diff --git a/manifest_xml.py b/manifest_xml.py
index 9189eec4..44538690 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -498,6 +498,12 @@ class XmlManifest(object):
498 "project %s path cannot be absolute in %s" % \ 498 "project %s path cannot be absolute in %s" % \
499 (name, self.manifestFile) 499 (name, self.manifestFile)
500 500
501 rebase = node.getAttribute('rebase')
502 if not rebase:
503 rebase = True
504 else:
505 rebase = rebase.lower() in ("yes", "true", "1")
506
501 if self.IsMirror: 507 if self.IsMirror:
502 relpath = None 508 relpath = None
503 worktree = None 509 worktree = None
@@ -513,7 +519,8 @@ class XmlManifest(object):
513 worktree = worktree, 519 worktree = worktree,
514 relpath = path, 520 relpath = path,
515 revisionExpr = revisionExpr, 521 revisionExpr = revisionExpr,
516 revisionId = None) 522 revisionId = None,
523 rebase = rebase)
517 524
518 for n in node.childNodes: 525 for n in node.childNodes:
519 if n.nodeName == 'copyfile': 526 if n.nodeName == 'copyfile':
diff --git a/project.py b/project.py
index f1a931c6..60fa510a 100644
--- a/project.py
+++ b/project.py
@@ -503,7 +503,8 @@ class Project(object):
503 worktree, 503 worktree,
504 relpath, 504 relpath,
505 revisionExpr, 505 revisionExpr,
506 revisionId): 506 revisionId,
507 rebase = True):
507 self.manifest = manifest 508 self.manifest = manifest
508 self.name = name 509 self.name = name
509 self.remote = remote 510 self.remote = remote
@@ -522,6 +523,8 @@ class Project(object):
522 else: 523 else:
523 self.revisionId = revisionId 524 self.revisionId = revisionId
524 525
526 self.rebase = rebase
527
525 self.snapshots = {} 528 self.snapshots = {}
526 self.copyfiles = [] 529 self.copyfiles = []
527 self.config = GitConfig.ForRepository( 530 self.config = GitConfig.ForRepository(
@@ -1096,7 +1099,7 @@ class Project(object):
1096 branch.merge = self.revisionExpr 1099 branch.merge = self.revisionExpr
1097 branch.Save() 1100 branch.Save()
1098 1101
1099 if cnt_mine > 0: 1102 if cnt_mine > 0 and self.rebase:
1100 def _dorebase(): 1103 def _dorebase():
1101 self._Rebase(upstream = '%s^1' % last_mine, onto = revid) 1104 self._Rebase(upstream = '%s^1' % last_mine, onto = revid)
1102 self._CopyFiles() 1105 self._CopyFiles()