Show More
@@ -7,7 +7,7 b'' | |||||
7 |
|
7 | |||
8 | from node import nullid |
|
8 | from node import nullid | |
9 | from i18n import _ |
|
9 | from i18n import _ | |
10 | import util, ignore, osutil, parsers, encoding |
|
10 | import scmutil, util, ignore, osutil, parsers, encoding | |
11 | import struct, os, stat, errno |
|
11 | import struct, os, stat, errno | |
12 | import cStringIO |
|
12 | import cStringIO | |
13 |
|
13 | |||
@@ -269,7 +269,7 b' class dirstate(object):' | |||||
269 | def _addpath(self, f, check=False): |
|
269 | def _addpath(self, f, check=False): | |
270 | oldstate = self[f] |
|
270 | oldstate = self[f] | |
271 | if check or oldstate == "r": |
|
271 | if check or oldstate == "r": | |
272 | util.checkfilename(f) |
|
272 | scmutil.checkfilename(f) | |
273 | if f in self._dirs: |
|
273 | if f in self._dirs: | |
274 | raise util.Abort(_('directory %r already in dirstate') % f) |
|
274 | raise util.Abort(_('directory %r already in dirstate') % f) | |
275 | # shadows |
|
275 | # shadows |
@@ -9,9 +9,14 b' from i18n import _' | |||||
9 | import util, error |
|
9 | import util, error | |
10 | import os, errno, stat |
|
10 | import os, errno, stat | |
11 |
|
11 | |||
|
12 | def checkfilename(f): | |||
|
13 | '''Check that the filename f is an acceptable filename for a tracked file''' | |||
|
14 | if '\r' in f or '\n' in f: | |||
|
15 | raise util.Abort(_("'\\n' and '\\r' disallowed in filenames: %r") % f) | |||
|
16 | ||||
12 | def checkportable(ui, f): |
|
17 | def checkportable(ui, f): | |
13 | '''Check if filename f is portable and warn or abort depending on config''' |
|
18 | '''Check if filename f is portable and warn or abort depending on config''' | |
14 |
|
|
19 | checkfilename(f) | |
15 | val = ui.config('ui', 'portablefilenames', 'warn') |
|
20 | val = ui.config('ui', 'portablefilenames', 'warn') | |
16 | lval = val.lower() |
|
21 | lval = val.lower() | |
17 | abort = os.name == 'nt' or lval == 'abort' |
|
22 | abort = os.name == 'nt' or lval == 'abort' |
@@ -445,11 +445,6 b' def copyfiles(src, dst, hardlink=None):' | |||||
445 |
|
445 | |||
446 | return hardlink, num |
|
446 | return hardlink, num | |
447 |
|
447 | |||
448 | def checkfilename(f): |
|
|||
449 | '''Check that the filename f is an acceptable filename for a tracked file''' |
|
|||
450 | if '\r' in f or '\n' in f: |
|
|||
451 | raise Abort(_("'\\n' and '\\r' disallowed in filenames: %r") % f) |
|
|||
452 |
|
||||
453 | _windows_reserved_filenames = '''con prn aux nul |
|
448 | _windows_reserved_filenames = '''con prn aux nul | |
454 | com1 com2 com3 com4 com5 com6 com7 com8 com9 |
|
449 | com1 com2 com3 com4 com5 com6 com7 com8 com9 | |
455 | lpt1 lpt2 lpt3 lpt4 lpt5 lpt6 lpt7 lpt8 lpt9'''.split() |
|
450 | lpt1 lpt2 lpt3 lpt4 lpt5 lpt6 lpt7 lpt8 lpt9'''.split() |
General Comments 0
You need to be logged in to leave comments.
Login now