[PATCH 6 of 8] dirstate: create class for status lists

Sean Farley sean.michael.farley at gmail.com
Wed Oct 1 19:31:52 CDT 2014


Martin von Zweigbergk writes:

> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at gmail.com>
> # Date 1412204534 25200
> #      Wed Oct 01 16:02:14 2014 -0700
> # Node ID 048f3810ef38a85db4b265f020fe94fe6a12d103
> # Parent  31cbb21f1283847c65e385bd94b81e2c78fd5121
> dirstate: create class for status lists
>
> Callers of various status() methods (on dirstate, context, repo) get a
> tuple of 7 or 8 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 class containing the 7 status
> fields: modified, added, removed, deleted, unknown, ignored, clean. In
> the cases of dirstate.status(), which has an 8th element ('lookup'),
> return a 2-tuple of the new status class and the lookup list.
>
> Having a class for the status also lets us add methods to it. For
> example, a status.haschanges() method turns out to be useful.

Interesting. Sid and I talked about this at the mini-sprint earlier this
year when I was ripping out status from localrepo.

It would be nice to simplify the status logic done in context.py because
it is confusing. For those that don't know, there is a (cached)
ctx.status() method which is different from ctx.status(rev). It's pretty
hairy.


More information about the Mercurial-devel mailing list