diff options
author | Gustavo Niemeyer <gustavo@niemeyer.net> | 2011-02-23 11:48:40 -0500 |
---|---|---|
committer | Gustavo Niemeyer <gustavo@niemeyer.net> | 2011-02-23 11:48:40 -0500 |
commit | 4fbdf5c27dfd0b2644222e8916cad5a0df3f6040 (patch) | |
tree | f60600db7d447cb6b30d0616034fe3ac2ab41175 /lib/codereview | |
parent | 459cd5ba22067c4d644afa93daeea824b39ad6d1 (diff) | |
download | go-4fbdf5c27dfd0b2644222e8916cad5a0df3f6040.tar.gz |
codereview: fix clpatch with empty diffs
Avoid passing the placeholder diff to hgpatch, so that
clpatch-ing an empty diff grabs the metadata and warns
about it being empty, rather than failing with a
hard-to-debug problem ("mkdir: no such file or dir",
no metadata, etc).
R=rsc
CC=golang-dev
http://codereview.appspot.com/4172060
Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'lib/codereview')
-rw-r--r-- | lib/codereview/codereview.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/codereview/codereview.py b/lib/codereview/codereview.py index 96efc855b..fa703c711 100644 --- a/lib/codereview/codereview.py +++ b/lib/codereview/codereview.py @@ -1136,11 +1136,14 @@ def clpatch(ui, repo, clname, **opts): return missing_codereview cl, patch, err = DownloadCL(ui, repo, clname) + if err != "": + return err + if patch == emptydiff: + return "codereview issue %s has no diff" % clname + argv = ["hgpatch"] if opts["no_incoming"]: argv += ["--checksync=false"] - if err != "": - return err try: cmd = subprocess.Popen(argv, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=None, close_fds=sys.platform != "win32") except: @@ -1151,6 +1154,8 @@ def clpatch(ui, repo, clname, **opts): return "hgpatch failed" cl.local = True cl.files = out.strip().split() + if not cl.files: + return "codereview issue %s has no diff" % clname files = ChangedFiles(ui, repo, [], opts) extra = Sub(cl.files, files) if extra: |