Patchwork match: remove unnecessary setting of self._always

login
register
mail settings
Submitter Martin von Zweigbergk
Date Oct. 5, 2014, 6:27 a.m.
Message ID <cc76b49dd2c20727b35d.1412490452@handduk2.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6141/
State Accepted
Headers show

Comments

Martin von Zweigbergk - Oct. 5, 2014, 6:27 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@gmail.com>
# Date 1412117888 25200
#      Tue Sep 30 15:58:08 2014 -0700
# Node ID cc76b49dd2c20727b35d8d869dd6911845794e13
# Parent  889789a2ca9f19755bf0d302c8671f850e42a059
match: remove unnecessary setting of self._always

The 'always' class calls its parent constructor with an empty list of
patterns, which will result in a matcher that always matches. The
parent constructor will set self._always to True in such cases, so
there is no need to set it again.
Augie Fackler - Oct. 7, 2014, 4:52 p.m.
On Sat, Oct 04, 2014 at 11:27:32PM -0700, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@gmail.com>
> # Date 1412117888 25200
> #      Tue Sep 30 15:58:08 2014 -0700
> # Node ID cc76b49dd2c20727b35d8d869dd6911845794e13
> # Parent  889789a2ca9f19755bf0d302c8671f850e42a059
> match: remove unnecessary setting of self._always

Sure, looks obviously right. Queued.

>
> The 'always' class calls its parent constructor with an empty list of
> patterns, which will result in a matcher that always matches. The
> parent constructor will set self._always to True in such cases, so
> there is no need to set it again.
>
> diff --git a/mercurial/match.py b/mercurial/match.py
> --- a/mercurial/match.py
> +++ b/mercurial/match.py
> @@ -156,7 +156,6 @@
>  class always(match):
>      def __init__(self, root, cwd):
>          match.__init__(self, root, cwd, [])
> -        self._always = True
>
>  class narrowmatcher(match):
>      """Adapt a matcher to work on a subdirectory only.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -156,7 +156,6 @@ 
 class always(match):
     def __init__(self, root, cwd):
         match.__init__(self, root, cwd, [])
-        self._always = True
 
 class narrowmatcher(match):
     """Adapt a matcher to work on a subdirectory only.