@matheusbsbs / matheus-bagliano / commits / d336c15835
Fork 0

Added the possibility of skipping patches during git-p4 submit

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

Simon Hausmann committed May 16, 2007 at 09:41 UTC d336c15835c924ba8d153edbfceca88d5c748582
1 file changed +13 -2
contrib/fast-import/git-p4
+13 -2
@@ -230,11 +230,13 @@ class P4Submit(Command):
230 diff = mypopen("git diff-tree -r --name-status \"%s^\" \"%s\"" % (id, id)).readlines()
231 filesToAdd = set()
232 filesToDelete = set()
233 + editedFiles = set()
234 for line in diff:
235 modifier = line[0]
236 path = line[1:].strip()
237 if modifier == "M":
237 - system("p4 edit %s" % path)
238 + system("p4 edit \"%s\"" % path)
239 + editedFiles.add(path)
240 elif modifier == "A":
241 filesToAdd.add(path)
242 if path in filesToDelete:
@@ -308,7 +310,7 @@ class P4Submit(Command):
310 firstIteration = True
311 while response == "e":
312 if not firstIteration:
311 - response = raw_input("Do you want to submit this change? [y]es/[e]dit/[n]o ")
313 + response = raw_input("Do you want to submit this change? [y]es/[e]dit/[n]o/[s]kip ")
314 firstIteration = False
315 if response == "e":
316 [handle, fileName] = tempfile.mkstemp()
@@ -334,6 +336,15 @@ class P4Submit(Command):
336 pipe = os.popen("p4 submit -i", "wb")
337 pipe.write(submitTemplate)
338 pipe.close()
339 + elif response == "s":
340 + for f in editedFiles:
341 + system("p4 revert \"%s\"" % f);
342 + for f in filesToAdd:
343 + system("p4 revert \"%s\"" % f);
344 + system("rm %s" %f)
345 + for f in filesToDelete:
346 + system("p4 delete \"%s\"" % f);
347 + return
348 else:
349 print "Not submitting!"
350 self.interactive = False