##// END OF EJS Templates
util: new function checkfilename...
Adrian Buehlmann -
r13944:bc32bb0e default
parent child Browse files
Show More
@@ -269,9 +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 if '\r' in f or '\n' in f:
272 util.checkfilename(f)
273 raise util.Abort(
274 _("'\\n' and '\\r' disallowed in filenames: %r") % f)
275 if f in self._dirs:
273 if f in self._dirs:
276 raise util.Abort(_('directory %r already in dirstate') % f)
274 raise util.Abort(_('directory %r already in dirstate') % f)
277 # shadows
275 # shadows
@@ -493,6 +493,11 b' def copyfiles(src, dst, hardlink=None):'
493
493
494 return hardlink, num
494 return hardlink, num
495
495
496 def checkfilename(f):
497 '''Check that the filename f is an acceptable filename for a tracked file'''
498 if '\r' in f or '\n' in f:
499 raise Abort(_("'\\n' and '\\r' disallowed in filenames: %r") % f)
500
496 _windows_reserved_filenames = '''con prn aux nul
501 _windows_reserved_filenames = '''con prn aux nul
497 com1 com2 com3 com4 com5 com6 com7 com8 com9
502 com1 com2 com3 com4 com5 com6 com7 com8 com9
498 lpt1 lpt2 lpt3 lpt4 lpt5 lpt6 lpt7 lpt8 lpt9'''.split()
503 lpt1 lpt2 lpt3 lpt4 lpt5 lpt6 lpt7 lpt8 lpt9'''.split()
General Comments 0
You need to be logged in to leave comments. Login now