Show More
@@ -162,6 +162,9 class largefilesdirstate(dirstate.dirsta | |||||
162 | def __getitem__(self, key): |
|
162 | def __getitem__(self, key): | |
163 | return super(largefilesdirstate, self).__getitem__(unixpath(key)) |
|
163 | return super(largefilesdirstate, self).__getitem__(unixpath(key)) | |
164 |
|
164 | |||
|
165 | def set_tracked(self, f): | |||
|
166 | return super(largefilesdirstate, self).set_tracked(unixpath(f)) | |||
|
167 | ||||
165 | def normal(self, f): |
|
168 | def normal(self, f): | |
166 | return super(largefilesdirstate, self).normal(unixpath(f)) |
|
169 | return super(largefilesdirstate, self).normal(unixpath(f)) | |
167 |
|
170 |
@@ -38,6 +38,10 def wrapdirstate(repo, dirstate): | |||||
38 | return super(narrowdirstate, self).normal(*args, **kwargs) |
|
38 | return super(narrowdirstate, self).normal(*args, **kwargs) | |
39 |
|
39 | |||
40 | @_editfunc |
|
40 | @_editfunc | |
|
41 | def set_tracked(self, *args): | |||
|
42 | return super(narrowdirstate, self).set_tracked(*args) | |||
|
43 | ||||
|
44 | @_editfunc | |||
41 | def add(self, *args): |
|
45 | def add(self, *args): | |
42 | return super(narrowdirstate, self).add(*args) |
|
46 | return super(narrowdirstate, self).add(*args) | |
43 |
|
47 |
@@ -256,6 +256,7 def _setupdirstate(ui): | |||||
256 | # Prevent adding files that are outside the sparse checkout |
|
256 | # Prevent adding files that are outside the sparse checkout | |
257 | editfuncs = [ |
|
257 | editfuncs = [ | |
258 | b'normal', |
|
258 | b'normal', | |
|
259 | b'set_tracked', | |||
259 | b'add', |
|
260 | b'add', | |
260 | b'normallookup', |
|
261 | b'normallookup', | |
261 | b'copy', |
|
262 | b'copy', |
@@ -83,6 +83,17 def requires_parents_change(func): | |||||
83 | return wrap |
|
83 | return wrap | |
84 |
|
84 | |||
85 |
|
85 | |||
|
86 | def requires_no_parents_change(func): | |||
|
87 | def wrap(self, *args, **kwargs): | |||
|
88 | if not self.pendingparentchange(): | |||
|
89 | msg = 'calling `%s` inside of a parentchange context' | |||
|
90 | msg %= func.__name__ | |||
|
91 | raise error.ProgrammingError(msg) | |||
|
92 | return func(self, *args, **kwargs) | |||
|
93 | ||||
|
94 | return wrap | |||
|
95 | ||||
|
96 | ||||
86 | @interfaceutil.implementer(intdirstate.idirstate) |
|
97 | @interfaceutil.implementer(intdirstate.idirstate) | |
87 | class dirstate(object): |
|
98 | class dirstate(object): | |
88 | def __init__( |
|
99 | def __init__( | |
@@ -451,6 +462,24 class dirstate(object): | |||||
451 | def copies(self): |
|
462 | def copies(self): | |
452 | return self._map.copymap |
|
463 | return self._map.copymap | |
453 |
|
464 | |||
|
465 | @requires_no_parents_change | |||
|
466 | def set_tracked(self, filename): | |||
|
467 | """a "public" method for generic code to mark a file as tracked | |||
|
468 | ||||
|
469 | This function is to be called outside of "update/merge" case. For | |||
|
470 | example by a command like `hg add X`. | |||
|
471 | ||||
|
472 | return True the file was previously untracked, False otherwise. | |||
|
473 | """ | |||
|
474 | entry = self._map.get(filename) | |||
|
475 | if entry is None: | |||
|
476 | self._add(filename) | |||
|
477 | return True | |||
|
478 | elif not entry.tracked: | |||
|
479 | self.normallookup(filename) | |||
|
480 | return True | |||
|
481 | return False | |||
|
482 | ||||
454 | @requires_parents_change |
|
483 | @requires_parents_change | |
455 | def update_file_reference( |
|
484 | def update_file_reference( | |
456 | self, |
|
485 | self, |
General Comments 0
You need to be logged in to leave comments.
Login now