Mercurial > public > mercurial-scm > hg-stable
diff mercurial/dirstate.py @ 3607:f4c9bb4ad7b1
issue352: disallow '\n' and '\r' in filenames (dirstate and manifest)
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 01 Nov 2006 17:56:55 +0100 |
parents | ece5c53577eb |
children | 63e173a4ffbc |
line wrap: on
line diff
--- a/mercurial/dirstate.py Tue Oct 31 18:10:23 2006 -0800 +++ b/mercurial/dirstate.py Wed Nov 01 17:56:55 2006 +0100 @@ -211,7 +211,7 @@ self.dirs.setdefault(pc, 0) self.dirs[pc] += delta - def checkshadows(self, files): + def checkinterfering(self, files): def prefixes(f): for c in strutil.rfindall(f, '/'): yield f[:c] @@ -219,6 +219,7 @@ self.initdirs() seendirs = {} for f in files: + # shadows if self.dirs.get(f): raise util.Abort(_('directory named %r already in dirstate') % f) @@ -229,6 +230,9 @@ raise util.Abort(_('file named %r already in dirstate') % d) seendirs[d] = True + # disallowed + if '\r' in f or '\n' in f: + raise util.Abort(_("'\\n' and '\\r' disallowed in filenames")) def update(self, files, state, **kw): ''' current states: @@ -242,7 +246,7 @@ self.markdirty() if state == "a": self.initdirs() - self.checkshadows(files) + self.checkinterfering(files) for f in files: if state == "r": self.map[f] = ('r', 0, 0, 0)