[PATCH v2] mergecopies: avoid slowdown from linkrev adjustment (issue4680)

Augie Fackler raf at durin42.com
Tue May 26 10:15:52 CDT 2015


On Tue, May 26, 2015 at 09:18:50AM -0500, Matt Mackall wrote:
> # HG changeset patch
> # User Matt Mackall <mpm at selenic.com>
> # Date 1432640718 18000
> #      Tue May 26 06:45:18 2015 -0500
> # Node ID 1da062c1f925a0330ddafe7dc4ac7a380932035c
> # Parent  605b1d32c1c011d56233f28923ee5354fce7e426
> mergecopies: avoid slowdown from linkrev adjustment (issue4680)

derp, I even knew this was coming but queued v1. Queued this one as a
replacement for the previous version.

>
> checkcopies was using fctx.rev() which it was expecting would be
> equivalent to linkrev() but was triggering the new _adjustlinkrev path.
> This was making grafts and merges with large sets of potential copies
> very expensive.
>
> diff -r 605b1d32c1c0 -r 1da062c1f925 mercurial/copies.py
> --- a/mercurial/copies.py	Sat May 23 15:55:04 2015 -0500
> +++ b/mercurial/copies.py	Tue May 26 06:45:18 2015 -0500
> @@ -456,7 +456,7 @@
>
>          g1, g2 = f1.ancestors(), f2.ancestors()
>          try:
> -            f1r, f2r = f1.rev(), f2.rev()
> +            f1r, f2r = f1.linkrev(), f2.linkrev()
>
>              if f1r is None:
>                  f1 = g1.next()
> @@ -464,7 +464,7 @@
>                  f2 = g2.next()
>
>              while True:
> -                f1r, f2r = f1.rev(), f2.rev()
> +                f1r, f2r = f1.linkrev(), f2.linkrev()
>                  if f1r > f2r:
>                      f1 = g1.next()
>                  elif f2r > f1r:
> @@ -479,7 +479,7 @@
>      of = None
>      seen = set([f])
>      for oc in ctx(f, m1[f]).ancestors():
> -        ocr = oc.rev()
> +        ocr = oc.linkrev()
>          of = oc.path()
>          if of in seen:
>              # check limit late - grab last rename before
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list