Show More
@@ -32,18 +32,37 b' stringio = pycompat.bytesio' | |||
|
32 | 32 | _compress = zlib.compress |
|
33 | 33 | _decompress = zlib.decompress |
|
34 | 34 | |
|
35 | # Some code below makes tuples directly because it's more convenient. However, | |
|
36 | # code outside this module should always use dirstatetuple. | |
|
37 | def dirstatetuple(*x): | |
|
38 | """the four items are: | |
|
35 | ||
|
36 | class dirstatetuple(object): | |
|
37 | """represent a dirstate entry | |
|
38 | ||
|
39 | It contains: | |
|
40 | ||
|
39 | 41 | - state (one of 'n', 'a', 'r', 'm') |
|
40 | 42 | - mode, |
|
41 | 43 | - size, |
|
42 | 44 | - mtime, |
|
43 | 45 | """ |
|
44 | 46 | |
|
45 | # x is a tuple | |
|
46 | return x | |
|
47 | __slot__ = ('_state', '_mode', '_size', '_mtime') | |
|
48 | ||
|
49 | def __init__(self, state, mode, size, mtime): | |
|
50 | self._state = state | |
|
51 | self._mode = mode | |
|
52 | self._size = size | |
|
53 | self._mtime = mtime | |
|
54 | ||
|
55 | def __getitem__(self, idx): | |
|
56 | if idx == 0 or idx == -4: | |
|
57 | return self._state | |
|
58 | elif idx == 1 or idx == -3: | |
|
59 | return self._mode | |
|
60 | elif idx == 2 or idx == -2: | |
|
61 | return self._size | |
|
62 | elif idx == 3 or idx == -1: | |
|
63 | return self._mtime | |
|
64 | else: | |
|
65 | raise IndexError(idx) | |
|
47 | 66 | |
|
48 | 67 | |
|
49 | 68 | def gettype(q): |
General Comments 0
You need to be logged in to leave comments.
Login now