Mercurial > public > mercurial-scm > hg
comparison mercurial/copies.py @ 42225:d8ca7b99fc51
copies: move check for experimental.copytrace==<falsy> earlier
I'm going to ignore experimental.copytrace when changeset-centric
algorithms are required. This little refactoring makes that easier to
add.
Differential Revision: https://phab.mercurial-scm.org/D6268
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 17 Apr 2019 14:42:23 -0700 |
parents | a20d7c6abff2 |
children | a6be3af3a397 |
comparison
equal
deleted
inserted
replaced
42224:a20d7c6abff2 | 42225:d8ca7b99fc51 |
---|---|
408 # avoid silly behavior for parent -> working dir | 408 # avoid silly behavior for parent -> working dir |
409 if c2.node() is None and c1.node() == repo.dirstate.p1(): | 409 if c2.node() is None and c1.node() == repo.dirstate.p1(): |
410 return _dirstatecopies(repo, narrowmatch), {}, {}, {}, {} | 410 return _dirstatecopies(repo, narrowmatch), {}, {}, {}, {} |
411 | 411 |
412 copytracing = repo.ui.config('experimental', 'copytrace') | 412 copytracing = repo.ui.config('experimental', 'copytrace') |
413 boolctrace = stringutil.parsebool(copytracing) | 413 if stringutil.parsebool(copytracing) is False: |
414 # stringutil.parsebool() returns None when it is unable to parse the | |
415 # value, so we should rely on making sure copytracing is on such cases | |
416 return {}, {}, {}, {}, {} | |
414 | 417 |
415 # Copy trace disabling is explicitly below the node == p1 logic above | 418 # Copy trace disabling is explicitly below the node == p1 logic above |
416 # because the logic above is required for a simple copy to be kept across a | 419 # because the logic above is required for a simple copy to be kept across a |
417 # rebase. | 420 # rebase. |
418 if copytracing == 'heuristics': | 421 if copytracing == 'heuristics': |
420 # that will be fast enough and will also cover the copies which could | 423 # that will be fast enough and will also cover the copies which could |
421 # be missed by heuristics | 424 # be missed by heuristics |
422 if _isfullcopytraceable(repo, c1, base): | 425 if _isfullcopytraceable(repo, c1, base): |
423 return _fullcopytracing(repo, c1, c2, base) | 426 return _fullcopytracing(repo, c1, c2, base) |
424 return _heuristicscopytracing(repo, c1, c2, base) | 427 return _heuristicscopytracing(repo, c1, c2, base) |
425 elif boolctrace is False: | |
426 # stringutil.parsebool() returns None when it is unable to parse the | |
427 # value, so we should rely on making sure copytracing is on such cases | |
428 return {}, {}, {}, {}, {} | |
429 else: | 428 else: |
430 return _fullcopytracing(repo, c1, c2, base) | 429 return _fullcopytracing(repo, c1, c2, base) |
431 | 430 |
432 def _isfullcopytraceable(repo, c1, base): | 431 def _isfullcopytraceable(repo, c1, base): |
433 """ Checks that if base, source and destination are all no-public branches, | 432 """ Checks that if base, source and destination are all no-public branches, |