Patchwork D5468: narrow: replace "ui.warn(); return 1" by "raise error.Abort()"

login
register
mail settings
Submitter phabricator
Date Dec. 20, 2018, 7:01 p.m.
Message ID <7c1e8d9b7f8413efd86ba36c0366b1ae@localhost.localdomain>
Download mbox | patch
Permalink /patch/37286/
State Not Applicable
Headers show

Comments

phabricator - Dec. 20, 2018, 7:01 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6e574b5f158c: narrow: replace &quot;ui.warn(); return 1&quot; by &quot;raise error.Abort()&quot; (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5468?vs=12932&id=12935

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

AFFECTED FILES
  hgext/narrow/narrowcommands.py
  tests/test-narrow-trackedcmd.t

CHANGE DETAILS




To: martinvonz, durin42, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/tests/test-narrow-trackedcmd.t b/tests/test-narrow-trackedcmd.t
--- a/tests/test-narrow-trackedcmd.t
+++ b/tests/test-narrow-trackedcmd.t
@@ -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
 
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -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')