117 self._mtime = parentfiledata[2] |
117 self._mtime = parentfiledata[2] |
118 else: |
118 else: |
119 assert False, 'unreachable' |
119 assert False, 'unreachable' |
120 |
120 |
121 @classmethod |
121 @classmethod |
|
122 def new_added(cls): |
|
123 """constructor to help legacy API to build a new "added" item |
|
124 |
|
125 Should eventually be removed |
|
126 """ |
|
127 instance = cls() |
|
128 instance._state = b'a' |
|
129 instance._mode = 0 |
|
130 instance._size = NONNORMAL |
|
131 instance._mtime = AMBIGUOUS_TIME |
|
132 return instance |
|
133 |
|
134 @classmethod |
|
135 def new_merged(cls): |
|
136 """constructor to help legacy API to build a new "merged" item |
|
137 |
|
138 Should eventually be removed |
|
139 """ |
|
140 instance = cls() |
|
141 instance._state = b'm' |
|
142 instance._mode = 0 |
|
143 instance._size = FROM_P2 |
|
144 instance._mtime = AMBIGUOUS_TIME |
|
145 return instance |
|
146 |
|
147 @classmethod |
|
148 def new_from_p2(cls): |
|
149 """constructor to help legacy API to build a new "from_p2" item |
|
150 |
|
151 Should eventually be removed |
|
152 """ |
|
153 instance = cls() |
|
154 instance._state = b'n' |
|
155 instance._mode = 0 |
|
156 instance._size = FROM_P2 |
|
157 instance._mtime = AMBIGUOUS_TIME |
|
158 return instance |
|
159 |
|
160 @classmethod |
|
161 def new_possibly_dirty(cls): |
|
162 """constructor to help legacy API to build a new "possibly_dirty" item |
|
163 |
|
164 Should eventually be removed |
|
165 """ |
|
166 instance = cls() |
|
167 instance._state = b'n' |
|
168 instance._mode = 0 |
|
169 instance._size = NONNORMAL |
|
170 instance._mtime = AMBIGUOUS_TIME |
|
171 return instance |
|
172 |
|
173 @classmethod |
|
174 def new_normal(cls, mode, size, mtime): |
|
175 """constructor to help legacy API to build a new "normal" item |
|
176 |
|
177 Should eventually be removed |
|
178 """ |
|
179 assert size != FROM_P2 |
|
180 assert size != NONNORMAL |
|
181 instance = cls() |
|
182 instance._state = b'n' |
|
183 instance._mode = mode |
|
184 instance._size = size |
|
185 instance._mtime = mtime |
|
186 return instance |
|
187 |
|
188 @classmethod |
122 def from_v1_data(cls, state, mode, size, mtime): |
189 def from_v1_data(cls, state, mode, size, mtime): |
123 """Build a new DirstateItem object from V1 data |
190 """Build a new DirstateItem object from V1 data |
124 |
191 |
125 Since the dirstate-v1 format is frozen, the signature of this function |
192 Since the dirstate-v1 format is frozen, the signature of this function |
126 is not expected to change, unlike the __init__ one. |
193 is not expected to change, unlike the __init__ one. |