+class P4RollBack(Command):
+ def __init__(self):
+ Command.__init__(self)
+ self.options = [
+ ]
+ self.description = "A tool to debug the multi-branch import. Don't use :)"
+
+ def run(self, args):
+ if len(args) != 1:
+ return False
+ maxChange = int(args[0])
+ for line in mypopen("git rev-parse --symbolic --remotes").readlines():
+ if line.startswith("p4/") and line != "p4/HEAD\n":
+ ref = "refs/remotes/" + line[:-1]
+ log = extractLogMessageFromGitCommit(ref)
+ depotPath, change = extractDepotPathAndChangeFromGitLog(log)
+ changed = False
+ while len(change) > 0 and int(change) > maxChange:
+ changed = True
+ 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)
+
+ return True
+