Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/dirstate.py @ 5004:4b1acb3ecb3c
dirstate: localize a bunch of methods in status fastpath
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 26 Jul 2007 12:02:58 -0500 |
parents | 4d079df2871a |
children | 8b1ee1f59b3c |
comparison
equal
deleted
inserted
replaced
5003:4d079df2871a | 5004:4b1acb3ecb3c |
---|---|
469 | 469 |
470 def status(self, files, match, list_ignored, list_clean): | 470 def status(self, files, match, list_ignored, list_clean): |
471 lookup, modified, added, unknown, ignored = [], [], [], [], [] | 471 lookup, modified, added, unknown, ignored = [], [], [], [], [] |
472 removed, deleted, clean = [], [], [] | 472 removed, deleted, clean = [], [], [] |
473 | 473 |
474 _join = self._join | |
475 lstat = os.lstat | |
476 cmap = self._copymap | |
477 dmap = self._map | |
478 ladd = lookup.append | |
479 madd = modified.append | |
480 aadd = added.append | |
481 uadd = unknown.append | |
482 iadd = ignored.append | |
483 radd = removed.append | |
484 dadd = deleted.append | |
485 cadd = clean.append | |
486 | |
474 for src, fn, st in self.statwalk(files, match, ignored=list_ignored): | 487 for src, fn, st in self.statwalk(files, match, ignored=list_ignored): |
475 try: | 488 if fn in dmap: |
476 type_, mode, size, time = self._map[fn] | 489 type_, mode, size, time = dmap[fn] |
477 except KeyError: | 490 else: |
478 if list_ignored and self._ignore(fn): | 491 if list_ignored and self._ignore(fn): |
479 ignored.append(fn) | 492 iadd(fn) |
480 else: | 493 else: |
481 unknown.append(fn) | 494 uadd(fn) |
482 continue | 495 continue |
483 if src == 'm': | 496 if src == 'm': |
484 nonexistent = True | 497 nonexistent = True |
485 if not st: | 498 if not st: |
486 try: | 499 try: |
487 st = os.lstat(self._join(fn)) | 500 st = lstat(_join(fn)) |
488 except OSError, inst: | 501 except OSError, inst: |
489 if inst.errno != errno.ENOENT: | 502 if inst.errno != errno.ENOENT: |
490 raise | 503 raise |
491 st = None | 504 st = None |
492 # We need to re-check that it is a valid file | 505 # We need to re-check that it is a valid file |
493 if st and self._supported(fn, st.st_mode): | 506 if st and self._supported(fn, st.st_mode): |
494 nonexistent = False | 507 nonexistent = False |
495 # XXX: what to do with file no longer present in the fs | 508 # XXX: what to do with file no longer present in the fs |
496 # who are not removed in the dirstate ? | 509 # who are not removed in the dirstate ? |
497 if nonexistent and type_ in "nm": | 510 if nonexistent and type_ in "nm": |
498 deleted.append(fn) | 511 dadd(fn) |
499 continue | 512 continue |
500 # check the common case first | 513 # check the common case first |
501 if type_ == 'n': | 514 if type_ == 'n': |
502 if not st: | 515 if not st: |
503 st = os.lstat(self._join(fn)) | 516 st = lstat(_join(fn)) |
504 if (size >= 0 and (size != st.st_size | 517 if (size >= 0 and (size != st.st_size |
505 or (mode ^ st.st_mode) & 0100) | 518 or (mode ^ st.st_mode) & 0100) |
506 or fn in self._copymap): | 519 or fn in self._copymap): |
507 modified.append(fn) | 520 madd(fn) |
508 elif time != int(st.st_mtime): | 521 elif time != int(st.st_mtime): |
509 lookup.append(fn) | 522 ladd(fn) |
510 elif list_clean: | 523 elif list_clean: |
511 clean.append(fn) | 524 cadd(fn) |
512 elif type_ == 'm': | 525 elif type_ == 'm': |
513 modified.append(fn) | 526 madd(fn) |
514 elif type_ == 'a': | 527 elif type_ == 'a': |
515 added.append(fn) | 528 aadd(fn) |
516 elif type_ == 'r': | 529 elif type_ == 'r': |
517 removed.append(fn) | 530 radd(fn) |
518 | 531 |
519 return (lookup, modified, added, removed, deleted, unknown, ignored, | 532 return (lookup, modified, added, removed, deleted, unknown, ignored, |
520 clean) | 533 clean) |