Show More
@@ -330,6 +330,9 b" coreconfigitem('experimental', 'clientco" | |||||
330 | coreconfigitem('experimental', 'copytrace', |
|
330 | coreconfigitem('experimental', 'copytrace', | |
331 | default='on', |
|
331 | default='on', | |
332 | ) |
|
332 | ) | |
|
333 | coreconfigitem('experimental', 'copytrace.movecandidateslimit', | |||
|
334 | default=100, | |||
|
335 | ) | |||
333 | coreconfigitem('experimental', 'copytrace.sourcecommitlimit', |
|
336 | coreconfigitem('experimental', 'copytrace.sourcecommitlimit', | |
334 | default=100, |
|
337 | default=100, | |
335 | ) |
|
338 | ) |
@@ -11,6 +11,8 b' import collections' | |||||
11 | import heapq |
|
11 | import heapq | |
12 | import os |
|
12 | import os | |
13 |
|
13 | |||
|
14 | from .i18n import _ | |||
|
15 | ||||
14 | from . import ( |
|
16 | from . import ( | |
15 | match as matchmod, |
|
17 | match as matchmod, | |
16 | node, |
|
18 | node, | |
@@ -644,6 +646,11 b' def _heuristicscopytracing(repo, c1, c2,' | |||||
644 |
|
646 | |||
645 | [experimental] |
|
647 | [experimental] | |
646 | copytrace = heuristics |
|
648 | copytrace = heuristics | |
|
649 | ||||
|
650 | In some cases the copy/move candidates found by heuristics can be very large | |||
|
651 | in number and that will make the algorithm slow. The number of possible | |||
|
652 | candidates to check can be limited by using the config | |||
|
653 | `experimental.copytrace.movecandidateslimit` which defaults to 100. | |||
647 | """ |
|
654 | """ | |
648 |
|
655 | |||
649 | if c1.rev() is None: |
|
656 | if c1.rev() is None: | |
@@ -704,6 +711,17 b' def _heuristicscopytracing(repo, c1, c2,' | |||||
704 | # f is guaranteed to be present in c2, that's why |
|
711 | # f is guaranteed to be present in c2, that's why | |
705 | # c2.filectx(f) won't fail |
|
712 | # c2.filectx(f) won't fail | |
706 | f2 = c2.filectx(f) |
|
713 | f2 = c2.filectx(f) | |
|
714 | # we can have a lot of candidates which can slow down the heuristics | |||
|
715 | # config value to limit the number of candidates moves to check | |||
|
716 | maxcandidates = repo.ui.configint('experimental', | |||
|
717 | 'copytrace.movecandidateslimit') | |||
|
718 | ||||
|
719 | if len(movecandidates) > maxcandidates: | |||
|
720 | repo.ui.status(_("skipping copytracing for '%s', more " | |||
|
721 | "candidates than the limit: %d\n") | |||
|
722 | % (f, len(movecandidates))) | |||
|
723 | continue | |||
|
724 | ||||
707 | for candidate in movecandidates: |
|
725 | for candidate in movecandidates: | |
708 | f1 = c1.filectx(candidate) |
|
726 | f1 = c1.filectx(candidate) | |
709 | if _related(f1, f2, anc.rev()): |
|
727 | if _related(f1, f2, anc.rev()): |
@@ -201,6 +201,65 b' Check a few potential move candidates' | |||||
201 | $ cd .. |
|
201 | $ cd .. | |
202 | $ rm -rf repo |
|
202 | $ rm -rf repo | |
203 |
|
203 | |||
|
204 | Test the copytrace.movecandidateslimit with many move candidates | |||
|
205 | ---------------------------------------------------------------- | |||
|
206 | ||||
|
207 | $ hg init repo | |||
|
208 | $ initclient repo | |||
|
209 | $ cd repo | |||
|
210 | $ echo a > a | |||
|
211 | $ hg add a | |||
|
212 | $ hg ci -m initial | |||
|
213 | $ hg mv a foo | |||
|
214 | $ echo a > b | |||
|
215 | $ echo a > c | |||
|
216 | $ echo a > d | |||
|
217 | $ echo a > e | |||
|
218 | $ echo a > f | |||
|
219 | $ echo a > g | |||
|
220 | $ hg add b | |||
|
221 | $ hg add c | |||
|
222 | $ hg add d | |||
|
223 | $ hg add e | |||
|
224 | $ hg add f | |||
|
225 | $ hg add g | |||
|
226 | $ hg ci -m 'mv a foo, add many files' | |||
|
227 | $ hg up -q ".^" | |||
|
228 | $ echo b > a | |||
|
229 | $ hg ci -m 'mod a' | |||
|
230 | created new head | |||
|
231 | ||||
|
232 | $ hg log -G -T 'changeset: {node}\n desc: {desc}\n' | |||
|
233 | @ changeset: ef716627c70bf4ca0bdb623cfb0d6fe5b9acc51e | |||
|
234 | | desc: mod a | |||
|
235 | | o changeset: 8329d5c6bf479ec5ca59b9864f3f45d07213f5a4 | |||
|
236 | |/ desc: mv a foo, add many files | |||
|
237 | o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98 | |||
|
238 | desc: initial | |||
|
239 | ||||
|
240 | With small limit | |||
|
241 | ||||
|
242 | $ hg rebase -s 2 -d 1 --config experimental.copytrace.movecandidateslimit=0 | |||
|
243 | rebasing 2:ef716627c70b "mod a" (tip) | |||
|
244 | skipping copytracing for 'a', more candidates than the limit: 7 | |||
|
245 | other [source] changed a which local [dest] deleted | |||
|
246 | use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u | |||
|
247 | unresolved conflicts (see hg resolve, then hg rebase --continue) | |||
|
248 | [1] | |||
|
249 | ||||
|
250 | $ hg rebase --abort | |||
|
251 | rebase aborted | |||
|
252 | ||||
|
253 | With default limit which is 100 | |||
|
254 | ||||
|
255 | $ hg rebase -s 2 -d 1 | |||
|
256 | rebasing 2:ef716627c70b "mod a" (tip) | |||
|
257 | merging foo and a to foo | |||
|
258 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/ef716627c70b-24681561-rebase.hg (glob) | |||
|
259 | ||||
|
260 | $ cd .. | |||
|
261 | $ rm -rf repo | |||
|
262 | ||||
204 | Move file in one branch and delete it in another |
|
263 | Move file in one branch and delete it in another | |
205 | ----------------------------------------------- |
|
264 | ----------------------------------------------- | |
206 |
|
265 |
General Comments 0
You need to be logged in to leave comments.
Login now