aboutsummaryrefslogtreecommitdiff
path: root/contrib/fast-import
diff options
context:
space:
mode:
authorPete Wyckoff <pw@padd.com>2011-12-17 12:39:03 -0500
committerJunio C Hamano <gitster@pobox.com>2011-12-17 18:20:27 -0800
commitd16520499d2652b5b59dfb25f9cf2d56a4c6913a (patch)
tree874bde050ffa44e1b4945e76ec9d0c923f45818d /contrib/fast-import
parentee228024933069b93ce23a1bd5eeb7ae12c792f2 (diff)
downloadgit-d16520499d2652b5b59dfb25f9cf2d56a4c6913a.tar.gz
git-d16520499d2652b5b59dfb25f9cf2d56a4c6913a.tar.xz
git-p4: fix skipSubmitEdit regression
Commit 7c766e5 (git-p4: introduce skipSubmitEdit, 2011-12-04) made it easier to automate submission to p4, but broke the most common case. Add a test for when the user really does edit and save the change template, and fix the bug that causes the test to fail. Also add a confirmation message when submission is cancelled. Reported-by: Michael Horowitz <michael.horowitz@ieee.org> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/fast-import')
-rwxr-xr-xcontrib/fast-import/git-p418
1 files changed, 11 insertions, 7 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 7d8e74b6d..594980302 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -872,13 +872,16 @@ class P4Submit(Command, P4UserMap):
if gitConfig("git-p4.skipSubmitEditCheck") == "true":
return True
- if os.stat(template_file).st_mtime <= mtime:
- while True:
- response = raw_input("Submit template unchanged. Submit anyway? [y]es, [n]o (skip this patch) ")
- if response == 'y':
- return True
- if response == 'n':
- return False
+ # modification time updated means user saved the file
+ if os.stat(template_file).st_mtime > mtime:
+ return True
+
+ while True:
+ response = raw_input("Submit template unchanged. Submit anyway? [y]es, [n]o (skip this patch) ")
+ if response == 'y':
+ return True
+ if response == 'n':
+ return False
def applyCommit(self, id):
print "Applying %s" % (read_pipe("git log --max-count=1 --pretty=oneline %s" % id))
@@ -1062,6 +1065,7 @@ class P4Submit(Command, P4UserMap):
self.modifyChangelistUser(changelist, p4User)
else:
# skip this patch
+ print "Submission cancelled, undoing p4 changes."
for f in editedFiles:
p4_revert(f)
for f in filesToAdd: