##// END OF EJS Templates
dirstate: add a `set_untracked` method for "hg remove"-like usage...
marmoute -
r48399:cce51119 default
parent child Browse files
Show More
@@ -165,6 +165,9 b' class largefilesdirstate(dirstate.dirsta'
165 def set_tracked(self, f):
165 def set_tracked(self, f):
166 return super(largefilesdirstate, self).set_tracked(unixpath(f))
166 return super(largefilesdirstate, self).set_tracked(unixpath(f))
167
167
168 def set_untracked(self, f):
169 return super(largefilesdirstate, self).set_untracked(unixpath(f))
170
168 def normal(self, f):
171 def normal(self, f):
169 return super(largefilesdirstate, self).normal(unixpath(f))
172 return super(largefilesdirstate, self).normal(unixpath(f))
170
173
@@ -42,6 +42,10 b' def wrapdirstate(repo, dirstate):'
42 return super(narrowdirstate, self).set_tracked(*args)
42 return super(narrowdirstate, self).set_tracked(*args)
43
43
44 @_editfunc
44 @_editfunc
45 def set_untracked(self, *args):
46 return super(narrowdirstate, self).set_untracked(*args)
47
48 @_editfunc
45 def add(self, *args):
49 def add(self, *args):
46 return super(narrowdirstate, self).add(*args)
50 return super(narrowdirstate, self).add(*args)
47
51
@@ -257,6 +257,7 b' def _setupdirstate(ui):'
257 editfuncs = [
257 editfuncs = [
258 b'normal',
258 b'normal',
259 b'set_tracked',
259 b'set_tracked',
260 b'set_untracked',
260 b'add',
261 b'add',
261 b'normallookup',
262 b'normallookup',
262 b'copy',
263 b'copy',
@@ -480,6 +480,25 b' class dirstate(object):'
480 return True
480 return True
481 return False
481 return False
482
482
483 @requires_no_parents_change
484 def set_untracked(self, filename):
485 """a "public" method for generic code to mark a file as untracked
486
487 This function is to be called outside of "update/merge" case. For
488 example by a command like `hg remove X`.
489
490 return True the file was previously tracked, False otherwise.
491 """
492 entry = self._map.get(filename)
493 if entry is None:
494 return False
495 elif entry.added:
496 self._drop(filename)
497 return True
498 else:
499 self._remove(filename)
500 return True
501
483 @requires_parents_change
502 @requires_parents_change
484 def update_file_reference(
503 def update_file_reference(
485 self,
504 self,
General Comments 0
You need to be logged in to leave comments. Login now