[PATCH 2 of 2] revset: make children only look at commits >= minrev

Augie Fackler raf at durin42.com
Tue Sep 23 13:23:50 CDT 2014


On Mon, Sep 22, 2014 at 11:31:09PM -0700, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1411450748 25200
> #      Mon Sep 22 22:39:08 2014 -0700
> # Node ID 14087ac481b1d25ccaa69ed15a014f56c829da65
> # Parent  e7e0c696c29e1735aad7a77f82bfc987354a98c1
> revset: make children only look at commits >= minrev

Nice! Both queued, thanks.

>
> Previously children() would iterate over every item in the subset, looking for
> children of things in the parentset. We now request that the subset present
> itself in descending order, so we can abort early once we see a rev that is <=
> the minimum parent.
>
> This, combined with the previous patch, shaves 40% off certain rebase times on
> large repositories.  17 seconds -> 9 seconds.
>
> revset #29: (children(ancestor(tip~5, tip)) and ::(tip~5))::
> (@ commit)       0) wall 0.171047 comb 0.170000 user 0.170000 (best of 51)
> (previous patch) 1) wall 0.155102 comb 0.150000 user 0.150000 (best of 55)
> (this patch)     2) wall 0.028842 comb 0.030000 user 0.030000 (best of 100)
>
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -561,9 +561,10 @@
>          return baseset(cs)
>      pr = repo.changelog.parentrevs
>      minrev = min(parentset)
> +    narrow.descending()
>      for r in narrow:
>          if r <= minrev:
> -            continue
> +            break
>          for p in pr(r):
>              if p in parentset:
>                  cs.add(r)
> diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
> --- a/tests/test-histedit-obsolete.t
> +++ b/tests/test-histedit-obsolete.t
> @@ -431,9 +431,9 @@
>    0 files updated, 0 files merged, 2 files removed, 0 files unresolved
>    2 files updated, 0 files merged, 0 files removed, 0 files unresolved
>    0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> +  saved backup bundle to $TESTTMP/folding/.hg/strip-backup/859969f5ed7e-backup.hg (glob)
> +  saved backup bundle to $TESTTMP/folding/.hg/strip-backup/83d1858e070b-backup.hg (glob)
>    saved backup bundle to $TESTTMP/folding/.hg/strip-backup/58019c66f35f-backup.hg (glob)
> -  saved backup bundle to $TESTTMP/folding/.hg/strip-backup/83d1858e070b-backup.hg (glob)
> -  saved backup bundle to $TESTTMP/folding/.hg/strip-backup/859969f5ed7e-backup.hg (glob)
>    $ hg log -G
>    @  19:f9daec13fb98 (secret) i
>    |
> diff --git a/tests/test-rebase-scenario-global.t b/tests/test-rebase-scenario-global.t
> --- a/tests/test-rebase-scenario-global.t
> +++ b/tests/test-rebase-scenario-global.t
> @@ -557,7 +557,7 @@
>    $ hg clone -q -u . ah ah6
>    $ cd ah6
>    $ hg rebase -r '(4+6)::' -d 1
> -  saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-backup.hg (glob)
> +  saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/c01897464e7f-backup.hg (glob)
>    $ hg tglog
>    o  8: 'I'
>    |
> @@ -624,7 +624,7 @@
>  (actual test)
>
>    $ hg rebase --dest 'desc(G)' --rev 'desc(K) + desc(I)'
> -  saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-backup.hg (glob)
> +  saved backup bundle to $TESTTMP/a8/.hg/strip-backup/e7ec4e813ba6-backup.hg (glob)
>    $ hg log --rev 'children(desc(G))'
>    changeset:   9:adb617877056
>    parent:      6:eea13746799a
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list