##// END OF EJS Templates
commit: try hard to reuse p1 manifest if nothing changed...
Yuya Nishihara -
r39147:46da52f4 default
parent child Browse files
Show More
@@ -2039,6 +2039,11 b' class localrepository(object):'
2039 2039 def commitctx(self, ctx, error=False):
2040 2040 """Add a new revision to current repository.
2041 2041 Revision information is passed via the context argument.
2042
2043 ctx.files() should list all files involved in this commit, i.e.
2044 modified/added/removed files. On merge, it may be wider than the
2045 ctx.files() to be committed, since any file nodes derived directly
2046 from p1 or p2 are excluded from the committed ctx.files().
2042 2047 """
2043 2048
2044 2049 tr = None
@@ -2091,15 +2096,29 b' class localrepository(object):'
2091 2096 raise
2092 2097
2093 2098 # update manifest
2094 self.ui.note(_("committing manifest\n"))
2095 2099 removed = [f for f in sorted(removed) if f in m1 or f in m2]
2096 2100 drop = [f for f in removed if f in m]
2097 2101 for f in drop:
2098 2102 del m[f]
2099 mn = mctx.write(trp, linkrev,
2100 p1.manifestnode(), p2.manifestnode(),
2101 added, drop)
2102 2103 files = changed + removed
2104 md = None
2105 if not files:
2106 # if no "files" actually changed in terms of the changelog,
2107 # try hard to detect unmodified manifest entry so that the
2108 # exact same commit can be reproduced later on convert.
2109 md = m1.diff(m, scmutil.matchfiles(self, ctx.files()))
2110 if not files and md:
2111 self.ui.debug('not reusing manifest (no file change in '
2112 'changelog, but manifest differs)\n')
2113 if files or md:
2114 self.ui.note(_("committing manifest\n"))
2115 mn = mctx.write(trp, linkrev,
2116 p1.manifestnode(), p2.manifestnode(),
2117 added, drop)
2118 else:
2119 self.ui.debug('reusing manifest form p1 (listed files '
2120 'actually unchanged)\n')
2121 mn = p1.manifestnode()
2103 2122 else:
2104 2123 self.ui.debug('reusing manifest from p1 (no file change)\n')
2105 2124 mn = p1.manifestnode()
@@ -83,20 +83,17 b' test multiple merges at once'
83 83 $ hg -R hg2hg out source-hg -T compact
84 84 comparing with source-hg
85 85 searching for changes
86 5[tip]:4,3 6bd55e826939 2009-10-10 08:00 +0100 foo
87 (octopus merge fixup)
88
89 XXX: The manifest lines should probably agree, to avoid changing the hash when
90 converting hg -> hg
86 no changes found
87 [1]
91 88
92 89 $ hg -R source-hg log --debug -r tip
93 changeset: 5:b209510f11b2c987f920749cd8e352aa4b3230f2
90 changeset: 5:6bd55e8269392769783345686faf7ff7b3b0215d
94 91 branch: source
95 92 tag: tip
96 93 phase: draft
97 94 parent: 4:1dc38c377bb35eeea4fa955056fbe4440d54a743
98 95 parent: 3:4aaba1bfb426b8941bbf63f9dd52301152695164
99 manifest: 5:1109e42bdcbd1f51baa69bc91079011d77057dbb
96 manifest: 4:daa315d56a98ba20811fdd0d9d575861f65cfa8c
100 97 user: Foo Bar <foo.bar@example.com>
101 98 date: Sat Oct 10 08:00:04 2009 +0100
102 99 extra: branch=source
@@ -780,7 +780,7 b' example because filemap changed.'
780 780 converting...
781 781 0 3
782 782 $ hg -R .-hg log -G -T '{shortest(node)} {desc}\n{files % "- {file}\n"}\n'
783 o e9ed 3
783 o bbfe 3
784 784 |\
785 785 | o 33a0 2
786 786 | | - f
@@ -85,8 +85,8 b' Convert again'
85 85 $ hg branches
86 86 newbranch 11:a6d7cc050ad1
87 87 default 10:6e2b33404495
88 old 9:93c4b0f99529
89 old2 8:b52884d7bead (inactive)
88 old 9:1b494af68c0b
89 old2 8:5be40b8dcbf6 (inactive)
90 90 $ hg tags -q
91 91 tip
92 92 $ cd ..
@@ -851,9 +851,9 b' no ancestors that are replaced.'
851 851
852 852 $ hg fix -r 0:2
853 853 $ hg log --graph --template '{node|shortest} {files}'
854 o 3801 bar.whole
854 o b4e2 bar.whole
855 855 |
856 o 38cc
856 o 59f4
857 857 |
858 858 | @ bc05 bar.whole
859 859 | |
@@ -699,8 +699,23 b' Transplants of grafts can find a destina'
699 699 summary: 2
700 700
701 701 ... grafts of grafts unfortunately can't
702 $ hg graft -q 13
702 $ hg graft -q 13 --debug
703 scanning for duplicate grafts
704 grafting 13:7a4785234d87 "2"
705 searching for copies back to rev 12
706 unmatched files in other (from topological common ancestor):
707 g
708 unmatched files new in both:
709 b
710 resolving manifests
711 branchmerge: True, force: True, partial: False
712 ancestor: b592ea63bb0c, local: 7e61b508e709+, remote: 7a4785234d87
713 committing files:
714 b
703 715 warning: can't find ancestor for 'b' copied from 'a'!
716 reusing manifest form p1 (listed files actually unchanged)
717 committing changelog
718 updating the branch cache
704 719 $ hg log -r 'destination(13)'
705 720 All copies of a cset
706 721 $ hg log -r 'origin(13) or destination(origin(13))'
@@ -731,7 +746,7 b' All copies of a cset'
731 746 date: Thu Jan 01 00:00:00 1970 +0000
732 747 summary: 2
733 748
734 changeset: 22:d1cb6591fa4b
749 changeset: 22:3a4e92d81b97
735 750 branch: dev
736 751 tag: tip
737 752 user: foo
@@ -743,8 +758,8 b' graft works on complex revset'
743 758
744 759 $ hg graft 'origin(13) or destination(origin(13))'
745 760 skipping ancestor revision 21:7e61b508e709
746 skipping ancestor revision 22:d1cb6591fa4b
747 skipping revision 2:5c095ad7e90f (already grafted to 22:d1cb6591fa4b)
761 skipping ancestor revision 22:3a4e92d81b97
762 skipping revision 2:5c095ad7e90f (already grafted to 22:3a4e92d81b97)
748 763 grafting 7:ef0ef43d49e7 "2"
749 764 warning: can't find ancestor for 'b' copied from 'a'!
750 765 grafting 13:7a4785234d87 "2"
@@ -758,7 +773,7 b" graft with --force (still doesn't graft "
758 773 $ hg graft 19 0 6
759 774 skipping ungraftable merge revision 6
760 775 skipping ancestor revision 0:68795b066622
761 skipping already grafted revision 19:9627f653b421 (22:d1cb6591fa4b also has origin 2:5c095ad7e90f)
776 skipping already grafted revision 19:9627f653b421 (22:3a4e92d81b97 also has origin 2:5c095ad7e90f)
762 777 [255]
763 778 $ hg graft 19 0 6 --force
764 779 skipping ungraftable merge revision 6
@@ -773,12 +788,12 b' graft --force after backout'
773 788 $ hg ci -m 28
774 789 $ hg backout 28
775 790 reverting a
776 changeset 29:53177ba928f6 backs out changeset 28:50a516bb8b57
791 changeset 29:9d95e865b00c backs out changeset 28:cc20d29aec8d
777 792 $ hg graft 28
778 skipping ancestor revision 28:50a516bb8b57
793 skipping ancestor revision 28:cc20d29aec8d
779 794 [255]
780 795 $ hg graft 28 --force
781 grafting 28:50a516bb8b57 "28"
796 grafting 28:cc20d29aec8d "28"
782 797 merging a
783 798 $ cat a
784 799 abc
@@ -788,7 +803,7 b' graft --continue after --force'
788 803 $ echo def > a
789 804 $ hg ci -m 31
790 805 $ hg graft 28 --force --tool internal:fail
791 grafting 28:50a516bb8b57 "28"
806 grafting 28:cc20d29aec8d "28"
792 807 abort: unresolved conflicts, can't continue
793 808 (use 'hg resolve' and 'hg graft --continue')
794 809 [255]
@@ -801,7 +816,7 b' graft --continue after --force'
801 816 (no more unresolved files)
802 817 continue: hg graft --continue
803 818 $ hg graft -c
804 grafting 28:50a516bb8b57 "28"
819 grafting 28:cc20d29aec8d "28"
805 820 $ cat a
806 821 abc
807 822
@@ -822,8 +837,8 b' Empty graft'
822 837 $ hg tag -f something
823 838 $ hg graft -qr 27
824 839 $ hg graft -f 27
825 grafting 27:ed6c7e54e319 "28"
826 note: graft of 27:ed6c7e54e319 created no changes to commit
840 grafting 27:17d42b8f5d50 "28"
841 note: graft of 27:17d42b8f5d50 created no changes to commit
827 842
828 843 $ cd ..
829 844
@@ -30,6 +30,7 b' Files added at both parents:'
30 30 $ hg ci --debug -m merge
31 31 committing files:
32 32 b
33 not reusing manifest (no file change in changelog, but manifest differs)
33 34 committing manifest
34 35 committing changelog
35 36 updating the branch cache
@@ -136,12 +137,12 b' An identical file added at both parents,'
136 137 $ hg ci --debug -m merge
137 138 committing files:
138 139 b
139 committing manifest
140 reusing manifest form p1 (listed files actually unchanged)
140 141 committing changelog
141 142 updating the branch cache
142 committed changeset 3:4bfaad7f925b7f17f60524dc5d4e605f7bfbba3f
143 committed changeset 3:c8d50407916ef8a5a97cb6e36ca9bc844a6ee13e
143 144 $ hg log -GTl
144 @ 3:4bfaad7f925b p=2,1 m=3:a3a9fe23a5b8 f=[]
145 @ 3:c8d50407916e p=2,1 m=2:36b69ba4b24b f=[]
145 146 |\
146 147 | o 2:99451f16b3f5 p=0,-1 m=2:36b69ba4b24b f=["b"]
147 148 | |
@@ -155,16 +156,6 b' An identical file added at both parents,'
155 156
156 157 $ cd ..
157 158 $ check_convert_identity flag-change-take-p1
158 3:c8d50407916e
159 *** BUG: hash changes on convert ***
160 o 3:c8d50407916e p=2,1 m=2:36b69ba4b24b f=[]
161 |\
162 | o 2:99451f16b3f5 p=0,-1 m=2:36b69ba4b24b f=["b"]
163 | |
164 o | 1:64d01526d4c2 p=0,-1 m=1:686dbf0aeca4 f=["b"]
165 |/
166 o 0:487a0a245cea p=-1,-1 m=0:8515d4bfda76 f=["a"]
167
168 159
169 160 An identical file added at both parents, but the flag differs. Take other:
170 161
@@ -226,6 +217,7 b' An identical file added at both parents,'
226 217 $ hg ci --debug -m merge
227 218 committing files:
228 219 c
220 not reusing manifest (no file change in changelog, but manifest differs)
229 221 committing manifest
230 222 committing changelog
231 223 updating the branch cache
@@ -299,6 +291,7 b' A file added at p2, a named branch creat'
299 291 $ hg ci --debug -m merge
300 292 committing files:
301 293 b
294 not reusing manifest (no file change in changelog, but manifest differs)
302 295 committing manifest
303 296 committing changelog
304 297 updating the branch cache
General Comments 0
You need to be logged in to leave comments. Login now