50 self._dirs = {} |
50 self._dirs = {} |
51 for f in self._map: |
51 for f in self._map: |
52 self._incpath(f) |
52 self._incpath(f) |
53 return self._dirs |
53 return self._dirs |
54 elif name == '_ignore': |
54 elif name == '_ignore': |
55 files = [self.wjoin('.hgignore')] |
55 files = [self._join('.hgignore')] |
56 for name, path in self._ui.configitems("ui"): |
56 for name, path in self._ui.configitems("ui"): |
57 if name == 'ignore' or name.startswith('ignore.'): |
57 if name == 'ignore' or name.startswith('ignore.'): |
58 files.append(os.path.expanduser(path)) |
58 files.append(os.path.expanduser(path)) |
59 self._ignore = ignore.ignore(self._root, files, self._ui.warn) |
59 self._ignore = ignore.ignore(self._root, files, self._ui.warn) |
60 return self._ignore |
60 return self._ignore |
62 self._slash = self._ui.configbool('ui', 'slash') and os.sep != '/' |
62 self._slash = self._ui.configbool('ui', 'slash') and os.sep != '/' |
63 return self._slash |
63 return self._slash |
64 else: |
64 else: |
65 raise AttributeError, name |
65 raise AttributeError, name |
66 |
66 |
67 def wjoin(self, f): |
67 def _join(self, f): |
68 return os.path.join(self._root, f) |
68 return os.path.join(self._root, f) |
69 |
69 |
70 def getcwd(self): |
70 def getcwd(self): |
71 cwd = os.getcwd() |
71 cwd = os.getcwd() |
72 if cwd == self._root: return '' |
72 if cwd == self._root: return '' |
203 self._incpath(f) |
203 self._incpath(f) |
204 |
204 |
205 def normal(self, f): |
205 def normal(self, f): |
206 'mark a file normal' |
206 'mark a file normal' |
207 self._dirty = True |
207 self._dirty = True |
208 s = os.lstat(self.wjoin(f)) |
208 s = os.lstat(self._join(f)) |
209 self._map[f] = ('n', s.st_mode, s.st_size, s.st_mtime) |
209 self._map[f] = ('n', s.st_mode, s.st_size, s.st_mtime) |
210 if self._copymap.has_key(f): |
210 if self._copymap.has_key(f): |
211 del self._copymap[f] |
211 del self._copymap[f] |
212 |
212 |
213 def normaldirty(self, f): |
213 def normaldirty(self, f): |
214 'mark a file normal, but possibly dirty' |
214 'mark a file normal, but possibly dirty' |
215 self._dirty = True |
215 self._dirty = True |
216 s = os.lstat(self.wjoin(f)) |
216 s = os.lstat(self._join(f)) |
217 self._map[f] = ('n', s.st_mode, -1, -1) |
217 self._map[f] = ('n', s.st_mode, -1, -1) |
218 if f in self._copymap: |
218 if f in self._copymap: |
219 del self._copymap[f] |
219 del self._copymap[f] |
220 |
220 |
221 def add(self, f): |
221 def add(self, f): |
222 'mark a file added' |
222 'mark a file added' |
223 self._dirty = True |
223 self._dirty = True |
224 self._incpathcheck(f) |
224 self._incpathcheck(f) |
225 s = os.lstat(self.wjoin(f)) |
225 s = os.lstat(self._join(f)) |
226 self._map[f] = ('a', s.st_mode, s.st_size, s.st_mtime) |
226 self._map[f] = ('a', s.st_mode, s.st_size, s.st_mtime) |
227 if f in self._copymap: |
227 if f in self._copymap: |
228 del self._copymap[f] |
228 del self._copymap[f] |
229 |
229 |
230 def remove(self, f): |
230 def remove(self, f): |
485 deleted.append(fn) |
485 deleted.append(fn) |
486 continue |
486 continue |
487 # check the common case first |
487 # check the common case first |
488 if type_ == 'n': |
488 if type_ == 'n': |
489 if not st: |
489 if not st: |
490 st = os.lstat(self.wjoin(fn)) |
490 st = os.lstat(self._join(fn)) |
491 if (size >= 0 and (size != st.st_size |
491 if (size >= 0 and (size != st.st_size |
492 or (mode ^ st.st_mode) & 0100) |
492 or (mode ^ st.st_mode) & 0100) |
493 or fn in self._copymap): |
493 or fn in self._copymap): |
494 modified.append(fn) |
494 modified.append(fn) |
495 elif time != int(st.st_mtime): |
495 elif time != int(st.st_mtime): |