##// END OF EJS Templates
scmutil: add a function to mark that files have been operated on...
Siddharth Agarwal -
r19154:0c7cf411 default
parent child Browse files
Show More
@@ -714,6 +714,36 b' def addremove(repo, pats=[], opts={}, dr'
714 return 1
714 return 1
715 return 0
715 return 0
716
716
717 def marktouched(repo, files, similarity=0.0):
718 '''Assert that files have somehow been operated upon. files are relative to
719 the repo root.'''
720 m = matchfiles(repo, files)
721 rejected = []
722 m.bad = lambda x, y: rejected.append(x)
723
724 added, unknown, deleted, removed = _interestingfiles(repo, m)
725
726 if repo.ui.verbose:
727 unknownset = set(unknown)
728 toprint = unknownset.copy()
729 toprint.update(deleted)
730 for abs in sorted(toprint):
731 if abs in unknownset:
732 status = _('adding %s\n') % abs
733 else:
734 status = _('removing %s\n') % abs
735 repo.ui.status(status)
736
737 renames = _findrenames(repo, m, added + unknown, removed + deleted,
738 similarity)
739
740 _markchanges(repo, unknown, deleted, renames)
741
742 for f in rejected:
743 if f in m.files():
744 return 1
745 return 0
746
717 def _interestingfiles(repo, matcher):
747 def _interestingfiles(repo, matcher):
718 '''Walk dirstate with matcher, looking for files that addremove would care
748 '''Walk dirstate with matcher, looking for files that addremove would care
719 about.
749 about.
General Comments 0
You need to be logged in to leave comments. Login now