copy: do not copy file if name is disallowed anyway
authorAdrian Buehlmann <adrian@cadifra.com>
Fri, 15 Apr 2011 16:15:32 +0200
changeset 13945 03f3ce7ca2a8
parent 13944 bc32bb0e909f
child 13946 3c2f9f611ef6
copy: do not copy file if name is disallowed anyway
mercurial/cmdutil.py
tests/test-eolfilename.t
--- 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 ..