reformatting: break long lines.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Han-Wen Nienhuys committed
May 23, 2007 at 16:53 UTC
cebdf5af319ce638862fe2e2cd2797840962ddbb
1 file changed
+30
-18
contrib/fast-import/git-p4
+30
-18
@@ -222,7 +222,9 @@ class P4Submit(Command):
222
223
def start(self):
224
if len(self.config) > 0 and not self.reset:
225
- die("Cannot start sync. Previous sync config found at %s\nIf you want to start submitting again from scratch maybe you want to call git-p4 submit --reset" % self.configFile)
225
+ die("Cannot start sync. Previous sync config found at %s\n"
226
+ "If you want to start submitting again from scratch "
227
+ "maybe you want to call git-p4 submit --reset" % self.configFile)
228
229
commits = []
230
if self.directSubmit:
@@ -297,7 +299,8 @@ class P4Submit(Command):
299
print "What do you want to do?"
300
response = "x"
301
while response != "s" and response != "a" and response != "w":
300
- response = raw_input("[s]kip this patch / [a]pply the patch forcibly and with .rej files / [w]rite the patch to a file (patch.txt) ")
302
+ response = raw_input("[s]kip this patch / [a]pply the patch forcibly "
303
+ "and with .rej files / [w]rite the patch to a file (patch.txt) ")
304
if response == "s":
305
print "Skipping! Good luck with the next patches..."
306
return
@@ -309,11 +312,13 @@ class P4Submit(Command):
312
if len(filesToDelete):
313
print "The following files should be scheduled for deletion with p4 delete:"
314
print " ".join(filesToDelete)
312
- die("Please resolve and submit the conflict manually and continue afterwards with git-p4 submit --continue")
315
+ die("Please resolve and submit the conflict manually and "
316
+ + "continue afterwards with git-p4 submit --continue")
317
elif response == "w":
318
system(diffcmd + " > patch.txt")
319
print "Patch saved to patch.txt in %s !" % self.clientPath
316
- die("Please resolve and submit the conflict manually and continue afterwards with git-p4 submit --continue")
320
+ die("Please resolve and submit the conflict manually and "
321
+ "continue afterwards with git-p4 submit --continue")
322
323
system(applyPatchCmd)
324
@@ -407,7 +412,9 @@ class P4Submit(Command):
412
file = open(fileName, "w+")
413
file.write(self.prepareLogMessage(template, logMessage))
414
file.close()
410
- print "Perforce submit template written as %s. Please review/edit and then use p4 submit -i < %s to submit directly!" % (fileName, fileName)
415
+ print ("Perforce submit template written as %s. "
416
+ + "Please review/edit and then use p4 submit -i < %s to submit directly!"
417
+ % (fileName, fileName))
418
419
def run(self, args):
420
global gitdir
@@ -634,7 +641,6 @@ class P4Sync(Command):
641
for file in files:
642
path = file["path"]
643
if not path.startswith(branchPrefix):
637
- # if not silent:
644
# print "\nchanged files: ignoring path %s outside of branch prefix %s in change %s" % (path, branchPrefix, details["change"])
645
continue
646
rev = file["rev"]
@@ -701,11 +707,13 @@ class P4Sync(Command):
707
708
else:
709
if not self.silent:
704
- print "Tag %s does not match with change %s: files do not match." % (labelDetails["label"], change)
710
+ print ("Tag %s does not match with change %s: files do not match."
711
+ % (labelDetails["label"], change))
712
713
else:
714
if not self.silent:
708
- print "Tag %s does not match with change %s: file count is different." % (labelDetails["label"], change)
715
+ print ("Tag %s does not match with change %s: file count is different."
716
+ % (labelDetails["label"], change))
717
718
def getUserMapFromPerforceServer(self):
719
if self.userMapFromPerforceServer:
@@ -854,11 +862,10 @@ class P4Sync(Command):
862
else:
863
self.refPrefix = "refs/heads/"
864
857
- if self.syncWithOrigin:
858
- if self.hasOrigin:
859
- if not self.silent:
860
- print "Syncing with origin first by calling git fetch origin"
861
- system("git fetch origin")
865
+ if self.syncWithOrigin and self.hasOrigin:
866
+ if not self.silent:
867
+ print "Syncing with origin first by calling git fetch origin"
868
+ system("git fetch origin")
869
870
if len(self.branch) == 0:
871
self.branch = self.refPrefix + "master"
@@ -884,7 +891,8 @@ class P4Sync(Command):
891
892
p4Change = 0
893
for branch in self.p4BranchesInGit:
887
- depotPath, change = extractDepotPathAndChangeFromGitLog(extractLogMessageFromGitCommit(self.refPrefix + branch))
894
+ logMsg = extractLogMessageFromGitCommit(self.refPrefix + branch)
895
+ (depotPath, change) = extractDepotPathAndChangeFromGitLog(logMsg)
896
897
if self.verbose:
898
print "path %s change %s" % (depotPath, change)
@@ -922,7 +930,8 @@ class P4Sync(Command):
930
return False
931
else:
932
if len(self.depotPath) != 0 and self.depotPath != args[0]:
925
- print "previous import used depot path %s and now %s was specified. this doesn't work!" % (self.depotPath, args[0])
933
+ print ("previous import used depot path %s and now %s was specified. "
934
+ "This doesn't work!" % (self.depotPath, args[0]))
935
sys.exit(1)
936
self.depotPath = args[0]
937
@@ -968,7 +977,8 @@ class P4Sync(Command):
977
978
self.tz = "%+03d%02d" % (- time.timezone / 3600, ((- time.timezone % 3600) / 60))
979
971
- importProcess = subprocess.Popen(["git", "fast-import"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE);
980
+ importProcess = subprocess.Popen(["git", "fast-import"],
981
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE);
982
self.gitOutput = importProcess.stdout
983
self.gitStream = importProcess.stdin
984
self.gitError = importProcess.stderr
@@ -977,7 +987,8 @@ class P4Sync(Command):
987
print "Doing initial import of %s from revision %s" % (self.depotPath, self.revision)
988
989
details = { "user" : "git perforce import user", "time" : int(time.time()) }
980
- details["desc"] = "Initial import of %s from the state at revision %s" % (self.depotPath, self.revision)
990
+ details["desc"] = ("Initial import of %s from the state at revision %s"
991
+ % (self.depotPath, self.revision))
992
details["change"] = self.revision
993
newestRevision = 0
994
@@ -1123,7 +1134,8 @@ class P4Rebase(Command):
1134
def __init__(self):
1135
Command.__init__(self)
1136
self.options = [ ]
1126
- self.description = "Fetches the latest revision from perforce and rebases the current work (branch) against it"
1137
+ self.description = ("Fetches the latest revision from perforce and "
1138
+ + "rebases the current work (branch) against it")
1139
1140
def run(self, args):
1141
sync = P4Sync()