Skip to content

Commit

Permalink
Issue 12872: Define patchset with None as default in RealMain
Browse files Browse the repository at this point in the history
(issue79).


git-svn-id: http://rietveld.googlecode.com/svn/trunk@395 e30e9e8f-1b4c-0410-881d-6f13584adfe0
  • Loading branch information
albrecht.andi committed Feb 2, 2009
1 parent 42c50cb commit 69d913a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions static/upload.py
Expand Up @@ -641,7 +641,7 @@ def GetBaseFile(self, filename):

def GetBaseFiles(self, diff):
"""Helper that calls GetBase file for each file in the patch.
Returns:
A dictionary that maps from filename to GetBaseFile's tuple. Filenames
are retrieved based on lines that start with "Index:" or
Expand Down Expand Up @@ -1115,7 +1115,7 @@ def GetBaseFile(self, filename):
if out[0].startswith('%s: ' % relpath):
out = out[1:]
if len(out) > 1:
# Moved/copied => considered as modified, use old filename to
# Moved/copied => considered as modified, use old filename to
# retrieve base contents
oldrelpath = out[1].strip()
status = "M"
Expand Down Expand Up @@ -1248,6 +1248,18 @@ def GuessVCS(options):


def RealMain(argv, data=None):
"""The real main function.
Args:
argv: Command line arguments.
data: Diff contents. If None (default) the diff is generated by
the VersionControlSystem implementation returned by GuessVCS().
Returns:
A 2-tuple (issue id, patchset id).
The patchset id is None if the base files are not uploaded by this
script (applies only to SVN checkouts).
"""
logging.basicConfig(format=("%(asctime).19s %(levelname)s %(filename)s:"
"%(lineno)s %(message)s "))
os.environ['LC_ALL'] = 'C'
Expand Down Expand Up @@ -1333,6 +1345,7 @@ def RealMain(argv, data=None):
uploaded_diff_file = [("data", "data.diff", data)]
ctype, body = EncodeMultipartFormData(form_fields, uploaded_diff_file)
response_body = rpc_server.Send("/upload", body, content_type=ctype)
patchset = None
if not options.download_base or not uploaded_diff_file:
lines = response_body.splitlines()
if len(lines) >= 2:
Expand Down

0 comments on commit 69d913a

Please sign in to comment.