Patchwork D7086: fix: remove a never-true check for unset pattern in Fixer.affects()

login
register
mail settings
Submitter phabricator
Date Oct. 14, 2019, 6:39 a.m.
Message ID <differential-rev-PHID-DREV-so3r24biwhunwpbhu5qr-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42314/
State Superseded
Headers show

Comments

phabricator - Oct. 14, 2019, 6:39 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We don't create an instance of a Fixer if the pattern is None, so we
  don't need to check that in affects().

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7086

AFFECTED FILES
  hgext/fix.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 14, 2019, 4:32 p.m.
hooper added a comment.


  Looks good.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7086/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7086

To: martinvonz, #hg-reviewers
Cc: hooper, mercurial-devel

Patch

diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -845,9 +845,7 @@ 
 
     def affects(self, opts, fixctx, path):
         """Should this fixer run on the file at the given path and context?"""
-        return self._pattern is not None and scmutil.match(
-            fixctx, [self._pattern], opts
-        )(path)
+        return scmutil.match(fixctx, [self._pattern], opts)(path)
 
     def shouldoutputmetadata(self):
         """Should the stdout of this fixer start with JSON and a null byte?"""