Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Don't show the submit template and the diff first in less but show it in $editor right away
author
Simon Hausmann
<simon@lst.de>
Wed, 21 Mar 2007 20:04:12 +0000
(21:04 +0100)
committer
Simon Hausmann
<simon@lst.de>
Wed, 21 Mar 2007 20:04:12 +0000
(21:04 +0100)
Signed-off-by: Simon Hausmann <simon@lst.de>
contrib/fast-import/git-p4.py
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
2061865
)
diff --git
a/contrib/fast-import/git-p4.py
b/contrib/fast-import/git-p4.py
index f940e93bad1db606f128acd601b5d271f8e0a1ed..06858844e591f93a1fcf64a12e37b6e0fb4d5401 100755
(executable)
--- a/
contrib/fast-import/git-p4.py
+++ b/
contrib/fast-import/git-p4.py
@@
-235,24
+235,26
@@
def apply(self, id):
diff += "+" + line
f.close()
diff += "+" + line
f.close()
- pipe = os.popen("less", "w")
- pipe.write(submitTemplate + diff)
- pipe.close()
+ separatorLine = "######## everything below this line is just the diff #######\n"
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":
[handle, fileName] = tempfile.mkstemp()
tmpFile = os.fdopen(handle, "w+")
if response == "e":
[handle, fileName] = tempfile.mkstemp()
tmpFile = os.fdopen(handle, "w+")
- tmpFile.write(submitTemplate)
+ tmpFile.write(submitTemplate
+ separatorLine + diff
)
tmpFile.close()
editor = os.environ.get("EDITOR", "vi")
system(editor + " " + fileName)
tmpFile = open(fileName, "r")
tmpFile.close()
editor = os.environ.get("EDITOR", "vi")
system(editor + " " + fileName)
tmpFile = open(fileName, "r")
-
submitTemplat
e = tmpFile.read()
+
messag
e = tmpFile.read()
tmpFile.close()
os.remove(fileName)
tmpFile.close()
os.remove(fileName)
+ submitTemplate = message[:message.index(separatorLine)]
if response == "y" or response == "yes":
if self.dryRun:
if response == "y" or response == "yes":
if self.dryRun: