Index: third_party/upload.py |
diff --git a/third_party/upload.py b/third_party/upload.py |
index befdf52dfa0aa0083677e3d3e444282a8c5f8792..f7e1722ebac0dd5c084a97415e19835300d1b1d0 100755 |
--- a/third_party/upload.py |
+++ b/third_party/upload.py |
@@ -944,7 +944,6 @@ class VersionControlSystem(object): |
raise NotImplementedError( |
"abstract method -- subclass %s must override" % self.__class__) |
- |
def GetBaseFiles(self, diff): |
"""Helper that calls GetBase file for each file in the patch. |
@@ -963,7 +962,6 @@ class VersionControlSystem(object): |
files[filename] = self.GetBaseFile(filename) |
return files |
- |
def UploadBaseFiles(self, issue, rpc_server, patch_list, patchset, options, |
files): |
"""Uploads the base files (and if necessary, the current ones as well).""" |
@@ -1033,7 +1031,6 @@ class VersionControlSystem(object): |
for t in threads: |
print t.get(timeout=60) |
- |
def IsImage(self, filename): |
"""Returns true if the filename has an image extension.""" |
mimetype = mimetypes.guess_type(filename)[0] |
@@ -1048,6 +1045,10 @@ class VersionControlSystem(object): |
# http://selenic.com/hg/file/848a6658069e/mercurial/util.py#l229 |
return bool(data and "\0" in data) |
+ def GetMostRecentCommitSummary(self): |
+ """Returns a one line summary of the current commit.""" |
+ return "" |
+ |
class SubversionVCS(VersionControlSystem): |
"""Implementation of the VersionControlSystem interface for Subversion.""" |
@@ -1511,6 +1512,9 @@ class GitVCS(VersionControlSystem): |
new_content = None |
return (base_content, new_content, is_binary, status) |
+ def GetMostRecentCommitSummary(self): |
+ return RunShell(["git", "log", "-1", "--format=%s"], silent_ok=True).strip() |
+ |
class CVSVCS(VersionControlSystem): |
"""Implementation of the VersionControlSystem interface for CVS.""" |
@@ -2435,12 +2439,16 @@ def RealMain(argv, data=None): |
file = open(options.file, 'r') |
message = file.read() |
file.close() |
- if options.issue: |
- prompt = "Title describing this patch set: " |
- else: |
- prompt = "New issue subject: " |
- title = ( |
- title or message.split('\n', 1)[0].strip() or raw_input(prompt).strip()) |
+ title = title or message.split('\n', 1)[0].strip() |
+ if not title: |
+ if options.issue: |
+ prompt = "Title describing this patch set" |
+ else: |
+ prompt = "New issue subject" |
+ title_default = vcs.GetMostRecentCommitSummary() |
+ if title_default: |
+ prompt += " [%s]" % title_default |
+ title = raw_input(prompt + ": ").strip() or title_default |
if not title and not options.issue: |
ErrorExit("A non-empty title is required for a new issue") |
# For existing issues, it's fine to give a patchset an empty name. Rietveld |