Skip to content

Commit

Permalink
Added support for --max-changes=<count> to ease import debugging
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
  • Loading branch information
Simon Hausmann committed May 22, 2007
1 parent a028a98 commit 01a9c9c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion contrib/fast-import/git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,8 @@ class P4Sync(Command):
optparse.make_option("--detect-labels", dest="detectLabels", action="store_true"),
optparse.make_option("--with-origin", dest="syncWithOrigin", action="store_true"),
optparse.make_option("--verbose", dest="verbose", action="store_true"),
optparse.make_option("--import-local", dest="importIntoRemotes", action="store_false")
optparse.make_option("--import-local", dest="importIntoRemotes", action="store_false"),
optparse.make_option("--max-changes", dest="maxChanges")
]
self.description = """Imports from Perforce into a git repository.\n
example:
Expand All @@ -521,6 +522,7 @@ class P4Sync(Command):
self.syncWithOrigin = False
self.verbose = False
self.importIntoRemotes = True
self.maxChanges = ""

def p4File(self, depotPath):
return os.popen("p4 print -q \"%s\"" % depotPath, "rb").read()
Expand Down Expand Up @@ -971,6 +973,9 @@ class P4Sync(Command):

changes.reverse()

if len(self.maxChanges) > 0:
changes = changes[0:min(int(self.maxChanges), len(changes))]

if len(changes) == 0:
if not self.silent:
print "No changes to import!"
Expand Down

0 comments on commit 01a9c9c

Please sign in to comment.