Show More
@@ -182,26 +182,19 b' class dirstate(object):' | |||||
182 | self._dirs.setdefault(pc, 0) |
|
182 | self._dirs.setdefault(pc, 0) | |
183 | self._dirs[pc] -= 1 |
|
183 | self._dirs[pc] -= 1 | |
184 |
|
184 | |||
185 |
def check |
|
185 | def _incpathcheck(self, f): | |
186 | def prefixes(f): |
|
186 | if '\r' in f or '\n' in f: | |
187 | for c in strutil.rfindall(f, '/'): |
|
187 | raise util.Abort(_("'\\n' and '\\r' disallowed in filenames")) | |
188 | yield f[:c] |
|
188 | # shadows | |
189 | seendirs = {} |
|
189 | if f in self._dirs: | |
190 | for f in files: |
|
190 | raise util.Abort(_('directory named %r already in dirstate') % f) | |
191 | # shadows |
|
191 | for c in strutil.rfindall(f, '/'): | |
192 | if self._dirs.get(f): |
|
192 | d = f[:c] | |
193 | raise util.Abort(_('directory named %r already in dirstate') % |
|
193 | if d in self._dirs: | |
194 | f) |
|
194 | break | |
195 |
f |
|
195 | if d in self._map: | |
196 | if d in seendirs: |
|
196 | raise util.Abort(_('file named %r already in dirstate') % d) | |
197 | break |
|
197 | self._incpath(f) | |
198 | if d in self._map: |
|
|||
199 | raise util.Abort(_('file named %r already in dirstate') % |
|
|||
200 | d) |
|
|||
201 | seendirs[d] = True |
|
|||
202 | # disallowed |
|
|||
203 | if '\r' in f or '\n' in f: |
|
|||
204 | raise util.Abort(_("'\\n' and '\\r' disallowed in filenames")) |
|
|||
205 |
|
198 | |||
206 | def update(self, files, state, **kw): |
|
199 | def update(self, files, state, **kw): | |
207 | ''' current states: |
|
200 | ''' current states: | |
@@ -212,21 +205,21 b' class dirstate(object):' | |||||
212 |
|
205 | |||
213 | if not files: return |
|
206 | if not files: return | |
214 | self.markdirty() |
|
207 | self.markdirty() | |
215 | if state == "a": |
|
|||
216 | self.checkinterfering(files) |
|
|||
217 | for f in files: |
|
208 | for f in files: | |
|
209 | if self._copymap.has_key(f): | |||
|
210 | del self._copymap[f] | |||
|
211 | ||||
218 | if state == "r": |
|
212 | if state == "r": | |
219 | self._map[f] = ('r', 0, 0, 0) |
|
213 | self._map[f] = ('r', 0, 0, 0) | |
220 | self._decpath(f) |
|
214 | self._decpath(f) | |
|
215 | continue | |||
221 | else: |
|
216 | else: | |
222 | if state == "a": |
|
217 | if state == "a": | |
223 | self._incpath(f) |
|
218 | self._incpathcheck(f) | |
224 | s = os.lstat(self.wjoin(f)) |
|
219 | s = os.lstat(self.wjoin(f)) | |
225 | st_size = kw.get('st_size', s.st_size) |
|
220 | st_size = kw.get('st_size', s.st_size) | |
226 | st_mtime = kw.get('st_mtime', s.st_mtime) |
|
221 | st_mtime = kw.get('st_mtime', s.st_mtime) | |
227 | self._map[f] = (state, s.st_mode, st_size, st_mtime) |
|
222 | self._map[f] = (state, s.st_mode, st_size, st_mtime) | |
228 | if self._copymap.has_key(f): |
|
|||
229 | del self._copymap[f] |
|
|||
230 |
|
223 | |||
231 | def forget(self, files): |
|
224 | def forget(self, files): | |
232 | if not files: return |
|
225 | if not files: return |
General Comments 0
You need to be logged in to leave comments.
Login now