[PATCH 01 of 15 v2] dirstate: separate 'lookup' status field from others

Mads Kiilerich mads at kiilerich.com
Mon Oct 6 12:48:24 CDT 2014


On 10/05/2014 08:07 AM, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at gmail.com>
> # Date 1412397850 25200
> #      Fri Oct 03 21:44:10 2014 -0700
> # Node ID 06cc871f960f4c22a81b2271ef235ff53f26cf4c
> # Parent  889789a2ca9f19755bf0d302c8671f850e42a059
> dirstate: separate 'lookup' status field from others
>
> The status tuple returned from dirstate.status() has an additional
> field compared to the other status tuples: lookup/unsure. This field
> is just an optimization and not something most callers care about
> (they want the resolved value of 'modified' or 'clean'). To prepare
> for a single future status type, let's separate out the 'lookup' field
> from the rest by having dirstate.status() return a pair: (lookup,
> status).
>
> diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
> --- a/hgext/largefiles/lfutil.py
> +++ b/hgext/largefiles/lfutil.py
> @@ -136,8 +136,8 @@
>   
>   def lfdirstatestatus(lfdirstate, repo, rev):
>       match = match_.always(repo.root, repo.getcwd())
> -    s = lfdirstate.status(match, [], False, False, False)
> -    unsure, modified, added, removed, missing, unknown, ignored, clean = s
> +    unsure, s = lfdirstate.status(match, [], False, False, False)
> +    modified, added, removed, missing, unknown, ignored, clean = s
>       for lfile in unsure:
>           try:
>               fctx = repo[rev][standin(lfile)]
> diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
> --- a/hgext/largefiles/overrides.py
> +++ b/hgext/largefiles/overrides.py
> @@ -351,9 +351,9 @@
>       wlock = repo.wlock()
>       try:
>           lfdirstate = lfutil.openlfdirstate(ui, repo)
> -        s = lfdirstate.status(match_.always(repo.root, repo.getcwd()),
> -            [], False, False, False)
> -        (unsure, modified, added, removed, missing, unknown, ignored, clean) = s
> +        unsure, s = lfdirstate.status(match_.always(repo.root, repo.getcwd()),
> +                                      [], False, False, False)
> +        modified = s[0]

Nice rework of the series!

This change must imply that the name bindings of 'modified' and the 
others actually were unused? It just reused an existing name so we 
didn't notice?

That is arguably a separate change that should come first (for instance 
renaming to _ prefix) ... or at least be mentioned in the description. 
That is however just a minor thing and I do not find it necessary to 
rework&resend just for that.

/Mads



More information about the Mercurial-devel mailing list