зеркало из https://github.com/microsoft/git.git
Fixes for rollback, delete branches that did not exist at the specified p4 change
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
This commit is contained in:
Родитель
af8da89cb7
Коммит
52102d4784
|
@ -136,8 +136,10 @@ class P4RollBack(Command):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Command.__init__(self)
|
Command.__init__(self)
|
||||||
self.options = [
|
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.description = "A tool to debug the multi-branch import. Don't use :)"
|
||||||
|
self.verbose = False
|
||||||
|
|
||||||
def run(self, args):
|
def run(self, args):
|
||||||
if len(args) != 1:
|
if len(args) != 1:
|
||||||
|
@ -149,15 +151,22 @@ class P4RollBack(Command):
|
||||||
log = extractLogMessageFromGitCommit(ref)
|
log = extractLogMessageFromGitCommit(ref)
|
||||||
depotPath, change = extractDepotPathAndChangeFromGitLog(log)
|
depotPath, change = extractDepotPathAndChangeFromGitLog(log)
|
||||||
changed = False
|
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:
|
while len(change) > 0 and int(change) > maxChange:
|
||||||
changed = True
|
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))
|
system("git update-ref %s \"%s^\"" % (ref, ref))
|
||||||
log = extractLogMessageFromGitCommit(ref)
|
log = extractLogMessageFromGitCommit(ref)
|
||||||
depotPath, change = extractDepotPathAndChangeFromGitLog(log)
|
depotPath, change = extractDepotPathAndChangeFromGitLog(log)
|
||||||
|
|
||||||
if changed:
|
if changed:
|
||||||
print "%s is at %s" % (ref, change)
|
print "%s rewound to %s" % (ref, change)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче