[PATCH V4] copy: add flag for disabling copy tracing

Durham Goode durham at fb.com
Thu Apr 16 16:07:46 CDT 2015



On 4/14/15 6:53 PM, Martin von Zweigbergk wrote:
>
>
> On Tue, Apr 14, 2015 at 6:56 AM Durham Goode <durham at fb.com 
> <mailto:durham at fb.com>> wrote:
>
>     # HG changeset patch
>     # User Durham Goode <durham at fb.com <mailto:durham at fb.com>>
>     # Date 1422386787 28800
>     #      Tue Jan 27 11:26:27 2015 -0800
>     # Node ID 5a39559f0caa07ca1a44ee67f7f917138b54198f
>     # Parent  52ff737c63d2b2cb41185549aa9c35bc47317032
>     copy: add flag for disabling copy tracing
>
>     Copy tracing can be up to 80% of rebase time when rebasing stacks
>     of commits in large repos (hundreds of thousands of files).
>     This provides the option of turning off the majority of copy
>     tracing. It
>     does not turn off _forwardcopies() since that is used to carry copy
>     information inside a commit across a rebase.
>
>     This will affect the situation where a user edits a file, then
>     rebases on top of
>     commits that have moved that file. The move will not be detected
>     and the user
>     will have to manually resolve the issue (possibly by redoing the
>     rebase with
>     this flag off).
>
>     This takes rebasing a 3 commit stack that's a couple weeks old
>     from 65s to 12s.
>
>     diff --git a/mercurial/copies.py b/mercurial/copies.py
>     --- a/mercurial/copies.py
>     +++ b/mercurial/copies.py
>     @@ -186,6 +186,9 @@ def _forwardcopies(a, b):
>          return cm
>
>      def _backwardrenames(a, b):
>     +    if a._repo.ui.configbool('experimental', 'disablecopytrace'):
>     +        return {}
>     +
>          # Even though we're not taking copies into account, 1:n
>     rename situations
>          # can still exist (e.g. hg cp a b; hg mv a c). In those cases we
>          # arbitrarily pick one of the renames.
>     @@ -258,6 +261,13 @@ def mergecopies(repo, c1, c2, ca):
>          if c2.node() is None and c1.node() == repo.dirstate.p1():
>              return repo.dirstate.copies(), {}, {}, {}
>
>     +    if repo.ui.configbool('experimental', 'disablecopytrace'):
>     +        # If we're just tracking against the parent, do a simple
>     check.
>     +        # This is necessary to ensure copies survive rebasing.
>     +        if ca in c2.parents():
>     +            return pathcopies(ca, c2), {}, {}, {}
>     +        return {}, {}, {}, {}
>     +
>          limit = _findlimit(repo, c1.rev(), c2.rev())
>          if limit is None:
>              # no common ancestor, no copies
>     @@ -506,7 +516,8 @@ def duplicatecopies(repo, rev, fromrev,
>          copies between fromrev and rev.
>          '''
>          exclude = {}
>     -    if skiprev is not None:
>     +    if (skiprev is not None and
>     +        not repo.ui.configbool('experimental', 'disablecopytrace')):
>
>
> I don't follow this bit, so I tried removing it to see what failed, 
> but all tests passed. What does it do?
Interesting, you're right.  The code path is hit, but the test results 
aren't changed.  I'm going to dig into this farther and resend once I 
have more details (and a test that is affected by that line).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150416/2a971a73/attachment.html>


More information about the Mercurial-devel mailing list