summaryrefslogtreecommitdiff
path: root/contrib/fast-import/git-p4
diff options
context:
space:
mode:
authorLibravatar Simon Hausmann <shausman@trolltech.com>2007-05-21 23:44:24 +0200
committerLibravatar Simon Hausmann <shausman@trolltech.com>2007-05-21 23:44:24 +0200
commit52102d4784a5f16fd84eaf98b61f714460b68693 (patch)
treed699095db2cbd2033c490b88c3030fdee2b95306 /contrib/fast-import/git-p4
parentFix branch detection in multi-branch imports (diff)
downloadtgif-52102d4784a5f16fd84eaf98b61f714460b68693.tar.xz
Fixes for rollback, delete branches that did not exist at the specified p4 change
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
Diffstat (limited to 'contrib/fast-import/git-p4')
-rwxr-xr-xcontrib/fast-import/git-p413
1 files changed, 11 insertions, 2 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 515f7a906f..1457396abd 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -136,8 +136,10 @@ class P4RollBack(Command):
def __init__(self):
Command.__init__(self)
self.options = [
+ optparse.make_option("--verbose", dest="verbose", action="store_true")
]
self.description = "A tool to debug the multi-branch import. Don't use :)"
+ self.verbose = False
def run(self, args):
if len(args) != 1:
@@ -149,15 +151,22 @@ class P4RollBack(Command):
log = extractLogMessageFromGitCommit(ref)
depotPath, change = extractDepotPathAndChangeFromGitLog(log)
changed = False
+
+ if len(p4Cmd("changes -m 1 %s...@%s" % (depotPath, maxChange))) == 0:
+ print "Branch %s did not exist at change %s, deleting." % (ref, maxChange)
+ system("git update-ref -d %s `git rev-parse %s`" % (ref, ref))
+ continue
+
while len(change) > 0 and int(change) > maxChange:
changed = True
- print "%s is at %s ; rewinding towards %s" % (ref, change, maxChange)
+ if self.verbose:
+ print "%s is at %s ; rewinding towards %s" % (ref, change, maxChange)
system("git update-ref %s \"%s^\"" % (ref, ref))
log = extractLogMessageFromGitCommit(ref)
depotPath, change = extractDepotPathAndChangeFromGitLog(log)
if changed:
- print "%s is at %s" % (ref, change)
+ print "%s rewound to %s" % (ref, change)
return True