Patchwork [2,of,7] merge: use scmutil.intrev() to sort ctx objects

login
register
mail settings
Submitter Yuya Nishihara
Date June 3, 2017, 2:39 p.m.
Message ID <aee024abcb7e2abcadd6.1496500766@mimosa>
Download mbox | patch
Permalink /patch/21157/
State Accepted
Headers show

Comments

Yuya Nishihara - June 3, 2017, 2:39 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1496484079 -32400
#      Sat Jun 03 19:01:19 2017 +0900
# Node ID aee024abcb7e2abcadd612cc736c93639cc275e0
# Parent  53c0c2e03be2c9c544f2c9cfeeab0e8122253d00
merge: use scmutil.intrev() to sort ctx objects

This moves wctx to the last, but that shouldn't matter. Only the order of
stored revisions is important.
via Mercurial-devel - June 4, 2017, 9:02 p.m.
On Sat, Jun 3, 2017 at 7:39 AM, Yuya Nishihara <yuya@tcha.org> wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1496484079 -32400
> #      Sat Jun 03 19:01:19 2017 +0900
> # Node ID aee024abcb7e2abcadd612cc736c93639cc275e0
> # Parent  53c0c2e03be2c9c544f2c9cfeeab0e8122253d00
> merge: use scmutil.intrev() to sort ctx objects
>
> This moves wctx to the last, but that shouldn't matter. Only the order of
> stored revisions is important.

wctx.manifest() will involve loading the manifest of its parent, so it
could matter, right? It would be for the better, though :-)

>
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -801,7 +801,7 @@ def manifestmerge(repo, wctx, p2, pa, br
>
>      # manifests fetched in order are going to be faster, so prime the caches
>      [x.manifest() for x in
> -     sorted(wctx.parents() + [p2, pa], key=lambda x: x.rev() or -1)]
> +     sorted(wctx.parents() + [p2, pa], key=scmutil.intrev)]
>
>      if followcopies:
>          ret = copies.mergecopies(repo, wctx, p2, pa)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Yuya Nishihara - June 5, 2017, 1:05 p.m.
On Sun, 4 Jun 2017 14:02:37 -0700, Martin von Zweigbergk wrote:
> On Sat, Jun 3, 2017 at 7:39 AM, Yuya Nishihara <yuya@tcha.org> wrote:
> > # HG changeset patch
> > # User Yuya Nishihara <yuya@tcha.org>
> > # Date 1496484079 -32400
> > #      Sat Jun 03 19:01:19 2017 +0900
> > # Node ID aee024abcb7e2abcadd612cc736c93639cc275e0
> > # Parent  53c0c2e03be2c9c544f2c9cfeeab0e8122253d00
> > merge: use scmutil.intrev() to sort ctx objects
> >
> > This moves wctx to the last, but that shouldn't matter. Only the order of
> > stored revisions is important.
> 
> wctx.manifest() will involve loading the manifest of its parent, so it
> could matter, right? It would be for the better, though :-)

Ah, yes. And it would be better if pa is far from wctx.p1().

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -801,7 +801,7 @@  def manifestmerge(repo, wctx, p2, pa, br
 
     # manifests fetched in order are going to be faster, so prime the caches
     [x.manifest() for x in
-     sorted(wctx.parents() + [p2, pa], key=lambda x: x.rev() or -1)]
+     sorted(wctx.parents() + [p2, pa], key=scmutil.intrev)]
 
     if followcopies:
         ret = copies.mergecopies(repo, wctx, p2, pa)