changeset 13945:03f3ce7ca2a8

copy: do not copy file if name is disallowed anyway
author Adrian Buehlmann <adrian@cadifra.com>
date Fri, 15 Apr 2011 16:15:32 +0200
parents bc32bb0e909f
children 3c2f9f611ef6
files mercurial/cmdutil.py tests/test-eolfilename.t
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Fri Apr 15 16:15:30 2011 +0200
+++ b/mercurial/cmdutil.py	Fri Apr 15 16:15:32 2011 +0200
@@ -435,6 +435,8 @@
         src = repo.wjoin(abssrc)
         state = repo.dirstate[abstarget]
 
+        util.checkfilename(abstarget)
+
         # check for collisions
         prevsrc = targets.get(abstarget)
         if prevsrc is not None:
--- a/tests/test-eolfilename.t	Fri Apr 15 16:15:30 2011 +0200
+++ b/tests/test-eolfilename.t	Fri Apr 15 16:15:32 2011 +0200
@@ -36,6 +36,17 @@
   o  hell
   o
 
+  $ echo bla > quickfox
+  $ hg add quickfox
+  $ hg ci -m 2
+  $ A=`printf 'quick\rfox'`
+  $ hg cp quickfox "$A"
+  abort: '\n' and '\r' disallowed in filenames: 'quick\rfox'
+  [255]
+  $ hg mv quickfox "$A"
+  abort: '\n' and '\r' disallowed in filenames: 'quick\rfox'
+  [255]
+
 http://mercurial.selenic.com/bts/issue2036
 
   $ cd ..