Show More
@@ -38,6 +38,9 b' def _decdirs(dirs, path):' | |||
|
38 | 38 | class dirstate(object): |
|
39 | 39 | |
|
40 | 40 | def __init__(self, opener, ui, root): |
|
41 | '''Create a new dirstate object. opener is an open()-like callable | |
|
42 | that can be used to open the dirstate file; root is the root of the | |
|
43 | directory tracked by the dirstate.''' | |
|
41 | 44 | self._opener = opener |
|
42 | 45 | self._root = root |
|
43 | 46 | self._rootdir = os.path.join(root, '') |
@@ -47,6 +50,8 b' class dirstate(object):' | |||
|
47 | 50 | |
|
48 | 51 | @propertycache |
|
49 | 52 | def _map(self): |
|
53 | '''Return the dirstate contents as a map from filename to | |
|
54 | (state, mode, size, time).''' | |
|
50 | 55 | self._read() |
|
51 | 56 | return self._map |
|
52 | 57 | |
@@ -169,12 +174,14 b' class dirstate(object):' | |||
|
169 | 174 | return path |
|
170 | 175 | |
|
171 | 176 | def __getitem__(self, key): |
|
172 | ''' current states: | |
|
173 | n normal | |
|
174 |
|
|
|
175 | r marked for removal | |
|
176 |
|
|
|
177 | ? not tracked''' | |
|
177 | '''Return the current state of key (a filename) in the dirstate. | |
|
178 | States are: | |
|
179 | n normal | |
|
180 | m needs merging | |
|
181 | r marked for removal | |
|
182 | a marked for addition | |
|
183 | ? not tracked | |
|
184 | ''' | |
|
178 | 185 | return self._map.get(key, ("?",))[0] |
|
179 | 186 | |
|
180 | 187 | def __contains__(self, key): |
@@ -417,11 +424,11 b' class dirstate(object):' | |||
|
417 | 424 | |
|
418 | 425 | def walk(self, match, unknown, ignored): |
|
419 | 426 | ''' |
|
420 |
|
|
|
421 |
matched by |
|
|
427 | Walk recursively through the directory tree, finding all files | |
|
428 | matched by match. | |
|
422 | 429 | |
|
423 | results are yielded in a tuple (filename, stat), where stat | |
|
424 | and st is the stat result if the file was found in the directory. | |
|
430 | Return a dict mapping filename to stat-like object (either | |
|
431 | mercurial.osutil.stat instance or return value of os.stat()). | |
|
425 | 432 | ''' |
|
426 | 433 | |
|
427 | 434 | def fwarn(f, msg): |
@@ -559,12 +566,38 b' class dirstate(object):' | |||
|
559 | 566 | return results |
|
560 | 567 | |
|
561 | 568 | def status(self, match, ignored, clean, unknown): |
|
569 | '''Determine the status of the working copy relative to the | |
|
570 | dirstate and return a tuple of lists (unsure, modified, added, | |
|
571 | removed, deleted, unknown, ignored, clean), where: | |
|
572 | ||
|
573 | unsure: | |
|
574 | files that might have been modified since the dirstate was | |
|
575 | written, but need to be read to be sure (size is the same | |
|
576 | but mtime differs) | |
|
577 | modified: | |
|
578 | files that have definitely been modified since the dirstate | |
|
579 | was written (different size or mode) | |
|
580 | added: | |
|
581 | files that have been explicitly added with hg add | |
|
582 | removed: | |
|
583 | files that have been explicitly removed with hg remove | |
|
584 | deleted: | |
|
585 | files that have been deleted through other means ("missing") | |
|
586 | unknown: | |
|
587 | files not in the dirstate that are not ignored | |
|
588 | ignored: | |
|
589 | files not in the dirstate that are ignored | |
|
590 | (by _dirignore()) | |
|
591 | clean: | |
|
592 | files that have definitely not been modified since the | |
|
593 | dirstate was written | |
|
594 | ''' | |
|
562 | 595 | listignored, listclean, listunknown = ignored, clean, unknown |
|
563 | 596 | lookup, modified, added, unknown, ignored = [], [], [], [], [] |
|
564 | 597 | removed, deleted, clean = [], [], [] |
|
565 | 598 | |
|
566 | 599 | dmap = self._map |
|
567 | ladd = lookup.append | |
|
600 | ladd = lookup.append # aka "unsure" | |
|
568 | 601 | madd = modified.append |
|
569 | 602 | aadd = added.append |
|
570 | 603 | uadd = unknown.append |
General Comments 0
You need to be logged in to leave comments.
Login now