Mercurial > hg
changeset 16357:8ca7187d479f stable
export: catch exporting empty revsets (issue3353)
Additionally add tests for empty revsets and unknown revisions.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Wed, 04 Apr 2012 12:31:31 +0200 |
parents | cb1475e7e5a2 |
children | 709924be3d04 |
files | mercurial/commands.py tests/test-export.t |
diffstat | 2 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Apr 04 11:18:42 2012 +0200 +++ b/mercurial/commands.py Wed Apr 04 12:31:31 2012 +0200 @@ -2413,9 +2413,9 @@ Returns 0 on success. """ changesets += tuple(opts.get('rev', [])) - if not changesets: + revs = scmutil.revrange(repo, changesets) + if not revs: raise util.Abort(_("export requires at least one changeset")) - revs = scmutil.revrange(repo, changesets) if len(revs) > 1: ui.note(_('exporting patches:\n')) else:
--- a/tests/test-export.t Wed Apr 04 11:18:42 2012 +0200 +++ b/tests/test-export.t Wed Apr 04 12:31:31 2012 +0200 @@ -129,3 +129,17 @@ exporting patch: ____________0123456789_______ABCDEFGHIJKLMNOPQRSTUVWXYZ______abcdefghijklmnopqrstuvwxyz____.patch +Catch exporting unknown revisions (especially empty revsets, see issue3353) + + $ hg export + abort: export requires at least one changeset + [255] + $ hg export "" + hg: parse error: empty query + [255] + $ hg export 999 + abort: unknown revision '999'! + [255] + $ hg export "not all()" + abort: export requires at least one changeset + [255]