[Updated] D8496: copy: give better error message when no source paths found with --at-rev
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu May 7 18:22:07 UTC 2020
Closed by commit rHG16596f5e1afa: copy: give better error message when no source paths found with --at-rev (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8496?vs=21273&id=21314
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8496/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8496
AFFECTED FILES
mercurial/cmdutil.py
tests/test-rename-rev.t
CHANGE DETAILS
diff --git a/tests/test-rename-rev.t b/tests/test-rename-rev.t
--- a/tests/test-rename-rev.t
+++ b/tests/test-rename-rev.t
@@ -25,10 +25,9 @@
abort: --at-rev requires --after
[255]
# Errors out with non-existent source
-BROKEN: this should have a better error message
$ hg cp -A --at-rev . d1/non-existent d1/d
d1/non-existent: no such file in rev 55d1fd85ef0a
- abort: --at-rev requires a single source
+ abort: no files to copy
[255]
# Errors out with non-existent destination
$ hg cp -A --at-rev . d1/b d1/non-existent
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1552,6 +1552,8 @@
for abs, rel, exact in srcs:
copylist.append(abs)
+ if not copylist:
+ raise error.Abort(_(b'no files to copy'))
# TODO: Add support for `hg cp --at-rev . foo bar dir` and
# `hg cp --at-rev . dir1 dir2`, preferably unifying the code with the
# existing functions below.
To: martinvonz, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200507/24562a78/attachment-0002.html>
More information about the Mercurial-patches
mailing list