##// 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 def commitctx(self, ctx, error=False):
2039 def commitctx(self, ctx, error=False):
2040 """Add a new revision to current repository.
2040 """Add a new revision to current repository.
2041 Revision information is passed via the context argument.
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 tr = None
2049 tr = None
@@ -2091,15 +2096,29 b' class localrepository(object):'
2091 raise
2096 raise
2092
2097
2093 # update manifest
2098 # update manifest
2094 self.ui.note(_("committing manifest\n"))
2095 removed = [f for f in sorted(removed) if f in m1 or f in m2]
2099 removed = [f for f in sorted(removed) if f in m1 or f in m2]
2096 drop = [f for f in removed if f in m]
2100 drop = [f for f in removed if f in m]
2097 for f in drop:
2101 for f in drop:
2098 del m[f]
2102 del m[f]
2099 mn = mctx.write(trp, linkrev,
2100 p1.manifestnode(), p2.manifestnode(),
2101 added, drop)
2102 files = changed + removed
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 else:
2122 else:
2104 self.ui.debug('reusing manifest from p1 (no file change)\n')
2123 self.ui.debug('reusing manifest from p1 (no file change)\n')
2105 mn = p1.manifestnode()
2124 mn = p1.manifestnode()
@@ -83,20 +83,17 b' test multiple merges at once'
83 $ hg -R hg2hg out source-hg -T compact
83 $ hg -R hg2hg out source-hg -T compact
84 comparing with source-hg
84 comparing with source-hg
85 searching for changes
85 searching for changes
86 5[tip]:4,3 6bd55e826939 2009-10-10 08:00 +0100 foo
86 no changes found
87 (octopus merge fixup)
87 [1]
88
89 XXX: The manifest lines should probably agree, to avoid changing the hash when
90 converting hg -> hg
91
88
92 $ hg -R source-hg log --debug -r tip
89 $ hg -R source-hg log --debug -r tip
93 changeset: 5:b209510f11b2c987f920749cd8e352aa4b3230f2
90 changeset: 5:6bd55e8269392769783345686faf7ff7b3b0215d
94 branch: source
91 branch: source
95 tag: tip
92 tag: tip
96 phase: draft
93 phase: draft
97 parent: 4:1dc38c377bb35eeea4fa955056fbe4440d54a743
94 parent: 4:1dc38c377bb35eeea4fa955056fbe4440d54a743
98 parent: 3:4aaba1bfb426b8941bbf63f9dd52301152695164
95 parent: 3:4aaba1bfb426b8941bbf63f9dd52301152695164
99 manifest: 5:1109e42bdcbd1f51baa69bc91079011d77057dbb
96 manifest: 4:daa315d56a98ba20811fdd0d9d575861f65cfa8c
100 user: Foo Bar <foo.bar@example.com>
97 user: Foo Bar <foo.bar@example.com>
101 date: Sat Oct 10 08:00:04 2009 +0100
98 date: Sat Oct 10 08:00:04 2009 +0100
102 extra: branch=source
99 extra: branch=source
@@ -780,7 +780,7 b' example because filemap changed.'
780 converting...
780 converting...
781 0 3
781 0 3
782 $ hg -R .-hg log -G -T '{shortest(node)} {desc}\n{files % "- {file}\n"}\n'
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 | o 33a0 2
785 | o 33a0 2
786 | | - f
786 | | - f
@@ -85,8 +85,8 b' Convert again'
85 $ hg branches
85 $ hg branches
86 newbranch 11:a6d7cc050ad1
86 newbranch 11:a6d7cc050ad1
87 default 10:6e2b33404495
87 default 10:6e2b33404495
88 old 9:93c4b0f99529
88 old 9:1b494af68c0b
89 old2 8:b52884d7bead (inactive)
89 old2 8:5be40b8dcbf6 (inactive)
90 $ hg tags -q
90 $ hg tags -q
91 tip
91 tip
92 $ cd ..
92 $ cd ..
@@ -851,9 +851,9 b' no ancestors that are replaced.'
851
851
852 $ hg fix -r 0:2
852 $ hg fix -r 0:2
853 $ hg log --graph --template '{node|shortest} {files}'
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 | @ bc05 bar.whole
858 | @ bc05 bar.whole
859 | |
859 | |
@@ -699,8 +699,23 b' Transplants of grafts can find a destina'
699 summary: 2
699 summary: 2
700
700
701 ... grafts of grafts unfortunately can't
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 warning: can't find ancestor for 'b' copied from 'a'!
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 $ hg log -r 'destination(13)'
719 $ hg log -r 'destination(13)'
705 All copies of a cset
720 All copies of a cset
706 $ hg log -r 'origin(13) or destination(origin(13))'
721 $ hg log -r 'origin(13) or destination(origin(13))'
@@ -731,7 +746,7 b' All copies of a cset'
731 date: Thu Jan 01 00:00:00 1970 +0000
746 date: Thu Jan 01 00:00:00 1970 +0000
732 summary: 2
747 summary: 2
733
748
734 changeset: 22:d1cb6591fa4b
749 changeset: 22:3a4e92d81b97
735 branch: dev
750 branch: dev
736 tag: tip
751 tag: tip
737 user: foo
752 user: foo
@@ -743,8 +758,8 b' graft works on complex revset'
743
758
744 $ hg graft 'origin(13) or destination(origin(13))'
759 $ hg graft 'origin(13) or destination(origin(13))'
745 skipping ancestor revision 21:7e61b508e709
760 skipping ancestor revision 21:7e61b508e709
746 skipping ancestor revision 22:d1cb6591fa4b
761 skipping ancestor revision 22:3a4e92d81b97
747 skipping revision 2:5c095ad7e90f (already grafted to 22:d1cb6591fa4b)
762 skipping revision 2:5c095ad7e90f (already grafted to 22:3a4e92d81b97)
748 grafting 7:ef0ef43d49e7 "2"
763 grafting 7:ef0ef43d49e7 "2"
749 warning: can't find ancestor for 'b' copied from 'a'!
764 warning: can't find ancestor for 'b' copied from 'a'!
750 grafting 13:7a4785234d87 "2"
765 grafting 13:7a4785234d87 "2"
@@ -758,7 +773,7 b" graft with --force (still doesn't graft "
758 $ hg graft 19 0 6
773 $ hg graft 19 0 6
759 skipping ungraftable merge revision 6
774 skipping ungraftable merge revision 6
760 skipping ancestor revision 0:68795b066622
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 [255]
777 [255]
763 $ hg graft 19 0 6 --force
778 $ hg graft 19 0 6 --force
764 skipping ungraftable merge revision 6
779 skipping ungraftable merge revision 6
@@ -773,12 +788,12 b' graft --force after backout'
773 $ hg ci -m 28
788 $ hg ci -m 28
774 $ hg backout 28
789 $ hg backout 28
775 reverting a
790 reverting a
776 changeset 29:53177ba928f6 backs out changeset 28:50a516bb8b57
791 changeset 29:9d95e865b00c backs out changeset 28:cc20d29aec8d
777 $ hg graft 28
792 $ hg graft 28
778 skipping ancestor revision 28:50a516bb8b57
793 skipping ancestor revision 28:cc20d29aec8d
779 [255]
794 [255]
780 $ hg graft 28 --force
795 $ hg graft 28 --force
781 grafting 28:50a516bb8b57 "28"
796 grafting 28:cc20d29aec8d "28"
782 merging a
797 merging a
783 $ cat a
798 $ cat a
784 abc
799 abc
@@ -788,7 +803,7 b' graft --continue after --force'
788 $ echo def > a
803 $ echo def > a
789 $ hg ci -m 31
804 $ hg ci -m 31
790 $ hg graft 28 --force --tool internal:fail
805 $ hg graft 28 --force --tool internal:fail
791 grafting 28:50a516bb8b57 "28"
806 grafting 28:cc20d29aec8d "28"
792 abort: unresolved conflicts, can't continue
807 abort: unresolved conflicts, can't continue
793 (use 'hg resolve' and 'hg graft --continue')
808 (use 'hg resolve' and 'hg graft --continue')
794 [255]
809 [255]
@@ -801,7 +816,7 b' graft --continue after --force'
801 (no more unresolved files)
816 (no more unresolved files)
802 continue: hg graft --continue
817 continue: hg graft --continue
803 $ hg graft -c
818 $ hg graft -c
804 grafting 28:50a516bb8b57 "28"
819 grafting 28:cc20d29aec8d "28"
805 $ cat a
820 $ cat a
806 abc
821 abc
807
822
@@ -822,8 +837,8 b' Empty graft'
822 $ hg tag -f something
837 $ hg tag -f something
823 $ hg graft -qr 27
838 $ hg graft -qr 27
824 $ hg graft -f 27
839 $ hg graft -f 27
825 grafting 27:ed6c7e54e319 "28"
840 grafting 27:17d42b8f5d50 "28"
826 note: graft of 27:ed6c7e54e319 created no changes to commit
841 note: graft of 27:17d42b8f5d50 created no changes to commit
827
842
828 $ cd ..
843 $ cd ..
829
844
@@ -30,6 +30,7 b' Files added at both parents:'
30 $ hg ci --debug -m merge
30 $ hg ci --debug -m merge
31 committing files:
31 committing files:
32 b
32 b
33 not reusing manifest (no file change in changelog, but manifest differs)
33 committing manifest
34 committing manifest
34 committing changelog
35 committing changelog
35 updating the branch cache
36 updating the branch cache
@@ -136,12 +137,12 b' An identical file added at both parents,'
136 $ hg ci --debug -m merge
137 $ hg ci --debug -m merge
137 committing files:
138 committing files:
138 b
139 b
139 committing manifest
140 reusing manifest form p1 (listed files actually unchanged)
140 committing changelog
141 committing changelog
141 updating the branch cache
142 updating the branch cache
142 committed changeset 3:4bfaad7f925b7f17f60524dc5d4e605f7bfbba3f
143 committed changeset 3:c8d50407916ef8a5a97cb6e36ca9bc844a6ee13e
143 $ hg log -GTl
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 | o 2:99451f16b3f5 p=0,-1 m=2:36b69ba4b24b f=["b"]
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 $ cd ..
157 $ cd ..
157 $ check_convert_identity flag-change-take-p1
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 An identical file added at both parents, but the flag differs. Take other:
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 $ hg ci --debug -m merge
217 $ hg ci --debug -m merge
227 committing files:
218 committing files:
228 c
219 c
220 not reusing manifest (no file change in changelog, but manifest differs)
229 committing manifest
221 committing manifest
230 committing changelog
222 committing changelog
231 updating the branch cache
223 updating the branch cache
@@ -299,6 +291,7 b' A file added at p2, a named branch creat'
299 $ hg ci --debug -m merge
291 $ hg ci --debug -m merge
300 committing files:
292 committing files:
301 b
293 b
294 not reusing manifest (no file change in changelog, but manifest differs)
302 committing manifest
295 committing manifest
303 committing changelog
296 committing changelog
304 updating the branch cache
297 updating the branch cache
General Comments 0
You need to be logged in to leave comments. Login now