This is an archive of the discontinued Mercurial Phabricator instance.

fix: add a config to abort when a fixer tool fails
ClosedPublic

Authored by hooper on Oct 31 2018, 4:16 PM.

Details

Summary

This allows users to stop and address tool failures before proceeding, instead
of the default behavior of continuing to apply any tools that didn't fail. For
example, a code formatting tool could fail if you have syntax errors, and you
might want your repo to stay in its current state while you fix the syntax
error before re-running 'hg fix'. It's conceivable that this would even be
necessary for the correctness of some fixer tools across a chain of revisions.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

hooper created this revision.Oct 31 2018, 4:16 PM
yuja added a subscriber: yuja.Nov 2 2018, 9:32 PM

Looks good, but test-check-config.t failed probably because the doc couldn't
be found by the checker.

@@ -464,9 +488,14 @@

    showstderr(ui, fixctx.rev(), fixername, stderr)
if proc.returncode == 0:
    newdata = newerdata
  • elif not stderr:
  • showstderr(ui, fixctx.rev(), fixername,
  • _('exited with status %d\n') % (proc.returncode,))

+ else:
+ if not stderr:
+ message = _('exited with status %d\n') % (proc.returncode,)
+ showstderr(ui, fixctx.rev(), fixername, message)
+ checktoolfailureaction(
+ ui, _('no fixes will be applied'),
+ hint=_('use --config fix.failure=continue to apply any '
+ 'successful fixes anyway'))

This runs after fork(), but it should work as long as no user interaction is
required.

hooper updated this revision to Diff 12435.Nov 5 2018, 6:49 PM
hooper added a comment.Nov 5 2018, 6:50 PM
In D5200#77865, @yuja wrote:

Looks good, but test-check-config.t failed probably because the doc couldn't
be found by the checker.

Looks like it's picky about whitespace.

This revision was automatically updated to reflect the committed changes.