# HG changeset patch # User Martin von Zweigbergk # Date 1588790417 25200 # Node ID 16596f5e1afa24628e1648fe8698ef040d6b60b3 # Parent 8e47b43d665f0da4583584605fc4ee38aaf35f5c copy: give better error message when no source paths found with --at-rev The new error message matches what we show when marking copies in the working copy. Differential Revision: https://phab.mercurial-scm.org/D8496 diff -r 8e47b43d665f -r 16596f5e1afa mercurial/cmdutil.py --- a/mercurial/cmdutil.py Wed May 06 11:41:37 2020 -0700 +++ b/mercurial/cmdutil.py Wed May 06 11:40:17 2020 -0700 @@ -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. diff -r 8e47b43d665f -r 16596f5e1afa tests/test-rename-rev.t --- a/tests/test-rename-rev.t Wed May 06 11:41:37 2020 -0700 +++ b/tests/test-rename-rev.t Wed May 06 11:40:17 2020 -0700 @@ -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