Show More
@@ -38,9 +38,12 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. |
|
41 | '''Create a new dirstate object. | |
42 | that can be used to open the dirstate file; root is the root of the |
|
42 | ||
43 | directory tracked by the dirstate.''' |
|
43 | opener is an open()-like callable that can be used to open the | |
|
44 | dirstate file; root is the root of the directory tracked by | |||
|
45 | the dirstate. | |||
|
46 | ''' | |||
44 | self._opener = opener |
|
47 | self._opener = opener | |
45 | self._root = root |
|
48 | self._root = root | |
46 | self._rootdir = os.path.join(root, '') |
|
49 | self._rootdir = os.path.join(root, '') | |
@@ -175,6 +178,7 class dirstate(object): | |||||
175 |
|
178 | |||
176 | def __getitem__(self, key): |
|
179 | def __getitem__(self, key): | |
177 | '''Return the current state of key (a filename) in the dirstate. |
|
180 | '''Return the current state of key (a filename) in the dirstate. | |
|
181 | ||||
178 | States are: |
|
182 | States are: | |
179 | n normal |
|
183 | n normal | |
180 | m needs merging |
|
184 | m needs merging | |
@@ -227,8 +231,7 class dirstate(object): | |||||
227 | self._dirty = False |
|
231 | self._dirty = False | |
228 |
|
232 | |||
229 | def copy(self, source, dest): |
|
233 | def copy(self, source, dest): | |
230 | """Mark dest as a copy of source. Unmark dest if source is None. |
|
234 | """Mark dest as a copy of source. Unmark dest if source is None.""" | |
231 | """ |
|
|||
232 | if source == dest: |
|
235 | if source == dest: | |
233 | return |
|
236 | return | |
234 | self._dirty = True |
|
237 | self._dirty = True | |
@@ -266,7 +269,7 class dirstate(object): | |||||
266 | _incdirs(self._dirs, f) |
|
269 | _incdirs(self._dirs, f) | |
267 |
|
270 | |||
268 | def normal(self, f): |
|
271 | def normal(self, f): | |
269 |
' |
|
272 | '''Mark a file normal and clean.''' | |
270 | self._dirty = True |
|
273 | self._dirty = True | |
271 | self._addpath(f) |
|
274 | self._addpath(f) | |
272 | s = os.lstat(self._join(f)) |
|
275 | s = os.lstat(self._join(f)) | |
@@ -275,7 +278,7 class dirstate(object): | |||||
275 | del self._copymap[f] |
|
278 | del self._copymap[f] | |
276 |
|
279 | |||
277 | def normallookup(self, f): |
|
280 | def normallookup(self, f): | |
278 |
' |
|
281 | '''Mark a file normal, but possibly dirty.''' | |
279 | if self._pl[1] != nullid and f in self._map: |
|
282 | if self._pl[1] != nullid and f in self._map: | |
280 | # if there is a merge going on and the file was either |
|
283 | # if there is a merge going on and the file was either | |
281 | # in state 'm' or dirty before being removed, restore that state. |
|
284 | # in state 'm' or dirty before being removed, restore that state. | |
@@ -298,7 +301,7 class dirstate(object): | |||||
298 | del self._copymap[f] |
|
301 | del self._copymap[f] | |
299 |
|
302 | |||
300 | def normaldirty(self, f): |
|
303 | def normaldirty(self, f): | |
301 |
' |
|
304 | '''Mark a file normal, but dirty.''' | |
302 | self._dirty = True |
|
305 | self._dirty = True | |
303 | self._addpath(f) |
|
306 | self._addpath(f) | |
304 | self._map[f] = ('n', 0, -2, -1) |
|
307 | self._map[f] = ('n', 0, -2, -1) | |
@@ -306,7 +309,7 class dirstate(object): | |||||
306 | del self._copymap[f] |
|
309 | del self._copymap[f] | |
307 |
|
310 | |||
308 | def add(self, f): |
|
311 | def add(self, f): | |
309 |
' |
|
312 | '''Mark a file added.''' | |
310 | self._dirty = True |
|
313 | self._dirty = True | |
311 | self._addpath(f, True) |
|
314 | self._addpath(f, True) | |
312 | self._map[f] = ('a', 0, -1, -1) |
|
315 | self._map[f] = ('a', 0, -1, -1) | |
@@ -314,7 +317,7 class dirstate(object): | |||||
314 | del self._copymap[f] |
|
317 | del self._copymap[f] | |
315 |
|
318 | |||
316 | def remove(self, f): |
|
319 | def remove(self, f): | |
317 |
' |
|
320 | '''Mark a file removed.''' | |
318 | self._dirty = True |
|
321 | self._dirty = True | |
319 | self._droppath(f) |
|
322 | self._droppath(f) | |
320 | size = 0 |
|
323 | size = 0 | |
@@ -329,7 +332,7 class dirstate(object): | |||||
329 | del self._copymap[f] |
|
332 | del self._copymap[f] | |
330 |
|
333 | |||
331 | def merge(self, f): |
|
334 | def merge(self, f): | |
332 |
' |
|
335 | '''Mark a file merged.''' | |
333 | self._dirty = True |
|
336 | self._dirty = True | |
334 | s = os.lstat(self._join(f)) |
|
337 | s = os.lstat(self._join(f)) | |
335 | self._addpath(f) |
|
338 | self._addpath(f) | |
@@ -338,7 +341,7 class dirstate(object): | |||||
338 | del self._copymap[f] |
|
341 | del self._copymap[f] | |
339 |
|
342 | |||
340 | def forget(self, f): |
|
343 | def forget(self, f): | |
341 |
' |
|
344 | '''Forget a file.''' | |
342 | self._dirty = True |
|
345 | self._dirty = True | |
343 | try: |
|
346 | try: | |
344 | self._droppath(f) |
|
347 | self._droppath(f) |
General Comments 0
You need to be logged in to leave comments.
Login now