D8033: copy: move argument validation a little earlier
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Wed Jan 29 18:39:18 EST 2020
martinvonz updated this revision to Diff 19696.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8033?vs=19666&id=19696
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8033/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8033
AFFECTED FILES
mercurial/cmdutil.py
CHANGE DETAILS
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1421,6 +1421,13 @@
ctx = repo[None]
pctx = ctx.p1()
+ 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()
+
uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
def walkpat(pat):
@@ -1658,12 +1665,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]):
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list