Show More
@@ -253,9 +253,16 class RepoWatcher(object): | |||||
253 | return 'i' |
|
253 | return 'i' | |
254 | return type_ |
|
254 | return type_ | |
255 |
|
255 | |||
256 | def updatestatus(self, wfn, st=None, status=None): |
|
256 | def updatestatus(self, wfn, osstat=None, newstatus=None): | |
257 |
|
|
257 | ''' | |
258 | status = self.filestatus(wfn, st) |
|
258 | Update the stored status of a file or directory. | |
|
259 | ||||
|
260 | osstat: (mode, size, time) tuple, as returned by os.lstat(wfn) | |||
|
261 | ||||
|
262 | newstatus: char in statuskeys, new status to apply. | |||
|
263 | ''' | |||
|
264 | if osstat: | |||
|
265 | newstatus = self.filestatus(wfn, osstat) | |||
259 | else: |
|
266 | else: | |
260 | self.statcache.pop(wfn, None) |
|
267 | self.statcache.pop(wfn, None) | |
261 | root, fn = self.split(wfn) |
|
268 | root, fn = self.split(wfn) | |
@@ -264,35 +271,35 class RepoWatcher(object): | |||||
264 | isdir = False |
|
271 | isdir = False | |
265 | if oldstatus: |
|
272 | if oldstatus: | |
266 | try: |
|
273 | try: | |
267 | if not status: |
|
274 | if not newstatus: | |
268 | if oldstatus in 'almn': |
|
275 | if oldstatus in 'almn': | |
269 | status = '!' |
|
276 | newstatus = '!' | |
270 | elif oldstatus == 'r': |
|
277 | elif oldstatus == 'r': | |
271 | status = 'r' |
|
278 | newstatus = 'r' | |
272 | except TypeError: |
|
279 | except TypeError: | |
273 | # oldstatus may be a dict left behind by a deleted |
|
280 | # oldstatus may be a dict left behind by a deleted | |
274 | # directory |
|
281 | # directory | |
275 | isdir = True |
|
282 | isdir = True | |
276 | else: |
|
283 | else: | |
277 | if oldstatus in self.statuskeys and oldstatus != status: |
|
284 | if oldstatus in self.statuskeys and oldstatus != newstatus: | |
278 | del self.dir(self.statustrees[oldstatus], root)[fn] |
|
285 | del self.dir(self.statustrees[oldstatus], root)[fn] | |
279 | if self.ui.debugflag and oldstatus != status: |
|
286 | if self.ui.debugflag and oldstatus != newstatus: | |
280 | if isdir: |
|
287 | if isdir: | |
281 | self.ui.note(_('status: %r dir(%d) -> %s\n') % |
|
288 | self.ui.note(_('status: %r dir(%d) -> %s\n') % | |
282 | (wfn, len(oldstatus), status)) |
|
289 | (wfn, len(oldstatus), newstatus)) | |
283 | else: |
|
290 | else: | |
284 | self.ui.note(_('status: %r %s -> %s\n') % |
|
291 | self.ui.note(_('status: %r %s -> %s\n') % | |
285 | (wfn, oldstatus, status)) |
|
292 | (wfn, oldstatus, newstatus)) | |
286 | if not isdir: |
|
293 | if not isdir: | |
287 | if status and status != 'i': |
|
294 | if newstatus and newstatus != 'i': | |
288 | d[fn] = status |
|
295 | d[fn] = newstatus | |
289 | if status in self.statuskeys: |
|
296 | if newstatus in self.statuskeys: | |
290 | dd = self.dir(self.statustrees[status], root) |
|
297 | dd = self.dir(self.statustrees[newstatus], root) | |
291 | if oldstatus != status or fn not in dd: |
|
298 | if oldstatus != newstatus or fn not in dd: | |
292 | dd[fn] = status |
|
299 | dd[fn] = newstatus | |
293 | else: |
|
300 | else: | |
294 | d.pop(fn, None) |
|
301 | d.pop(fn, None) | |
295 | elif not status: |
|
302 | elif not newstatus: | |
296 | # a directory is being removed, check its contents |
|
303 | # a directory is being removed, check its contents | |
297 | for subfile, b in oldstatus.copy().iteritems(): |
|
304 | for subfile, b in oldstatus.copy().iteritems(): | |
298 | self.updatestatus(wfn + '/' + subfile, None) |
|
305 | self.updatestatus(wfn + '/' + subfile, None) | |
@@ -333,7 +340,7 class RepoWatcher(object): | |||||
333 | st = self.stat(wfn) |
|
340 | st = self.stat(wfn) | |
334 | except OSError: |
|
341 | except OSError: | |
335 | status = state[0] |
|
342 | status = state[0] | |
336 | self.updatestatus(wfn, None, status=status) |
|
343 | self.updatestatus(wfn, None, newstatus=status) | |
337 | else: |
|
344 | else: | |
338 | self.updatestatus(wfn, st) |
|
345 | self.updatestatus(wfn, st) | |
339 | self.check_deleted('!') |
|
346 | self.check_deleted('!') |
General Comments 0
You need to be logged in to leave comments.
Login now