Show More
@@ -38,6 +38,9 b' def _decdirs(dirs, path):' | |||||
38 | class dirstate(object): |
|
38 | class dirstate(object): | |
39 |
|
39 | |||
40 | def __init__(self, opener, ui, root): |
|
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 | self._opener = opener |
|
44 | self._opener = opener | |
42 | self._root = root |
|
45 | self._root = root | |
43 | self._rootdir = os.path.join(root, '') |
|
46 | self._rootdir = os.path.join(root, '') | |
@@ -47,6 +50,8 b' class dirstate(object):' | |||||
47 |
|
50 | |||
48 | @propertycache |
|
51 | @propertycache | |
49 | def _map(self): |
|
52 | def _map(self): | |
|
53 | '''Return the dirstate contents as a map from filename to | |||
|
54 | (state, mode, size, time).''' | |||
50 | self._read() |
|
55 | self._read() | |
51 | return self._map |
|
56 | return self._map | |
52 |
|
57 | |||
@@ -169,12 +174,14 b' class dirstate(object):' | |||||
169 | return path |
|
174 | return path | |
170 |
|
175 | |||
171 | def __getitem__(self, key): |
|
176 | def __getitem__(self, key): | |
172 | ''' current states: |
|
177 | '''Return the current state of key (a filename) in the dirstate. | |
173 | n normal |
|
178 | States are: | |
174 |
|
|
179 | n normal | |
175 | r marked for removal |
|
180 | m needs merging | |
176 |
|
|
181 | r marked for removal | |
177 | ? not tracked''' |
|
182 | a marked for addition | |
|
183 | ? not tracked | |||
|
184 | ''' | |||
178 | return self._map.get(key, ("?",))[0] |
|
185 | return self._map.get(key, ("?",))[0] | |
179 |
|
186 | |||
180 | def __contains__(self, key): |
|
187 | def __contains__(self, key): | |
@@ -417,11 +424,11 b' class dirstate(object):' | |||||
417 |
|
424 | |||
418 | def walk(self, match, unknown, ignored): |
|
425 | def walk(self, match, unknown, ignored): | |
419 | ''' |
|
426 | ''' | |
420 |
|
|
427 | Walk recursively through the directory tree, finding all files | |
421 |
matched by |
|
428 | matched by match. | |
422 |
|
429 | |||
423 | results are yielded in a tuple (filename, stat), where stat |
|
430 | Return a dict mapping filename to stat-like object (either | |
424 | and st is the stat result if the file was found in the directory. |
|
431 | mercurial.osutil.stat instance or return value of os.stat()). | |
425 | ''' |
|
432 | ''' | |
426 |
|
433 | |||
427 | def fwarn(f, msg): |
|
434 | def fwarn(f, msg): | |
@@ -559,12 +566,38 b' class dirstate(object):' | |||||
559 | return results |
|
566 | return results | |
560 |
|
567 | |||
561 | def status(self, match, ignored, clean, unknown): |
|
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 | listignored, listclean, listunknown = ignored, clean, unknown |
|
595 | listignored, listclean, listunknown = ignored, clean, unknown | |
563 | lookup, modified, added, unknown, ignored = [], [], [], [], [] |
|
596 | lookup, modified, added, unknown, ignored = [], [], [], [], [] | |
564 | removed, deleted, clean = [], [], [] |
|
597 | removed, deleted, clean = [], [], [] | |
565 |
|
598 | |||
566 | dmap = self._map |
|
599 | dmap = self._map | |
567 | ladd = lookup.append |
|
600 | ladd = lookup.append # aka "unsure" | |
568 | madd = modified.append |
|
601 | madd = modified.append | |
569 | aadd = added.append |
|
602 | aadd = added.append | |
570 | uadd = unknown.append |
|
603 | uadd = unknown.append |
General Comments 0
You need to be logged in to leave comments.
Login now