Patchwork [15,of,19] localrepo: remove unneeded unpacking of r

login
register
mail settings
Submitter Sean Farley
Date May 15, 2014, 9:16 p.m.
Message ID <dde09eaa8280d8138c76.1400188593@laptop.local>
Download mbox | patch
Permalink /patch/4774/
State Accepted
Commit e18ef2e112198ab3475e84399bf965191d799708
Headers show

Comments

Sean Farley - May 15, 2014, 9:16 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1398211597 18000
#      Tue Apr 22 19:06:37 2014 -0500
# Node ID dde09eaa8280d8138c76c8e74eae388f30ffce40
# Parent  62ee7ccd81062314afc77ca72279175fb19c0ea3
localrepo: remove unneeded unpacking of r
Pierre-Yves David - May 16, 2014, 12:17 a.m.
On 05/15/2014 02:16 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1398211597 18000
> #      Tue Apr 22 19:06:37 2014 -0500
> # Node ID dde09eaa8280d8138c76c8e74eae388f30ffce40
> # Parent  62ee7ccd81062314afc77ca72279175fb19c0ea3
> localrepo: remove unneeded unpacking of r

Could use a sentence explaining how it became unneeded.

>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -1553,16 +1553,13 @@ class localrepository(object):
>               r = ctx2._generatestatus(ctx1, s, match, listignored, listclean,
>                                        listunknown)
>
>           r = ctx2._poststatus(ctx1, r, match, listignored, listclean,
>                                listunknown)
> -        modified, added, removed, deleted, unknown, ignored, clean = r
>
>           if reversed:
> -            added, removed = removed, added
> -
> -        r = modified, added, removed, deleted, unknown, ignored, clean
> +            r[1], r[2] = r[2], r[1]

You needs a comment to explain what is going on here. Otherwise it will 
looks like hvirctfdunbbrnvbugulcckjhljlrtlf to the next guy working on 
this code. (And he will curse you for multiple generation)
Sean Farley - May 16, 2014, 12:50 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 1398211597 18000
>> #      Tue Apr 22 19:06:37 2014 -0500
>> # Node ID dde09eaa8280d8138c76c8e74eae388f30ffce40
>> # Parent  62ee7ccd81062314afc77ca72279175fb19c0ea3
>> localrepo: remove unneeded unpacking of r
>
> Could use a sentence explaining how it became unneeded.

Ok, will do.

>> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
>> --- a/mercurial/localrepo.py
>> +++ b/mercurial/localrepo.py
>> @@ -1553,16 +1553,13 @@ class localrepository(object):
>>               r = ctx2._generatestatus(ctx1, s, match, listignored, listclean,
>>                                        listunknown)
>>
>>           r = ctx2._poststatus(ctx1, r, match, listignored, listclean,
>>                                listunknown)
>> -        modified, added, removed, deleted, unknown, ignored, clean = r
>>
>>           if reversed:
>> -            added, removed = removed, added
>> -
>> -        r = modified, added, removed, deleted, unknown, ignored, clean
>> +            r[1], r[2] = r[2], r[1]
>
> You needs a comment to explain what is going on here. Otherwise it will 
> looks like hvirctfdunbbrnvbugulcckjhljlrtlf to the next guy working on 
> this code. (And he will curse you for multiple generation)

Heh, sure, will do.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1553,16 +1553,13 @@  class localrepository(object):
             r = ctx2._generatestatus(ctx1, s, match, listignored, listclean,
                                      listunknown)
 
         r = ctx2._poststatus(ctx1, r, match, listignored, listclean,
                              listunknown)
-        modified, added, removed, deleted, unknown, ignored, clean = r
 
         if reversed:
-            added, removed = removed, added
-
-        r = modified, added, removed, deleted, unknown, ignored, clean
+            r[1], r[2] = r[2], r[1]
 
         if listsubrepos:
             for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
                 if working:
                     rev2 = None