Mercurial > hg
comparison tests/test-graft.t @ 32151:4d504e541d3d
rebase: use matcher to optimize manifestmerge
The old merge code would call manifestmerge and calculate the complete diff
between the source to the destination. In many cases, like rebase, the vast
majority of differences between the source and destination are irrelevant
because they are differences between the destination and the common ancestor
only, and therefore don't affect the merge. Since most actions are 'keep', all
the effort to compute them is wasted.
Instead, let's compute the difference between the source and the common ancestor
and only perform the diff of those files against the merge destination. When
using treemanifest, this lets us avoid loading almost the entire tree when
rebasing from a very old ancestor. This speeds up rebase of an old stack of 27
commits by 20x.
In mozilla-central, without treemanifest, when rebasing a commit from
default~100000 to default, this speeds up the manifestmerge step from 2.6s to
1.2s. However, the additional diff adds an overhead to all manifestmerge calls,
especially for flat manifests. When rebasing a commit from default~1 to default
it appears to add 100ms in mozilla-central. While we could put this optimization
behind a flag, I think the fact that it makes merge O(number of changes being
applied) instead of O(number of changes between X and Y) justifies it.
author | Durham Goode <durham@fb.com> |
---|---|
date | Wed, 03 May 2017 10:43:59 -0700 |
parents | 52dabcc49968 |
children | 3a755652ce3a |
comparison
equal
deleted
inserted
replaced
32150:282b288aa20c | 32151:4d504e541d3d |
---|---|
184 resolving manifests | 184 resolving manifests |
185 branchmerge: True, force: True, partial: False | 185 branchmerge: True, force: True, partial: False |
186 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746 | 186 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746 |
187 e: remote is newer -> g | 187 e: remote is newer -> g |
188 getting e | 188 getting e |
189 b: remote unchanged -> k | |
190 committing files: | 189 committing files: |
191 e | 190 e |
192 committing manifest | 191 committing manifest |
193 committing changelog | 192 committing changelog |
194 $ HGEDITOR=cat hg graft 4 3 --log --debug | 193 $ HGEDITOR=cat hg graft 4 3 --log --debug |
201 branchmerge: True, force: True, partial: False | 200 branchmerge: True, force: True, partial: False |
202 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d | 201 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d |
203 preserving e for resolve of e | 202 preserving e for resolve of e |
204 d: remote is newer -> g | 203 d: remote is newer -> g |
205 getting d | 204 getting d |
206 b: remote unchanged -> k | |
207 e: versions differ -> m (premerge) | 205 e: versions differ -> m (premerge) |
208 picked tool ':merge' for e (binary False symlink False changedelete False) | 206 picked tool ':merge' for e (binary False symlink False changedelete False) |
209 merging e | 207 merging e |
210 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304 | 208 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304 |
211 e: versions differ -> m (merge) | 209 e: versions differ -> m (merge) |