mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
Merge branch 'mc/git-p4-prepare-p4-only'
* mc/git-p4-prepare-p4-only: git-p4: fix submit in non --prepare-p4-only mode
This commit is contained in:
commit
2a20f4b7e2
12
git-p4.py
12
git-p4.py
|
@ -1238,7 +1238,7 @@ def edit_template(self, template_file):
|
||||||
if response == 'n':
|
if response == 'n':
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_diff_description(self, editedFiles):
|
def get_diff_description(self, editedFiles, filesToAdd):
|
||||||
# diff
|
# diff
|
||||||
if os.environ.has_key("P4DIFF"):
|
if os.environ.has_key("P4DIFF"):
|
||||||
del(os.environ["P4DIFF"])
|
del(os.environ["P4DIFF"])
|
||||||
|
@ -1258,7 +1258,7 @@ def get_diff_description(self, editedFiles):
|
||||||
newdiff += "+" + line
|
newdiff += "+" + line
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
return diff + newdiff
|
return (diff + newdiff).replace('\r\n', '\n')
|
||||||
|
|
||||||
def applyCommit(self, id):
|
def applyCommit(self, id):
|
||||||
"""Apply one commit, return True if it succeeded."""
|
"""Apply one commit, return True if it succeeded."""
|
||||||
|
@ -1422,10 +1422,10 @@ def applyCommit(self, id):
|
||||||
separatorLine = "######## everything below this line is just the diff #######\n"
|
separatorLine = "######## everything below this line is just the diff #######\n"
|
||||||
if not self.prepare_p4_only:
|
if not self.prepare_p4_only:
|
||||||
submitTemplate += separatorLine
|
submitTemplate += separatorLine
|
||||||
submitTemplate += self.get_diff_description(editedFiles)
|
submitTemplate += self.get_diff_description(editedFiles, filesToAdd)
|
||||||
|
|
||||||
(handle, fileName) = tempfile.mkstemp()
|
(handle, fileName) = tempfile.mkstemp()
|
||||||
tmpFile = os.fdopen(handle, "w+")
|
tmpFile = os.fdopen(handle, "w+b")
|
||||||
if self.isWindows:
|
if self.isWindows:
|
||||||
submitTemplate = submitTemplate.replace("\n", "\r\n")
|
submitTemplate = submitTemplate.replace("\n", "\r\n")
|
||||||
tmpFile.write(submitTemplate)
|
tmpFile.write(submitTemplate)
|
||||||
|
@ -1475,9 +1475,9 @@ def applyCommit(self, id):
|
||||||
tmpFile = open(fileName, "rb")
|
tmpFile = open(fileName, "rb")
|
||||||
message = tmpFile.read()
|
message = tmpFile.read()
|
||||||
tmpFile.close()
|
tmpFile.close()
|
||||||
submitTemplate = message[:message.index(separatorLine)]
|
|
||||||
if self.isWindows:
|
if self.isWindows:
|
||||||
submitTemplate = submitTemplate.replace("\r\n", "\n")
|
message = message.replace("\r\n", "\n")
|
||||||
|
submitTemplate = message[:message.index(separatorLine)]
|
||||||
p4_write_pipe(['submit', '-i'], submitTemplate)
|
p4_write_pipe(['submit', '-i'], submitTemplate)
|
||||||
|
|
||||||
if self.preserveUser:
|
if self.preserveUser:
|
||||||
|
|
Loading…
Reference in a new issue