Patchwork [14,of,19] context: support matches in workingctx.status

login
register
mail settings
Submitter David Schleimer
Date Feb. 10, 2013, 11:30 p.m.
Message ID <730f81cd4b340348dfc5.1360539004@dev010.prn1.facebook.com>
Download mbox | patch
Permalink /patch/954/
State Changes Requested
Headers show

Comments

David Schleimer - Feb. 10, 2013, 11:30 p.m.
# HG changeset patch
# User David Schleimer <dschleimer@fb.com>
# Date 1360424562 28800
# Node ID 730f81cd4b340348dfc5d2eb571f3b13e01c73e4
# Parent  1bae6048dd1028bb6b7506ec1ecb73bd819e7449
context: support matches in workingctx.status

This makes it possible to get a filtered view of the workingcopy via
workingctx.status().  This is currently unused, but subsequent patches
will use this to pull validation steps out of localrepo.commit and
into the workingctx.  This in turn will make it practical to unify
workingctx and memctx, making memctx more useful.
Pierre-Yves David - Feb. 12, 2013, 1:57 p.m.
On Sun, Feb 10, 2013 at 03:30:04PM -0800, David Schleimer wrote:
> # HG changeset patch
> # User David Schleimer <dschleimer@fb.com>
> # Date 1360424562 28800
> # Node ID 730f81cd4b340348dfc5d2eb571f3b13e01c73e4
> # Parent  1bae6048dd1028bb6b7506ec1ecb73bd819e7449
> context: support matches in workingctx.status
> 
> This makes it possible to get a filtered view of the workingcopy via
> workingctx.status().  This is currently unused, but subsequent patches
> will use this to pull validation steps out of localrepo.commit and
> into the workingctx.  This in turn will make it practical to unify
> workingctx and memctx, making memctx more useful.

As Kevin said, if you could avoid using *filtered* *view* that would be a big win.

Restricted or reduced maybe.
Matt Mackall - Feb. 13, 2013, 5:16 a.m.
On Sun, 2013-02-10 at 15:30 -0800, David Schleimer wrote:
> # HG changeset patch
> # User David Schleimer <dschleimer@fb.com>
> # Date 1360424562 28800
> # Node ID 730f81cd4b340348dfc5d2eb571f3b13e01c73e4
> # Parent  1bae6048dd1028bb6b7506ec1ecb73bd819e7449
> context: support matches in workingctx.status
> 
> This makes it possible to get a filtered view of the workingcopy via
> workingctx.status().  This is currently unused, but subsequent patches
> will use this to pull validation steps out of localrepo.commit and
> into the workingctx.  This in turn will make it practical to unify
> workingctx and memctx, making memctx more useful.

This and a few of the other patches move us further away from having
having repo[None] cacheable. That's a little unfortunate.

Perhaps we want to instead have a distinct commitctx type.

> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -941,12 +941,15 @@
>              p = p[:-1]
>          return [changectx(self._repo, x) for x in p]
>  
> -    def status(self, ignored=False, clean=False, unknown=False):
> +    def status(self, ignored=False, clean=False, unknown=False, match=None):
>          """Explicit status query
>          Unless this method is used to query the working copy status, the
>          _status property will implicitly read the status using its default
>          arguments."""
> -        stat = self._repo.status(ignored=ignored, clean=clean, unknown=unknown)
> +        stat = self._repo.status(ignored=ignored,
> +                                 clean=clean,
> +                                 unknown=unknown,
> +                                 match=match)
>          self._unknown = self._ignored = self._clean = None
>          if unknown:
>              self._unknown = stat[4]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -941,12 +941,15 @@ 
             p = p[:-1]
         return [changectx(self._repo, x) for x in p]
 
-    def status(self, ignored=False, clean=False, unknown=False):
+    def status(self, ignored=False, clean=False, unknown=False, match=None):
         """Explicit status query
         Unless this method is used to query the working copy status, the
         _status property will implicitly read the status using its default
         arguments."""
-        stat = self._repo.status(ignored=ignored, clean=clean, unknown=unknown)
+        stat = self._repo.status(ignored=ignored,
+                                 clean=clean,
+                                 unknown=unknown,
+                                 match=match)
         self._unknown = self._ignored = self._clean = None
         if unknown:
             self._unknown = stat[4]