narrow: raise StateError when working copy is stale (for detailed exit code)
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 14 Oct 2021 08:58:07 -0700
changeset 48230 7ed0fc687220
parent 48229 db5897321351
child 48231 0524c1359bfc
narrow: raise StateError when working copy is stale (for detailed exit code) Differential Revision: https://phab.mercurial-scm.org/D11663
mercurial/narrowspec.py
tests/test-narrow-share.t
--- a/mercurial/narrowspec.py	Thu Oct 14 15:05:04 2021 +0200
+++ b/mercurial/narrowspec.py	Thu Oct 14 08:58:07 2021 -0700
@@ -299,7 +299,7 @@
     storespec = repo.svfs.tryread(FILENAME)
     wcspec = repo.vfs.tryread(DIRSTATE_FILENAME)
     if wcspec != storespec:
-        raise error.Abort(
+        raise error.StateError(
             _(b"working copy's narrowspec is stale"),
             hint=_(b"run 'hg tracked --update-working-copy'"),
         )
--- a/tests/test-narrow-share.t	Thu Oct 14 15:05:04 2021 +0200
+++ b/tests/test-narrow-share.t	Thu Oct 14 08:58:07 2021 -0700
@@ -100,7 +100,7 @@
   $ hg -R main files
   abort: working copy's narrowspec is stale
   (run 'hg tracked --update-working-copy')
-  [255]
+  [20]
   $ hg -R main tracked --update-working-copy
   not deleting possibly dirty file d3/f
   not deleting possibly dirty file d3/g
@@ -138,7 +138,7 @@
   $ hg -R main files
   abort: working copy's narrowspec is stale
   (run 'hg tracked --update-working-copy')
-  [255]
+  [20]
   $ hg -R main tracked --update-working-copy
 # d1/f, d3/f should be back
   $ hg -R main files
@@ -189,7 +189,7 @@
   $ hg ci -Am test
   abort: working copy's narrowspec is stale
   (run 'hg tracked --update-working-copy')
-  [255]
+  [20]
   $ hg tracked --update-working-copy
   $ hg st
   M d1/f