# HG changeset patch # User Martin von Zweigbergk # Date 1543039924 28800 # Node ID 74e023f5a92208c67e4d4cc41c834c1a65bab1df # Parent c236a491ab7b7a42b8366bb249814f715a4a9ff8 narrow: replace "ui.warn(); return 1" by "raise error.Abort()" This is the usual way of doing it and I don't see a reason to do it differently here. Differential Revision: https://phab.mercurial-scm.org/D5468 diff -r c236a491ab7b -r 74e023f5a922 hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py Sun Dec 16 00:21:54 2018 -0500 +++ b/hgext/narrow/narrowcommands.py Fri Nov 23 22:12:04 2018 -0800 @@ -365,15 +365,13 @@ """ opts = pycompat.byteskwargs(opts) if repository.NARROW_REQUIREMENT not in repo.requirements: - ui.warn(_('The narrow command is only supported on respositories cloned' - ' with --narrow.\n')) - return 1 + raise error.Abort(_('the narrow command is only supported on ' + 'respositories cloned with --narrow')) # Before supporting, decide whether it "hg tracked --clear" should mean # tracking no paths or all paths. if opts['clear']: - ui.warn(_('The --clear option is not yet supported.\n')) - return 1 + raise error.Abort(_('the --clear option is not yet supported')) # import rules from a file newrules = opts.get('import_rules') diff -r c236a491ab7b -r 74e023f5a922 tests/test-narrow-trackedcmd.t --- a/tests/test-narrow-trackedcmd.t Sun Dec 16 00:21:54 2018 -0500 +++ b/tests/test-narrow-trackedcmd.t Fri Nov 23 22:12:04 2018 -0800 @@ -196,8 +196,8 @@ X path:widest $ hg tracked --import-rules specs --clear - The --clear option is not yet supported. - [1] + abort: the --clear option is not yet supported + [255] Testing with passing a out of wdir file