##// END OF EJS Templates
copy: if destination ends with "/", make sure it's a directory...
Alexis S. L. Carvalho -
r5329:7e6138cb default
parent child Browse files
Show More
@@ -623,9 +623,12 b' def docopy(ui, repo, pats, opts, wlock):'
623 raise util.Abort(_('no destination specified'))
623 raise util.Abort(_('no destination specified'))
624 dest = pats.pop()
624 dest = pats.pop()
625 destdirexists = os.path.isdir(dest)
625 destdirexists = os.path.isdir(dest)
626 if (len(pats) > 1 or util.patkind(pats[0], None)[0]) and not destdirexists:
626 if not destdirexists:
627 raise util.Abort(_('with multiple sources, destination must be an '
627 if len(pats) > 1 or util.patkind(pats[0], None)[0]:
628 'existing directory'))
628 raise util.Abort(_('with multiple sources, destination must be an '
629 'existing directory'))
630 if dest.endswith(os.sep) or os.altsep and dest.endswith(os.altsep):
631 raise util.Abort(_('destination %s is not a directory') % dest)
629 if opts['after']:
632 if opts['after']:
630 tfn = targetpathafterfn
633 tfn = targetpathafterfn
631 else:
634 else:
@@ -88,6 +88,11 b' hg status -C'
88 diff d1/b d2/b
88 diff d1/b d2/b
89 hg update -C
89 hg update -C
90
90
91 echo "# attempt to move one file into a non-existent directory"
92 hg rename d1/a dx/
93 hg status -C
94 hg update -C
95
91 echo "# attempt to move potentially more than one file into a non-existent"
96 echo "# attempt to move potentially more than one file into a non-existent"
92 echo "# directory"
97 echo "# directory"
93 hg rename 'glob:d1/**' dx
98 hg rename 'glob:d1/**' dx
@@ -166,6 +166,9 b' 1c1'
166 ---
166 ---
167 > d2/b
167 > d2/b
168 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
168 3 files updated, 0 files merged, 3 files removed, 0 files unresolved
169 # attempt to move one file into a non-existent directory
170 abort: destination dx/ is not a directory
171 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
169 # attempt to move potentially more than one file into a non-existent
172 # attempt to move potentially more than one file into a non-existent
170 # directory
173 # directory
171 abort: with multiple sources, destination must be an existing directory
174 abort: with multiple sources, destination must be an existing directory
General Comments 0
You need to be logged in to leave comments. Login now