Patchwork D7618: fix: correct the clang-format example hgrc so that it actually works

login
register
mail settings
Submitter phabricator
Date Dec. 12, 2019, 10:42 p.m.
Message ID <differential-rev-PHID-DREV-qqrcg33e477lvqrkqnqz-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43761/
State Superseded
Headers show

Comments

phabricator - Dec. 12, 2019, 10:42 p.m.
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  There are three changes here:
  
  - Remove -i from `command`, it causes fix to eat your file and empty it out
  - Add `set:` to pattern, otherwise this is interpreted as just a glob
  - Switch `listfile:` to `include:`; `listfile:` is relative to the current working directory, while `include:` is relative to the repo root. This makes it so that you don't receive errors when running outside of the repo root about being unable to find the file.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/examples/fix.hgrc

CHANGE DETAILS




To: spectral, #hg-reviewers
Cc: mercurial-devel
phabricator - Dec. 20, 2019, 12:24 p.m.
This revision is now accepted and ready to land.
pulkit added a comment.
pulkit accepted this revision.


  > Remove -i from command, it causes fix to eat your file and empty it out
  
  We should add a prompt/warning in `hg fix` when it empties the file.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

To: spectral, #hg-reviewers, pulkit
Cc: pulkit, mercurial-devel

Patch

diff --git a/contrib/examples/fix.hgrc b/contrib/examples/fix.hgrc
--- a/contrib/examples/fix.hgrc
+++ b/contrib/examples/fix.hgrc
@@ -1,5 +1,6 @@ 
 [fix]
-clang-format:pattern = (rootglob:**.c or rootglob:**.cc or rootglob:**.h) and not "listfile:contrib/clang-format-ignorelist"
+clang-format:command = clang-format --style file
+clang-format:pattern = set:(rootglob:**.c or rootglob:**.cc or rootglob:**.h) and not "include:contrib/clang-format-ignorelist"
 
 rustfmt:command = rustfmt
 rustfmt:pattern = set:rootglob:**.rs