summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4b61b5c)
raw | patch | inline | side by side (parent: 4b61b5c)
author | Simon Hausmann <simon@lst.de> | |
Tue, 19 Feb 2008 08:29:06 +0000 (09:29 +0100) | ||
committer | Simon Hausmann <simon@lst.de> | |
Wed, 27 Feb 2008 15:27:03 +0000 (16:27 +0100) |
Instead of trying to substitute fields in the p4 submit template we now simply
replace the description of the submit with the log message of the git commit.
Signed-off-by: Simon Hausmann <simon@lst.de>
replace the description of the submit with the log message of the git commit.
Signed-off-by: Simon Hausmann <simon@lst.de>
contrib/fast-import/git-p4 | patch | blob | history |
index f2a6059a7e8f2011be063d5099939c0c2b11cc91..e55a41b10ed3fd7f93a9c5b60870dc5dc837177c 100755 (executable)
self.verbose = False
self.isWindows = (platform.system() == "Windows")
- self.logSubstitutions = {}
- self.logSubstitutions["<enter description here>"] = "%log%"
- self.logSubstitutions["\tDetails:"] = "\tDetails: %log%"
-
def check(self):
if len(p4CmdList("opened ...")) > 0:
die("You have files opened with perforce! Close them before starting the sync.")
self.config["commits"] = commits
+ # replaces everything between 'Description:' and the next P4 submit template field with the
+ # commit message
def prepareLogMessage(self, template, message):
result = ""
+ inDescriptionSection = False
+
for line in template.split("\n"):
if line.startswith("#"):
result += line + "\n"
continue
- substituted = False
- for key in self.logSubstitutions.keys():
- if line.find(key) != -1:
- value = self.logSubstitutions[key]
- value = value.replace("%log%", message)
- if value != "@remove@":
- result += line.replace(key, value) + "\n"
- substituted = True
- break
+ if inDescriptionSection:
+ if line.startswith("Files:"):
+ inDescriptionSection = False
+ else:
+ continue
+ else:
+ if line.startswith("Description:"):
+ inDescriptionSection = True
+ line += "\n"
+ for messageLine in message.split("\n"):
+ line += "\t" + messageLine + "\n"
- if not substituted:
- result += line + "\n"
+ result += line + "\n"
return result
logMessage = ""
if not self.directSubmit:
logMessage = extractLogMessageFromGitCommit(id)
- logMessage = logMessage.replace("\n", "\n\t")
if self.isWindows:
logMessage = logMessage.replace("\n", "\r\n")
logMessage = logMessage.strip()