@matheusbsbs / matheus-bagliano / commits / 341dc1c179
Fork 0

Improved output for multi branch imports and noted another little todo item

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

Simon Hausmann committed May 21, 2007 at 00:39 UTC 341dc1c1793455875086373a865db4d0a132ef6e
1 file changed +17 -6
contrib/fast-import/git-p4
+17 -6
@@ -16,6 +16,8 @@
16 # it's possible to recover if anything goes wrong instead of potentially
17 # loosing a change entirely because it was never comitted to git and
18 # the p4 submit failed (or resulted in lots of conflicts, etc.)
19 +# * Consider making --with-origin the default, assuming that the git
20 +# protocol is always more efficient. (needs manual testing first :)
21 #
22
23 import optparse, sys, os, marshal, popen2, subprocess, shelve
@@ -729,7 +731,7 @@ class P4Sync(Command):
731 self.initialParents = {}
732
733 self.listExistingP4GitBranches()
732 - if len(self.p4BranchesInGit) > 1:
734 + if len(self.p4BranchesInGit) > 1 and not self.silent:
735 print "Importing from/into multiple branches"
736 self.detectBranches = True
737
@@ -795,7 +797,7 @@ class P4Sync(Command):
797 self.depotPath = self.previousDepotPath
798 self.changeRange = "@%s,#head" % p4Change
799 self.initialParent = parseRevision(self.branch)
798 - if not self.silent:
800 + if not self.silent and not self.detectBranches:
801 print "Performing incremental import into %s git branch" % self.branch
802
803 if not self.branch.startswith("refs/"):
@@ -920,15 +922,17 @@ class P4Sync(Command):
922
923 if len(changes) == 0:
924 if not self.silent:
923 - print "no changes to import!"
925 + print "No changes to import!"
926 return True
927
928 + self.updatedBranches = set()
929 +
930 cnt = 1
931 for change in changes:
932 description = p4Cmd("describe %s" % change)
933
934 if not self.silent:
931 - sys.stdout.write("\rimporting revision %s (%s%%)" % (change, cnt * 100 / len(changes)))
935 + sys.stdout.write("\rImporting revision %s (%s%%)" % (change, cnt * 100 / len(changes)))
936 sys.stdout.flush()
937 cnt = cnt + 1
938
@@ -945,6 +949,8 @@ class P4Sync(Command):
949 if self.verbose:
950 print "branch is %s" % branch
951
952 + self.updatedBranches.add(branch)
953 +
954 if branch not in self.createdBranches:
955 self.createdBranches.add(branch)
956 parent = self.knownBranches[branch]
@@ -984,8 +990,13 @@ class P4Sync(Command):
990 print self.gitError.read()
991 sys.exit(1)
992
987 - if not self.silent:
988 - print ""
993 + if not self.silent:
994 + print ""
995 + if len(self.updatedBranches) > 0:
996 + sys.stdout.write("Updated branches: ")
997 + for b in self.updatedBranches:
998 + sys.stdout.write("%s " % b)
999 + sys.stdout.write("\n")
1000
1001
1002 self.gitStream.close()