@matheusbsbs / matheus-bagliano / commits / 01a9c9c5a8
Fork 0

Added support for --max-changes=<count> to ease import debugging

Signed-off-by: Simon Hausmann <shausman@trolltech.com>

Simon Hausmann committed May 23, 2007 at 00:07 UTC 01a9c9c5a80c6a1e82298870ca8e5bc73b2a828d
1 file changed +6 -1
contrib/fast-import/git-p4
+6 -1
@@ -499,7 +499,8 @@ class P4Sync(Command):
499 optparse.make_option("--detect-labels", dest="detectLabels", action="store_true"),
500 optparse.make_option("--with-origin", dest="syncWithOrigin", action="store_true"),
501 optparse.make_option("--verbose", dest="verbose", action="store_true"),
502 - optparse.make_option("--import-local", dest="importIntoRemotes", action="store_false")
502 + optparse.make_option("--import-local", dest="importIntoRemotes", action="store_false"),
503 + optparse.make_option("--max-changes", dest="maxChanges")
504 ]
505 self.description = """Imports from Perforce into a git repository.\n
506 example:
@@ -521,6 +522,7 @@ class P4Sync(Command):
522 self.syncWithOrigin = False
523 self.verbose = False
524 self.importIntoRemotes = True
525 + self.maxChanges = ""
526
527 def p4File(self, depotPath):
528 return os.popen("p4 print -q \"%s\"" % depotPath, "rb").read()
@@ -971,6 +973,9 @@ class P4Sync(Command):
973
974 changes.reverse()
975
976 + if len(self.maxChanges) > 0:
977 + changes = changes[0:min(int(self.maxChanges), len(changes))]
978 +
979 if len(changes) == 0:
980 if not self.silent:
981 print "No changes to import!"