MCPcopy Index your code
hub / github.com/git/git / edit_template

Method edit_template

git-p4.py:2079–2113  ·  view source on GitHub ↗

Invoke the editor to let the user change the submission message. Return true if okay to continue with the submit.

(self, template_file)

Source from the content-addressed store, hash-verified

2077 return template
2078
2079 def edit_template(self, template_file):
2080 """Invoke the editor to let the user change the submission message.
2081
2082 Return true if okay to continue with the submit.
2083 """
2084
2085 # if configured to skip the editing part, just submit
2086 if gitConfigBool("git-p4.skipSubmitEdit"):
2087 return True
2088
2089 # look at the modification time, to check later if the user saved
2090 # the file
2091 mtime = os.stat(template_file).st_mtime
2092
2093 # invoke the editor
2094 if "P4EDITOR" in os.environ and (os.environ.get("P4EDITOR") != ""):
2095 editor = os.environ.get("P4EDITOR")
2096 else:
2097 editor = read_pipe(["git", "var", "GIT_EDITOR"]).strip()
2098 system(["sh", "-c", ('%s "$@"' % editor), editor, template_file])
2099
2100 # If the file was not saved, prompt to see if this patch should
2101 # be skipped. But skip this verification step if configured so.
2102 if gitConfigBool("git-p4.skipSubmitEditCheck"):
2103 return True
2104
2105 # modification time updated means user saved the file
2106 if os.stat(template_file).st_mtime > mtime:
2107 return True
2108
2109 response = prompt("Submit template unchanged. Submit anyway? [y]es, [n]o (skip this patch) ")
2110 if response == 'y':
2111 return True
2112 if response == 'n':
2113 return False
2114
2115 def get_diff_description(self, editedFiles, filesToAdd, symlinks):
2116 # diff

Callers 1

applyCommitMethod · 0.95

Calls 4

gitConfigBoolFunction · 0.85
read_pipeFunction · 0.85
systemFunction · 0.85
promptFunction · 0.85

Tested by

no test coverage detected