Mercurial > hg
changeset 44366:d8b49bf6cfec
copy: move argument validation a little earlier
Argument validation is usually done early and I will want it done
before some code that I'm about to add.
Differential Revision: https://phab.mercurial-scm.org/D8033
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 26 Dec 2019 14:02:50 -0800 |
parents | 7c4b98a4e536 |
children | 9dab3fa64325 |
files | mercurial/cmdutil.py |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Tue Jan 28 14:07:57 2020 -0800 +++ b/mercurial/cmdutil.py Thu Dec 26 14:02:50 2019 -0800 @@ -1477,6 +1477,13 @@ return + pats = scmutil.expandpats(pats) + if not pats: + raise error.Abort(_(b'no source or destination specified')) + if len(pats) == 1: + raise error.Abort(_(b'no destination specified')) + dest = pats.pop() + if opts.get(b'at_rev'): raise error.Abort(_("--at-rev is only supported with --forget")) @@ -1715,12 +1722,6 @@ res = lambda p: dest return res - pats = scmutil.expandpats(pats) - if not pats: - raise error.Abort(_(b'no source or destination specified')) - if len(pats) == 1: - raise error.Abort(_(b'no destination specified')) - dest = pats.pop() destdirexists = os.path.isdir(dest) and not os.path.islink(dest) if not destdirexists: if len(pats) > 1 or matchmod.patkind(pats[0]):