mirror of
https://github.com/frej/fast-export.git
synced 2025-11-18 08:20:39 +01:00
Don't show the submit template and the diff first in less but show it in $editor right away
This commit is contained in:
14
git-p4.py
14
git-p4.py
@@ -235,24 +235,26 @@ class P4Sync(Command):
|
|||||||
diff += "+" + line
|
diff += "+" + line
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
pipe = os.popen("less", "w")
|
separatorLine = "######## everything below this line is just the diff #######\n"
|
||||||
pipe.write(submitTemplate + diff)
|
|
||||||
pipe.close()
|
|
||||||
|
|
||||||
response = "e"
|
response = "e"
|
||||||
|
firstIteration = True
|
||||||
while response == "e":
|
while response == "e":
|
||||||
response = raw_input("Do you want to submit this change (y/e/n)? ")
|
if not firstIteration:
|
||||||
|
response = raw_input("Do you want to submit this change (y/e/n)? ")
|
||||||
|
firstIteration = False
|
||||||
if response == "e":
|
if response == "e":
|
||||||
[handle, fileName] = tempfile.mkstemp()
|
[handle, fileName] = tempfile.mkstemp()
|
||||||
tmpFile = os.fdopen(handle, "w+")
|
tmpFile = os.fdopen(handle, "w+")
|
||||||
tmpFile.write(submitTemplate)
|
tmpFile.write(submitTemplate + separatorLine + diff)
|
||||||
tmpFile.close()
|
tmpFile.close()
|
||||||
editor = os.environ.get("EDITOR", "vi")
|
editor = os.environ.get("EDITOR", "vi")
|
||||||
system(editor + " " + fileName)
|
system(editor + " " + fileName)
|
||||||
tmpFile = open(fileName, "r")
|
tmpFile = open(fileName, "r")
|
||||||
submitTemplate = tmpFile.read()
|
message = tmpFile.read()
|
||||||
tmpFile.close()
|
tmpFile.close()
|
||||||
os.remove(fileName)
|
os.remove(fileName)
|
||||||
|
submitTemplate = message[:message.index(separatorLine)]
|
||||||
|
|
||||||
if response == "y" or response == "yes":
|
if response == "y" or response == "yes":
|
||||||
if self.dryRun:
|
if self.dryRun:
|
||||||
|
|||||||
Reference in New Issue
Block a user