Mercurial > hg
comparison hgext/inotify/server.py @ 6287:c86207d41512
Spacing cleanup
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Sun, 16 Mar 2008 23:24:53 +0100 |
parents | 39cfcef4f463 |
children | f67d1468ac50 bf727bab38b9 |
comparison
equal
deleted
inserted
replaced
6286:90a4329a6b4a | 6287:c86207d41512 |
---|---|
314 nuke.append(wfn) | 314 nuke.append(wfn) |
315 for wfn in nuke: | 315 for wfn in nuke: |
316 root, fn = self.split(wfn) | 316 root, fn = self.split(wfn) |
317 del self.dir(self.statustrees[key], root)[fn] | 317 del self.dir(self.statustrees[key], root)[fn] |
318 del self.dir(self.tree, root)[fn] | 318 del self.dir(self.tree, root)[fn] |
319 | 319 |
320 def scan(self, topdir=''): | 320 def scan(self, topdir=''): |
321 self.handle_timeout() | 321 self.handle_timeout() |
322 ds = self.repo.dirstate._map.copy() | 322 ds = self.repo.dirstate._map.copy() |
323 self.add_watch(join(self.repo.root, topdir), self.mask) | 323 self.add_watch(join(self.repo.root, topdir), self.mask) |
324 for root, dirs, entries in walk(self.repo, topdir): | 324 for root, dirs, entries in walk(self.repo, topdir): |
357 self.scan() | 357 self.scan() |
358 self.ui.note(_('%s end dirstate reload\n') % self.event_time()) | 358 self.ui.note(_('%s end dirstate reload\n') % self.event_time()) |
359 | 359 |
360 def walk(self, states, tree, prefix=''): | 360 def walk(self, states, tree, prefix=''): |
361 # This is the "inner loop" when talking to the client. | 361 # This is the "inner loop" when talking to the client. |
362 | 362 |
363 for name, val in tree.iteritems(): | 363 for name, val in tree.iteritems(): |
364 path = join(prefix, name) | 364 path = join(prefix, name) |
365 try: | 365 try: |
366 if val in states: | 366 if val in states: |
367 yield path, val | 367 yield path, val |
382 | 382 |
383 if self.repo.dirstate.ignorefunc is not None: | 383 if self.repo.dirstate.ignorefunc is not None: |
384 self.repo.dirstate.ignorefunc = None | 384 self.repo.dirstate.ignorefunc = None |
385 self.ui.note('rescanning due to .hgignore change\n') | 385 self.ui.note('rescanning due to .hgignore change\n') |
386 self.scan() | 386 self.scan() |
387 | 387 |
388 def getstat(self, wpath): | 388 def getstat(self, wpath): |
389 try: | 389 try: |
390 return self.statcache[wpath] | 390 return self.statcache[wpath] |
391 except KeyError: | 391 except KeyError: |
392 try: | 392 try: |
393 return self.stat(wpath) | 393 return self.stat(wpath) |
394 except OSError, err: | 394 except OSError, err: |
395 if err.errno != errno.ENOENT: | 395 if err.errno != errno.ENOENT: |
396 raise | 396 raise |
397 | 397 |
398 def stat(self, wpath): | 398 def stat(self, wpath): |
399 try: | 399 try: |
400 st = os.lstat(join(self.wprefix, wpath)) | 400 st = os.lstat(join(self.wprefix, wpath)) |
401 ret = st.st_mode, st.st_size, st.st_mtime | 401 ret = st.st_mode, st.st_size, st.st_mtime |
402 self.statcache[wpath] = ret | 402 self.statcache[wpath] = ret |
403 return ret | 403 return ret |
404 except OSError, err: | 404 except OSError, err: |
405 self.statcache.pop(wpath, None) | 405 self.statcache.pop(wpath, None) |
406 raise | 406 raise |
407 | 407 |
408 def created(self, wpath): | 408 def created(self, wpath): |
409 if wpath == '.hgignore': | 409 if wpath == '.hgignore': |
410 self.update_hgignore() | 410 self.update_hgignore() |
411 try: | 411 try: |
412 st = self.stat(wpath) | 412 st = self.stat(wpath) |
433 if wpath == '.hg/wlock': | 433 if wpath == '.hg/wlock': |
434 self.check_dirstate() | 434 self.check_dirstate() |
435 return | 435 return |
436 | 436 |
437 self.updatestatus(wpath, None) | 437 self.updatestatus(wpath, None) |
438 | 438 |
439 def schedule_work(self, wpath, evt): | 439 def schedule_work(self, wpath, evt): |
440 self.eventq.setdefault(wpath, []) | 440 self.eventq.setdefault(wpath, []) |
441 prev = self.eventq[wpath] | 441 prev = self.eventq[wpath] |
442 try: | 442 try: |
443 if prev and evt == 'm' and prev[-1] in 'cm': | 443 if prev and evt == 'm' and prev[-1] in 'cm': |
452 self.created(wpath) | 452 self.created(wpath) |
453 elif evt == 'm': | 453 elif evt == 'm': |
454 self.modified(wpath) | 454 self.modified(wpath) |
455 elif evt == 'd': | 455 elif evt == 'd': |
456 self.deleted(wpath) | 456 self.deleted(wpath) |
457 | 457 |
458 def process_create(self, wpath, evt): | 458 def process_create(self, wpath, evt): |
459 if self.ui.debugflag: | 459 if self.ui.debugflag: |
460 self.ui.note(_('%s event: created %s\n') % | 460 self.ui.note(_('%s event: created %s\n') % |
461 (self.event_time(), wpath)) | 461 (self.event_time(), wpath)) |
462 | 462 |
581 self.ui.warn(_('received query from incompatible client ' | 581 self.ui.warn(_('received query from incompatible client ' |
582 'version %d\n') % version) | 582 'version %d\n') % version) |
583 return | 583 return |
584 | 584 |
585 names = cs.read().split('\0') | 585 names = cs.read().split('\0') |
586 | 586 |
587 states = names.pop() | 587 states = names.pop() |
588 | 588 |
589 self.ui.note(_('answering query for %r\n') % states) | 589 self.ui.note(_('answering query for %r\n') % states) |
590 | 590 |
591 if self.watcher.timeout: | 591 if self.watcher.timeout: |