Patchwork [1,of,3,V2] revset: cleanup of algorithm for `destination()` predicate

login
register
mail settings
Submitter Hannes Oldenburg
Date Sept. 11, 2016, 3:05 p.m.
Message ID <aeb4ff2efd119ad5bab9.1473606358@localhost.localdomain>
Download mbox | patch
Permalink /patch/16583/
State Accepted
Headers show

Comments

Hannes Oldenburg - Sept. 11, 2016, 3:05 p.m.
# HG changeset patch
# User Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
# Date 1473454098 0
#      Fri Sep 09 20:48:18 2016 +0000
# Node ID aeb4ff2efd119ad5bab99f0c521ca52f71144309
# Parent  770128405002e895d94c92e449609ba33937ee11
revset: cleanup of algorithm for `destination()` predicate

For each iteration of the outer loop just before entering the inner loop
we initialize `lineage` to None.
Immediately after we enter the inner loop we check we reinitialize to an empty
list if `lineage` is None.
Since `lineage` is only used in the inner loop this is equivalent to immediately
initializing `lineage` to an empty list.
Yuya Nishihara - Sept. 12, 2016, 12:53 p.m.
On Sun, 11 Sep 2016 15:05:58 +0000, Hannes Oldenburg wrote:
> # HG changeset patch
> # User Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
> # Date 1473454098 0
> #      Fri Sep 09 20:48:18 2016 +0000
> # Node ID aeb4ff2efd119ad5bab99f0c521ca52f71144309
> # Parent  770128405002e895d94c92e449609ba33937ee11
> revset: cleanup of algorithm for `destination()` predicate

The first patch looks good to me. Can you resend with better summary line?
3 patches of the same summary seem not good.
Augie Fackler - Sept. 12, 2016, 1:35 p.m.
On Mon, Sep 12, 2016 at 09:53:22PM +0900, Yuya Nishihara wrote:
> On Sun, 11 Sep 2016 15:05:58 +0000, Hannes Oldenburg wrote:
> > # HG changeset patch
> > # User Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
> > # Date 1473454098 0
> > #      Fri Sep 09 20:48:18 2016 +0000
> > # Node ID aeb4ff2efd119ad5bab99f0c521ca52f71144309
> > # Parent  770128405002e895d94c92e449609ba33937ee11
> > revset: cleanup of algorithm for `destination()` predicate
>
> The first patch looks good to me. Can you resend with better summary line?
> 3 patches of the same summary seem not good.

Fair point on that and on patch 2. I'll go ahead and drop these from my stack.

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Zergling - Sept. 12, 2016, 1:44 p.m.
Yeah, sorry about that.
I guess we should just leave it at the first patch.
Thanks!

On Mon, Sep 12, 2016 at 1:35 PM, Augie Fackler <raf@durin42.com> wrote:

> On Mon, Sep 12, 2016 at 09:53:22PM +0900, Yuya Nishihara wrote:
> > On Sun, 11 Sep 2016 15:05:58 +0000, Hannes Oldenburg wrote:
> > > # HG changeset patch
> > > # User Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
> > > # Date 1473454098 0
> > > #      Fri Sep 09 20:48:18 2016 +0000
> > > # Node ID aeb4ff2efd119ad5bab99f0c521ca52f71144309
> > > # Parent  770128405002e895d94c92e449609ba33937ee11
> > > revset: cleanup of algorithm for `destination()` predicate
> >
> > The first patch looks good to me. Can you resend with better summary
> line?
> > 3 patches of the same summary seem not good.
>
> Fair point on that and on patch 2. I'll go ahead and drop these from my
> stack.
>
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel@mercurial-scm.org
> > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
Hannes Oldenburg - Sept. 12, 2016, 1:45 p.m.
Sorry, wrong email account.

On Mon, Sep 12, 2016 at 1:44 PM, Zergling <zerstroyer@gmail.com> wrote:

> Yeah, sorry about that.
> I guess we should just leave it at the first patch.
> Thanks!
>
> On Mon, Sep 12, 2016 at 1:35 PM, Augie Fackler <raf@durin42.com> wrote:
>
>> On Mon, Sep 12, 2016 at 09:53:22PM +0900, Yuya Nishihara wrote:
>> > On Sun, 11 Sep 2016 15:05:58 +0000, Hannes Oldenburg wrote:
>> > > # HG changeset patch
>> > > # User Hannes Oldenburg <hannes.christian.oldenburg@gmail.com>
>> > > # Date 1473454098 0
>> > > #      Fri Sep 09 20:48:18 2016 +0000
>> > > # Node ID aeb4ff2efd119ad5bab99f0c521ca52f71144309
>> > > # Parent  770128405002e895d94c92e449609ba33937ee11
>> > > revset: cleanup of algorithm for `destination()` predicate
>> >
>> > The first patch looks good to me. Can you resend with better summary
>> line?
>> > 3 patches of the same summary seem not good.
>>
>> Fair point on that and on patch 2. I'll go ahead and drop these from my
>> stack.
>>
>> > _______________________________________________
>> > Mercurial-devel mailing list
>> > Mercurial-devel@mercurial-scm.org
>> > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel@mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>>
>
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
>

Patch

diff -r 770128405002 -r aeb4ff2efd11 mercurial/revset.py
--- a/mercurial/revset.py	Sun Aug 21 12:36:23 2016 +0900
+++ b/mercurial/revset.py	Fri Sep 09 20:48:18 2016 +0000
@@ -852,12 +852,9 @@ 
     # grafts.
     for r in subset:
         src = _getrevsource(repo, r)
-        lineage = None
+        lineage = list()
 
         while src is not None:
-            if lineage is None:
-                lineage = list()
-
             lineage.append(r)
 
             # The visited lineage is a match if the current source is in the arg