Patchwork [05,of,19] localrepo: carefully move the order of local variables

login
register
mail settings
Submitter Sean Farley
Date May 15, 2014, 9:16 p.m.
Message ID <83dbb0b4b5916f670f4a.1400188583@laptop.local>
Download mbox | patch
Permalink /patch/4764/
State Changes Requested
Headers show

Comments

Sean Farley - May 15, 2014, 9:16 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1398129827 18000
#      Mon Apr 21 20:23:47 2014 -0500
# Node ID 83dbb0b4b5916f670f4a82bb4a218d39d4d00d13
# Parent  2390fc12ef1cbbad4f80f18a80ab38305b4fd2b9
localrepo: carefully move the order of local variables
Pierre-Yves David - May 15, 2014, 11:11 p.m.
On 05/15/2014 02:16 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1398129827 18000
> #      Mon Apr 21 20:23:47 2014 -0500
> # Node ID 83dbb0b4b5916f670f4a82bb4a218d39d4d00d13
> # Parent  2390fc12ef1cbbad4f80f18a80ab38305b4fd2b9
> localrepo: carefully move the order of local variables

Can you elaborate on why you do that and why this is safe?

It is nice to know you did it "carefully" but it does not really help. 
Would you trust me if I told you: "I'll carefully let my 7 year old 
nephew drive you back home"


>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -1565,14 +1565,14 @@ class localrepository(object):
>                   for f in removed:
>                       if f in mf2:
>                           del mf2[f]
>               else:
>                   # we are comparing two revisions
> -                deleted, unknown, ignored = [], [], []
>                   mf2 = ctx2._manifestmatches(match, r)
>
>               modified, added, clean = [], [], []
> +            deleted, unknown, ignored = r[3], [], []
>               withflags = mf1.withflags() | mf2.withflags()
>               for fn, mf2node in mf2.iteritems():
>                   if fn in mf1:
>                       if (fn not in deleted and
>                           ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
Sean Farley - May 16, 2014, 1:41 a.m.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> writes:

> On 05/15/2014 02:16 PM, Sean Farley wrote:
>> # HG changeset patch
>> # User Sean Farley <sean.michael.farley@gmail.com>
>> # Date 1398129827 18000
>> #      Mon Apr 21 20:23:47 2014 -0500
>> # Node ID 83dbb0b4b5916f670f4a82bb4a218d39d4d00d13
>> # Parent  2390fc12ef1cbbad4f80f18a80ab38305b4fd2b9
>> localrepo: carefully move the order of local variables
>
> Can you elaborate on why you do that and why this is safe?
>
> It is nice to know you did it "carefully" but it does not really help. 
> Would you trust me if I told you: "I'll carefully let my 7 year old 
> nephew drive you back home"

Would it be like when Short Round was driving Indian Jones around?
Because, if so, then yes!

https://www.youtube.com/watch?v=1nDVhn2MJkg
Pierre-Yves David - May 16, 2014, 3:42 a.m.
On 05/15/2014 06:41 PM, Sean Farley wrote:
>
> Pierre-Yves David <pierre-yves.david@ens-lyon.org> writes:
>
>> On 05/15/2014 02:16 PM, Sean Farley wrote:
>>> # HG changeset patch
>>> # User Sean Farley <sean.michael.farley@gmail.com>
>>> # Date 1398129827 18000
>>> #      Mon Apr 21 20:23:47 2014 -0500
>>> # Node ID 83dbb0b4b5916f670f4a82bb4a218d39d4d00d13
>>> # Parent  2390fc12ef1cbbad4f80f18a80ab38305b4fd2b9
>>> localrepo: carefully move the order of local variables
>>
>> Can you elaborate on why you do that and why this is safe?
>>
>> It is nice to know you did it "carefully" but it does not really help.
>> Would you trust me if I told you: "I'll carefully let my 7 year old
>> nephew drive you back home"
>
> Would it be like when Short Round was driving Indian Jones around?
> Because, if so, then yes!
>
> https://www.youtube.com/watch?v=1nDVhn2MJkg

I was more thinking about something along that line: 
http://cdn.arwrath.com/1/135195.gif

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1565,14 +1565,14 @@  class localrepository(object):
                 for f in removed:
                     if f in mf2:
                         del mf2[f]
             else:
                 # we are comparing two revisions
-                deleted, unknown, ignored = [], [], []
                 mf2 = ctx2._manifestmatches(match, r)
 
             modified, added, clean = [], [], []
+            deleted, unknown, ignored = r[3], [], []
             withflags = mf1.withflags() | mf2.withflags()
             for fn, mf2node in mf2.iteritems():
                 if fn in mf1:
                     if (fn not in deleted and
                         ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or