##// END OF EJS Templates
addremove: add back forgotten files (BC)...
Martin von Zweigbergk -
r23259:9f477802 default
parent child Browse files
Show More
@@ -686,9 +686,9 b' def addremove(repo, pats=[], opts={}, dr'
686 rejected = []
686 rejected = []
687 m.bad = lambda x, y: rejected.append(x)
687 m.bad = lambda x, y: rejected.append(x)
688
688
689 added, unknown, deleted, removed = _interestingfiles(repo, m)
689 added, unknown, deleted, removed, forgotten = _interestingfiles(repo, m)
690
690
691 unknownset = set(unknown)
691 unknownset = set(unknown + forgotten)
692 toprint = unknownset.copy()
692 toprint = unknownset.copy()
693 toprint.update(deleted)
693 toprint.update(deleted)
694 for abs in sorted(toprint):
694 for abs in sorted(toprint):
@@ -704,7 +704,7 b' def addremove(repo, pats=[], opts={}, dr'
704 similarity)
704 similarity)
705
705
706 if not dry_run:
706 if not dry_run:
707 _markchanges(repo, unknown, deleted, renames)
707 _markchanges(repo, unknown + forgotten, deleted, renames)
708
708
709 for f in rejected:
709 for f in rejected:
710 if f in m.files():
710 if f in m.files():
@@ -718,10 +718,10 b' def marktouched(repo, files, similarity='
718 rejected = []
718 rejected = []
719 m.bad = lambda x, y: rejected.append(x)
719 m.bad = lambda x, y: rejected.append(x)
720
720
721 added, unknown, deleted, removed = _interestingfiles(repo, m)
721 added, unknown, deleted, removed, forgotten = _interestingfiles(repo, m)
722
722
723 if repo.ui.verbose:
723 if repo.ui.verbose:
724 unknownset = set(unknown)
724 unknownset = set(unknown + forgotten)
725 toprint = unknownset.copy()
725 toprint = unknownset.copy()
726 toprint.update(deleted)
726 toprint.update(deleted)
727 for abs in sorted(toprint):
727 for abs in sorted(toprint):
@@ -734,7 +734,7 b' def marktouched(repo, files, similarity='
734 renames = _findrenames(repo, m, added + unknown, removed + deleted,
734 renames = _findrenames(repo, m, added + unknown, removed + deleted,
735 similarity)
735 similarity)
736
736
737 _markchanges(repo, unknown, deleted, renames)
737 _markchanges(repo, unknown + forgotten, deleted, renames)
738
738
739 for f in rejected:
739 for f in rejected:
740 if f in m.files():
740 if f in m.files():
@@ -747,7 +747,7 b' def _interestingfiles(repo, matcher):'
747
747
748 This is different from dirstate.status because it doesn't care about
748 This is different from dirstate.status because it doesn't care about
749 whether files are modified or clean.'''
749 whether files are modified or clean.'''
750 added, unknown, deleted, removed = [], [], [], []
750 added, unknown, deleted, removed, forgotten = [], [], [], [], []
751 audit_path = pathutil.pathauditor(repo.root)
751 audit_path = pathutil.pathauditor(repo.root)
752
752
753 ctx = repo[None]
753 ctx = repo[None]
@@ -760,13 +760,15 b' def _interestingfiles(repo, matcher):'
760 unknown.append(abs)
760 unknown.append(abs)
761 elif dstate != 'r' and not st:
761 elif dstate != 'r' and not st:
762 deleted.append(abs)
762 deleted.append(abs)
763 elif dstate == 'r' and st:
764 forgotten.append(abs)
763 # for finding renames
765 # for finding renames
764 elif dstate == 'r':
766 elif dstate == 'r' and not st:
765 removed.append(abs)
767 removed.append(abs)
766 elif dstate == 'a':
768 elif dstate == 'a':
767 added.append(abs)
769 added.append(abs)
768
770
769 return added, unknown, deleted, removed
771 return added, unknown, deleted, removed, forgotten
770
772
771 def _findrenames(repo, matcher, added, removed, similarity):
773 def _findrenames(repo, matcher, added, removed, similarity):
772 '''Find renames from removed files to added ones.'''
774 '''Find renames from removed files to added ones.'''
@@ -18,7 +18,11 b''
18 dir/bar_2
18 dir/bar_2
19 foo_2
19 foo_2
20 committed changeset 1:e65414bf35c5
20 committed changeset 1:e65414bf35c5
21 $ cd ../..
21 $ cd ..
22 $ hg forget foo
23 $ hg -v addremove
24 adding foo
25 $ cd ..
22
26
23 $ hg init sim
27 $ hg init sim
24 $ cd sim
28 $ cd sim
@@ -45,4 +49,9 b''
45 adding d
49 adding d
46 recording removal of a as rename to b (100% similar)
50 recording removal of a as rename to b (100% similar)
47 $ hg commit -mb
51 $ hg commit -mb
52 $ cp b c
53 $ hg forget b
54 $ hg addremove -s 50
55 adding b
56 adding c
48 $ cd ..
57 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now