[PATCH] sparse: access status fields by name instead of deconstructing it

Gregory Szorc gregory.szorc at gmail.com
Sun Jul 9 18:37:51 EDT 2017


On Sun, Jul 9, 2017 at 3:09 PM, Martin von Zweigbergk via Mercurial-devel <
mercurial-devel at mercurial-scm.org> wrote:

> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1499404838 25200
> #      Thu Jul 06 22:20:38 2017 -0700
> # Node ID 27c6b35d4637ae4bca2b78c6f2f2f06af0d47873
> # Parent  9087f9997f42ce3035e97a03bce63852a266660e
> sparse: access status fields by name instead of deconstructing it
>

Queued for default.


>
> The status tuples has had named fields for a few years now.
>
> diff --git a/mercurial/sparse.py b/mercurial/sparse.py
> --- a/mercurial/sparse.py
> +++ b/mercurial/sparse.py
> @@ -200,9 +200,8 @@
>      if not enabled or not repo.vfs.exists('tempsparse'):
>          return
>
> -    origstatus = repo.status()
> -    modified, added, removed, deleted, a, b, c = origstatus
> -    if modified or added or removed or deleted:
> +    s = repo.status()
> +    if s.modified or s.added or s.removed or s.deleted:
>          # Still have pending changes. Don't bother trying to prune.
>          return
>
> @@ -389,13 +388,11 @@
>      Will abort if a file with pending changes is being excluded or
> included
>      unless ``force`` is True.
>      """
> -    modified, added, removed, deleted, unknown, ignored, clean =
> origstatus
> -
>      # Verify there are no pending changes
>      pending = set()
> -    pending.update(modified)
> -    pending.update(added)
> -    pending.update(removed)
> +    pending.update(origstatus.modified)
> +    pending.update(origstatus.added)
> +    pending.update(origstatus.removed)
>      sparsematch = matcher(repo)
>      abort = False
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170709/4d2e5a27/attachment.html>


More information about the Mercurial-devel mailing list