[PATCH 03 of 17 V4] dirstate: create class for status lists

Martin von Zweigbergk martinvonz at gmail.com
Tue Oct 14 01:01:22 CDT 2014


On Mon, Oct 13, 2014 at 10:51 PM, Matt Mackall <mpm at selenic.com> wrote:
> On Sat, 2014-10-11 at 22:44 -0700, Martin von Zweigbergk wrote:
>> # HG changeset patch
>> # User Martin von Zweigbergk <martinvonz at gmail.com>
>> # Date 1412976756 25200
>> #      Fri Oct 10 14:32:36 2014 -0700
>> # Node ID cd8ad3e2855507f93bc5a2fb645806c22be7b946
>> # Parent  7309c75e96a9a2f6d0e0f796a4d13e595e9ea958
>> dirstate: create class for status lists
>>
>> Callers of various status() methods (on dirstate, context, repo) get a
>> tuple of 7 elements, where each element is a list of files. This
>> results in lots of uses of indexes where names would be much more
>> readable. For example, "status.ignored" seems clearer than "status[4]"
>> [1]. So, let's introduce a simple named tuple containing the 7 status
>> fields: modified, added, removed, deleted, unknown, ignored, clean.
>>
>> This patch introduces the class and updates the status methods to
>> return instances of it. Later patches will update the callers.
>>
>>  [1] Did you even notice that it should have been "status[5]"?
>
> To move things along, I've tweaked this a bit in flight:
>
> - I've put the class definition in scmutil as status is not actually
> specific to the working copy (and I don't want to have a bunch of new
> things importing dirstate)

Thanks. It didn't quite seem like the right place to me either, but I
didn't know where it belonged. Moving it out of dirstate also removes
the confusion with the method named dirstate.status().

> - I've put _only_ the single change to dirstate.status() in that
> changeset, which:
>   - gives a smaller patch with fewer distractions
>   - proves API compatibility by introducing no test changes
>
> - I've put all the other users in a separate patch

Fine with me. Thanks for picking up the patches.


More information about the Mercurial-devel mailing list