aboutsummaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorPete Wyckoff <pw@padd.com>2012-09-09 16:16:05 -0400
committerJunio C Hamano <gitster@pobox.com>2012-09-16 21:52:52 -0700
commit7e5dd9f2ccf2141d65e4621b765a136796b0d55b (patch)
treee36a8536c70bd82813385fb772261e6dbf524569 /git-p4.py
parent449bb9cf1a0c42ddf6e9b9b6fd447eda12f9bc92 (diff)
downloadgit-7e5dd9f2ccf2141d65e4621b765a136796b0d55b.tar.gz
git-7e5dd9f2ccf2141d65e4621b765a136796b0d55b.tar.xz
git p4: move conflict prompt into run, add [q]uit input
When applying a commit to the p4 workspace fails, a prompt asks what to do next. This belongs up in run() instead of in applyCommit(), where run() can notice, for instance, that the prompt is unnecessary because this is the last commit. Offer two options about how to continue at conflict: [s]kip or [q]uit. Having an explicit "quit" option gives git p4 a chance to clean up, show the applied-commit summary, and do tag export. Signed-off-by: Pete Wyckoff <pw@padd.com> Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py41
1 files changed, 29 insertions, 12 deletions
diff --git a/git-p4.py b/git-p4.py
index e08fea18d..479f1fc7d 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1198,17 +1198,11 @@ class P4Submit(Command, P4UserMap):
patch_succeeded = True
if not patch_succeeded:
- print "What do you want to do?"
- response = "x"
- while response != "s":
- response = raw_input("[s]kip this patch ")
- if response == "s":
- print "Skipping! Good luck with the next patches..."
- for f in editedFiles:
- p4_revert(f)
- for f in filesToAdd:
- os.remove(f)
- return False
+ for f in editedFiles:
+ p4_revert(f)
+ for f in filesToAdd:
+ os.remove(f)
+ return False
system(applyPatchCmd)
@@ -1475,11 +1469,34 @@ class P4Submit(Command, P4UserMap):
if gitConfig("git-p4.detectCopiesHarder", "--bool") == "true":
self.diffOpts += " --find-copies-harder"
+ #
+ # Apply the commits, one at a time. On failure, ask if should
+ # continue to try the rest of the patches, or quit.
+ #
applied = []
- for commit in commits:
+ last = len(commits) - 1
+ for i, commit in enumerate(commits):
ok = self.applyCommit(commit)
if ok:
applied.append(commit)
+ else:
+ if i < last:
+ quit = False
+ while True:
+ print "What do you want to do?"
+ response = raw_input("[s]kip this commit but apply"
+ " the rest, or [q]uit? ")
+ if not response:
+ continue
+ if response[0] == "s":
+ print "Skipping this commit, but applying the rest"
+ break
+ if response[0] == "q":
+ print "Quitting"
+ quit = True
+ break
+ if quit:
+ break
chdir(self.oldWorkingDirectory)