D7085: fix: warn when a fixer doesn't have a configured command
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Mon Oct 14 06:39:58 UTC 2019
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
It seems we currently produce an empty command line and then decide to
not run it, but it seems better to skip that part too.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D7085
AFFECTED FILES
hgext/fix.py
tests/test-fix.t
CHANGE DETAILS
diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -1338,6 +1338,8 @@
fixer tool has no pattern configuration: nopattern
$ cat foo bar
foobar (no-eol)
+ $ hg fix --debug --working-dir --config "fix.nocommand:pattern=foo.bar"
+ fixer tool has no command configuration: nocommand
$ cd ..
diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -802,7 +802,11 @@
# dangerous to let it affect all files. It would be pointless to let it
# affect no files. There is no reasonable subset of files to use as the
# default.
- if pattern is None:
+ if command is None:
+ ui.warn(
+ _(b'fixer tool has no command configuration: %s\n') % (name,)
+ )
+ elif pattern is None:
ui.warn(
_(b'fixer tool has no pattern configuration: %s\n') % (name,)
)
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list