Turn off potentially slow label detection by default
[gitweb.git] / contrib / fast-import / git-p4
index aa85800d697f25518886dcd5d1826eb1eef91958..fcdfe22a45ad58ea4bf8b7fa0979b256a622c987 100755 (executable)
@@ -417,7 +417,8 @@ class P4Sync(Command):
                 optparse.make_option("--silent", dest="silent", action="store_true"),
                 optparse.make_option("--known-branches", dest="knownBranches"),
                 optparse.make_option("--data-cache", dest="dataCache", action="store_true"),
-                optparse.make_option("--command-cache", dest="commandCache", action="store_true")
+                optparse.make_option("--command-cache", dest="commandCache", action="store_true"),
+                optparse.make_option("--detect-labels", dest="detectLabels", action="store_true")
         ]
         self.description = """Imports from Perforce into a git repository.\n
     example:
@@ -437,6 +438,7 @@ class P4Sync(Command):
         self.committedChanges = Set()
         self.branch = ""
         self.detectBranches = False
+        self.detectLabels = False
         self.changesFile = ""
 
     def p4File(self, depotPath):
@@ -892,7 +894,9 @@ class P4Sync(Command):
             self.globalPrefix += "/"
 
         self.getUserMap()
-        self.getLabels();
+        self.labels = {}
+        if self.detectLabels:
+            self.getLabels();
 
         if len(self.changeRange) == 0:
             try:
@@ -974,7 +978,7 @@ class P4Sync(Command):
             if len(changes) == 0:
                 if not self.silent:
                     print "no changes to import!"
-                sys.exit(1)
+                return True
 
             cnt = 1
             for change in changes:
@@ -1053,7 +1057,9 @@ class P4Rebase(Command):
         sync = P4Sync()
         sync.run([])
         print "Rebasing the current branch"
+        oldHead = os.popen("git rev-parse HEAD").read()[:-1]
         system("git rebase p4")
+        system("git diff-tree --stat --summary -M %s HEAD" % oldHead)
         return True
 
 class HelpFormatter(optparse.IndentedHelpFormatter):