equal
deleted
inserted
replaced
18 class dirstate(object): |
18 class dirstate(object): |
19 |
19 |
20 def __init__(self, opener, ui, root): |
20 def __init__(self, opener, ui, root): |
21 self._opener = opener |
21 self._opener = opener |
22 self._root = root |
22 self._root = root |
23 self._dirty = 0 |
23 self._dirty = False |
24 self._ui = ui |
24 self._ui = ui |
25 |
25 |
26 def __getattr__(self, name): |
26 def __getattr__(self, name): |
27 if name == '_map': |
27 if name == '_map': |
28 self._read() |
28 self._read() |
107 return self._pl |
107 return self._pl |
108 |
108 |
109 def branch(self): |
109 def branch(self): |
110 return self._branch |
110 return self._branch |
111 |
111 |
112 def markdirty(self): |
|
113 self._dirty = 1 |
|
114 |
|
115 def setparents(self, p1, p2=nullid): |
112 def setparents(self, p1, p2=nullid): |
116 self.markdirty() |
113 self._dirty = True |
117 self._pl = p1, p2 |
114 self._pl = p1, p2 |
118 |
115 |
119 def setbranch(self, branch): |
116 def setbranch(self, branch): |
120 self._branch = branch |
117 self._branch = branch |
121 self._opener("branch", "w").write(branch + '\n') |
118 self._opener("branch", "w").write(branch + '\n') |
160 |
157 |
161 def invalidate(self): |
158 def invalidate(self): |
162 for a in "_map _copymap _branch _pl _dirs _ignore".split(): |
159 for a in "_map _copymap _branch _pl _dirs _ignore".split(): |
163 if hasattr(self, a): |
160 if hasattr(self, a): |
164 self.__delattr__(a) |
161 self.__delattr__(a) |
165 self._dirty = 0 |
162 self._dirty = False |
166 |
163 |
167 def copy(self, source, dest): |
164 def copy(self, source, dest): |
168 self.markdirty() |
165 self._dirty = True |
169 self._copymap[dest] = source |
166 self._copymap[dest] = source |
170 |
167 |
171 def copied(self, file): |
168 def copied(self, file): |
172 return self._copymap.get(file, None) |
169 return self._copymap.get(file, None) |
173 |
170 |
206 m needs merging |
203 m needs merging |
207 r marked for removal |
204 r marked for removal |
208 a marked for addition''' |
205 a marked for addition''' |
209 |
206 |
210 if not files: return |
207 if not files: return |
211 self.markdirty() |
208 self._dirty = True |
212 for f in files: |
209 for f in files: |
213 if self._copymap.has_key(f): |
210 if self._copymap.has_key(f): |
214 del self._copymap[f] |
211 del self._copymap[f] |
215 |
212 |
216 if state == "r": |
213 if state == "r": |
225 st_mtime = kw.get('st_mtime', s.st_mtime) |
222 st_mtime = kw.get('st_mtime', s.st_mtime) |
226 self._map[f] = (state, s.st_mode, st_size, st_mtime) |
223 self._map[f] = (state, s.st_mode, st_size, st_mtime) |
227 |
224 |
228 def forget(self, files): |
225 def forget(self, files): |
229 if not files: return |
226 if not files: return |
230 self.markdirty() |
227 self._dirty = True |
231 for f in files: |
228 for f in files: |
232 try: |
229 try: |
233 del self._map[f] |
230 del self._map[f] |
234 self._decpath(f) |
231 self._decpath(f) |
235 except KeyError: |
232 except KeyError: |
242 if files.execf(f): |
239 if files.execf(f): |
243 self._map[f] = ('n', 0777, -1, 0) |
240 self._map[f] = ('n', 0777, -1, 0) |
244 else: |
241 else: |
245 self._map[f] = ('n', 0666, -1, 0) |
242 self._map[f] = ('n', 0666, -1, 0) |
246 self._pl = (parent, nullid) |
243 self._pl = (parent, nullid) |
247 self.markdirty() |
244 self._dirty = True |
248 |
245 |
249 def write(self): |
246 def write(self): |
250 if not self._dirty: |
247 if not self._dirty: |
251 return |
248 return |
252 cs = cStringIO.StringIO() |
249 cs = cStringIO.StringIO() |
259 cs.write(e) |
256 cs.write(e) |
260 cs.write(f) |
257 cs.write(f) |
261 st = self._opener("dirstate", "w", atomictemp=True) |
258 st = self._opener("dirstate", "w", atomictemp=True) |
262 st.write(cs.getvalue()) |
259 st.write(cs.getvalue()) |
263 st.rename() |
260 st.rename() |
264 self._dirty = 0 |
261 self._dirty = False |
265 |
262 |
266 def filterfiles(self, files): |
263 def filterfiles(self, files): |
267 ret = {} |
264 ret = {} |
268 unknown = [] |
265 unknown = [] |
269 |
266 |