Patchwork D6726: fix: correctly parse the :metadata subconfig

login
register
mail settings
Submitter phabricator
Date Aug. 14, 2019, 8:43 p.m.
Message ID <23e3e2bab0f9e319ea7085cde4306692@localhost.localdomain>
Download mbox | patch
Permalink /patch/41282/
State Not Applicable
Headers show

Comments

phabricator - Aug. 14, 2019, 8:43 p.m.
Closed by commit rHGd82e9f7e7440: fix: correctly parse the :metadata subconfig (authored by hooper).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6726?vs=16193&id=16206

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

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

AFFECTED FILES
  hgext/fix.py
  tests/test-fix-metadata.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-fix-metadata.t b/tests/test-fix-metadata.t
--- a/tests/test-fix-metadata.t
+++ b/tests/test-fix-metadata.t
@@ -43,6 +43,9 @@ 
   > [extensions]
   > fix =
   > [fix]
+  > metadatafalse:command=cat $TESTTMP/missing
+  > metadatafalse:pattern=metadatafalse
+  > metadatafalse:metadata=false
   > missing:command=cat $TESTTMP/missing
   > missing:pattern=missing
   > missing:metadata=true
@@ -65,6 +68,7 @@ 
   $ hg init repo
   $ cd repo
 
+  $ printf "old content\n" > metadatafalse
   $ printf "old content\n" > invalid
   $ printf "old content\n" > missing
   $ printf "old content\n" > valid
@@ -72,15 +76,20 @@ 
 
   $ hg fix -w
   ignored invalid output from fixer tool: invalid
+  fixed metadatafalse in revision 2147483647 using metadatafalse
   ignored invalid output from fixer tool: missing
   fixed valid in revision 2147483647 using valid
   saw "key" 1 times
   fixed 1 files with valid
   fixed the working copy
 
-  $ cat missing invalid valid
+  $ cat metadatafalse
+  new content
+  $ cat missing
   old content
+  $ cat invalid
   old content
+  $ cat valid
   new content
 
   $ cd ..
diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -171,7 +171,7 @@ 
     'linerange': None,
     'pattern': None,
     'priority': 0,
-    'metadata': False,
+    'metadata': 'false',
     'skipclean': 'true',
 }
 
@@ -724,6 +724,7 @@ 
             setattr(fixers[name], pycompat.sysstr('_' + key),
                     attrs.get(key, default))
         fixers[name]._priority = int(fixers[name]._priority)
+        fixers[name]._metadata = stringutil.parsebool(fixers[name]._metadata)
         fixers[name]._skipclean = stringutil.parsebool(fixers[name]._skipclean)
         # Don't use a fixer if it has no pattern configured. It would be
         # dangerous to let it affect all files. It would be pointless to let it