Commit eca37e1e authored by Shenghou Ma's avatar Shenghou Ma

codereview: more mercurial interface fixes

        Fixes #4131.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6614061
parent 9844e4cd
...@@ -1794,7 +1794,7 @@ def mail(ui, repo, *pats, **opts): ...@@ -1794,7 +1794,7 @@ def mail(ui, repo, *pats, **opts):
cl, err = CommandLineCL(ui, repo, pats, opts, defaultcc=defaultcc) cl, err = CommandLineCL(ui, repo, pats, opts, defaultcc=defaultcc)
if err != "": if err != "":
return err raise hg_util.Abort(err)
cl.Upload(ui, repo, gofmt_just_warn=True) cl.Upload(ui, repo, gofmt_just_warn=True)
if not cl.reviewer: if not cl.reviewer:
# If no reviewer is listed, assign the review to defaultcc. # If no reviewer is listed, assign the review to defaultcc.
...@@ -1802,13 +1802,13 @@ def mail(ui, repo, *pats, **opts): ...@@ -1802,13 +1802,13 @@ def mail(ui, repo, *pats, **opts):
# codereview.appspot.com/user/defaultcc # codereview.appspot.com/user/defaultcc
# page, so that it doesn't get dropped on the floor. # page, so that it doesn't get dropped on the floor.
if not defaultcc: if not defaultcc:
return "no reviewers listed in CL" raise hg_util.Abort("no reviewers listed in CL")
cl.cc = Sub(cl.cc, defaultcc) cl.cc = Sub(cl.cc, defaultcc)
cl.reviewer = defaultcc cl.reviewer = defaultcc
cl.Flush(ui, repo) cl.Flush(ui, repo)
if cl.files == []: if cl.files == []:
return "no changed files, not sending mail" raise hg_util.Abort("no changed files, not sending mail")
cl.Mail(ui, repo) cl.Mail(ui, repo)
...@@ -1851,7 +1851,7 @@ def pending(ui, repo, *pats, **opts): ...@@ -1851,7 +1851,7 @@ def pending(ui, repo, *pats, **opts):
ui.write(cl.PendingText(quick=quick) + "\n") ui.write(cl.PendingText(quick=quick) + "\n")
if short: if short:
return return 0
files = DefaultFiles(ui, repo, []) files = DefaultFiles(ui, repo, [])
if len(files) > 0: if len(files) > 0:
s = "Changed files not in any CL:\n" s = "Changed files not in any CL:\n"
...@@ -1883,7 +1883,7 @@ def submit(ui, repo, *pats, **opts): ...@@ -1883,7 +1883,7 @@ def submit(ui, repo, *pats, **opts):
cl, err = CommandLineCL(ui, repo, pats, opts, defaultcc=defaultcc) cl, err = CommandLineCL(ui, repo, pats, opts, defaultcc=defaultcc)
if err != "": if err != "":
return err raise hg_util.Abort(err)
user = None user = None
if cl.copied_from: if cl.copied_from:
...@@ -1902,10 +1902,10 @@ def submit(ui, repo, *pats, **opts): ...@@ -1902,10 +1902,10 @@ def submit(ui, repo, *pats, **opts):
about += "CC=" + JoinComma([CutDomain(s) for s in cl.cc]) + "\n" about += "CC=" + JoinComma([CutDomain(s) for s in cl.cc]) + "\n"
if not cl.reviewer: if not cl.reviewer:
return "no reviewers listed in CL" raise hg_util.Abort("no reviewers listed in CL")
if not cl.local: if not cl.local:
return "cannot submit non-local CL" raise hg_util.Abort("cannot submit non-local CL")
# upload, to sync current patch and also get change number if CL is new. # upload, to sync current patch and also get change number if CL is new.
if not cl.copied_from: if not cl.copied_from:
...@@ -1940,7 +1940,7 @@ def submit(ui, repo, *pats, **opts): ...@@ -1940,7 +1940,7 @@ def submit(ui, repo, *pats, **opts):
ret = hg_commit(ui, repo, *['path:'+f for f in cl.files], message=message, user=userline) ret = hg_commit(ui, repo, *['path:'+f for f in cl.files], message=message, user=userline)
commit_okay = False commit_okay = False
if ret: if ret:
return "nothing changed" raise hg_util.Abort("nothing changed")
node = repo["-1"].node() node = repo["-1"].node()
# push to remote; if it fails for any reason, roll back # push to remote; if it fails for any reason, roll back
try: try:
...@@ -1993,7 +1993,7 @@ def submit(ui, repo, *pats, **opts): ...@@ -1993,7 +1993,7 @@ def submit(ui, repo, *pats, **opts):
err = hg_clean(repo, "default") err = hg_clean(repo, "default")
if err: if err:
return err return err
return None return 0
####################################################################### #######################################################################
# hg sync # hg sync
...@@ -2047,7 +2047,7 @@ def sync_changes(ui, repo): ...@@ -2047,7 +2047,7 @@ def sync_changes(ui, repo):
ui.warn("CL %s has no files; delete (abandon) with hg change -d %s\n" % (cl.name, cl.name)) ui.warn("CL %s has no files; delete (abandon) with hg change -d %s\n" % (cl.name, cl.name))
else: else:
ui.warn("CL %s has no files; delete locally with hg change -D %s\n" % (cl.name, cl.name)) ui.warn("CL %s has no files; delete locally with hg change -D %s\n" % (cl.name, cl.name))
return return 0
####################################################################### #######################################################################
# hg upload # hg upload
...@@ -2064,12 +2064,12 @@ def upload(ui, repo, name, **opts): ...@@ -2064,12 +2064,12 @@ def upload(ui, repo, name, **opts):
repo.ui.quiet = True repo.ui.quiet = True
cl, err = LoadCL(ui, repo, name, web=True) cl, err = LoadCL(ui, repo, name, web=True)
if err != "": if err != "":
return err raise hg_util.Abort(err)
if not cl.local: if not cl.local:
return "cannot upload non-local change" raise hg_util.Abort("cannot upload non-local change")
cl.Upload(ui, repo) cl.Upload(ui, repo)
print "%s%s\n" % (server_url_base, cl.name) print "%s%s\n" % (server_url_base, cl.name)
return return 0
####################################################################### #######################################################################
# Table of commands, supplied to Mercurial for installation. # Table of commands, supplied to Mercurial for installation.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment