Patchwork [4,of,4] context.status: pass status tuple into _buildstatus

login
register
mail settings
Submitter Martin von Zweigbergk
Date Nov. 13, 2014, 6:29 a.m.
Message ID <84f224a57d6630a2c147.1415860196@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6697/
State Superseded
Commit dd3f857598a0625305b106323544df425efeaf84
Headers show

Comments

Martin von Zweigbergk - Nov. 13, 2014, 6:29 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1415859636 28800
#      Wed Nov 12 22:20:36 2014 -0800
# Node ID 84f224a57d6630a2c14780857bcfbc9b834bf167
# Parent  e976b49eb0342c83226855a4facb9c8e814e4551
context.status: pass status tuple into _buildstatus

By passing a status tuple (instead of the current list), we can access
the status fields by name and make it a little more readable.
Pierre-Yves David - Nov. 13, 2014, 5:33 p.m.
On 11/13/2014 06:29 AM, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1415859636 28800
> #      Wed Nov 12 22:20:36 2014 -0800
> # Node ID 84f224a57d6630a2c14780857bcfbc9b834bf167
> # Parent  e976b49eb0342c83226855a4facb9c8e814e4551
> context.status: pass status tuple into _buildstatus

This whole series looks good to me. I would be happier if sean farley 
give it a look before I push it
Sean Farley - Nov. 13, 2014, 7:55 p.m.
Pierre-Yves David writes:

> On 11/13/2014 06:29 AM, Martin von Zweigbergk wrote:
>> # HG changeset patch
>> # User Martin von Zweigbergk <martinvonz@google.com>
>> # Date 1415859636 28800
>> #      Wed Nov 12 22:20:36 2014 -0800
>> # Node ID 84f224a57d6630a2c14780857bcfbc9b834bf167
>> # Parent  e976b49eb0342c83226855a4facb9c8e814e4551
>> context.status: pass status tuple into _buildstatus
>
> This whole series looks good to me. I would be happier if sean farley 
> give it a look before I push it

Sure, I'll give it a look over tonight.
Sean Farley - Nov. 14, 2014, 5:29 a.m.
Pierre-Yves David writes:

> On 11/13/2014 06:29 AM, Martin von Zweigbergk wrote:
>> # HG changeset patch
>> # User Martin von Zweigbergk <martinvonz@google.com>
>> # Date 1415859636 28800
>> #      Wed Nov 12 22:20:36 2014 -0800
>> # Node ID 84f224a57d6630a2c14780857bcfbc9b834bf167
>> # Parent  e976b49eb0342c83226855a4facb9c8e814e4551
>> context.status: pass status tuple into _buildstatus
>
> This whole series looks good to me. I would be happier if sean farley 
> give it a look before I push it

The series is good as is, I think. Finally getting rid of all the
confusing s[N] is nice. Good job, Martin!

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -108,7 +108,7 @@ 
         mf2 = self._manifestmatches(match, s)
 
         modified, added, clean = [], [], []
-        deleted, unknown, ignored = s[3], s[4], s[5]
+        deleted, unknown, ignored = s.deleted, s.unknown, s.ignored
         deletedset = set(deleted)
         withflags = mf1.withflags() | mf2.withflags()
         for fn, mf2node in mf2.iteritems():
@@ -301,7 +301,7 @@ 
             ctx1, ctx2 = ctx2, ctx1
 
         match = ctx2._matchstatus(ctx1, match)
-        r = [[], [], [], [], [], [], []]
+        r = scmutil.status([], [], [], [], [], [], [])
         r = ctx2._buildstatus(ctx1, r, match, listignored, listclean,
                               listunknown)
 
@@ -1389,11 +1389,10 @@ 
         need to build a manifest and return what matches.
         """
         mf = self._repo['.']._manifestmatches(match, s)
-        modified, added, removed = s[0:3]
-        for f in modified + added:
+        for f in s.modified + s.added:
             mf[f] = None
             mf.setflag(f, self.flags(f))
-        for f in removed:
+        for f in s.removed:
             if f in mf:
                 del mf[f]
         return mf