topic: drop support for accessing csets in branch stack using bxx (issue6119)
authorPulkit Goyal <7895pulkit@gmail.com>
Sat, 27 Apr 2019 01:18:08 +0300
changeset 4628 c4097632a1a3
parent 4626 561e97db1cf7
child 4629 b78707559f1f
topic: drop support for accessing csets in branch stack using bxx (issue6119) When topic extension is enabled and we have some cset whose hash is `b1234`, topic extension thinks that we are accessing 1234 cset in current branch stack. However that's not the case generally. Also I am not sure many people use this bxxx thing. Since we have a generic sxxx way to access csets, let's drop support for accessing csets using bxx which leads to bad behavior. Looking at the tests, we don't show bxxx in hg stack output anymore. I update the test to use sxxx instead of bxxxx.
CHANGELOG
hgext3rd/topic/__init__.py
tests/test-stack-branch.t
--- a/CHANGELOG	Sun Apr 28 00:21:28 2019 -0400
+++ b/CHANGELOG	Sat Apr 27 01:18:08 2019 +0300
@@ -12,6 +12,7 @@
   * evolve: reinstalled compatibility with narrow repositories,
   * evolve: use "unstable" instead of "troubled"
   * evolve: run multiple stabilisation in the same transaction
+  * topic: drop the b# alias. It conflicted with normal hashes.
 
 8.5.1 -- 2019-04-23
 -------------------
--- a/hgext3rd/topic/__init__.py	Sun Apr 28 00:21:28 2019 -0400
+++ b/hgext3rd/topic/__init__.py	Sat Apr 27 01:18:08 2019 +0300
@@ -256,7 +256,6 @@
 
 stackrev = re.compile(r'^s\d+$')
 topicrev = re.compile(r'^t\d+$')
-branchrev = re.compile(r'^b\d+$')
 
 hastopicext = common.hastopicext
 
@@ -279,11 +278,6 @@
         if not tname:
             raise error.Abort(_('cannot resolve "%s": no active topic') % name)
         revs = list(stack.stack(repo, topic=topic))
-    elif branchrev.match(name):
-        ttype = 'branch'
-        idx = int(name[1:])
-        tname = branch = repo[None].branch()
-        revs = list(stack.stack(repo, branch=branch))
 
     if revs is not None:
         try:
@@ -294,7 +288,7 @@
             elif ttype == 'branch':
                 msg = _('cannot resolve "%s": %s "%s" has only %d non-public changesets')
             raise error.Abort(msg % (name, ttype, tname, len(revs) - 1))
-        # b0 or t0 or s0 can be None
+        # t0 or s0 can be None
         if r == -1 and idx == 0:
             msg = _('the %s "%s" has no %s')
             raise error.Abort(msg % (ttype, tname, name))
--- a/tests/test-stack-branch.t	Sun Apr 28 00:21:28 2019 -0400
+++ b/tests/test-stack-branch.t	Sat Apr 27 01:18:08 2019 +0300
@@ -87,14 +87,14 @@
 Test "t#" reference
 -------------------
 
-  $ hg up b2
+  $ hg up s2
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg up foo
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ hg up b42
-  abort: cannot resolve "b42": branch "foo" has only 4 non-public changesets
+  $ hg up s42
+  abort: cannot resolve "s42": branch "foo" has only 4 non-public changesets
   [255]
-  $ hg up b2
+  $ hg up s2
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg summary
   parent: 3:f61adbacd17a 
@@ -132,7 +132,7 @@
   s2@ c_d (current)
   s1: c_c
   s0^ c_b (base)
-  $ hg up b3
+  $ hg up s3
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg stack
   ### target: foo (branch)
@@ -141,7 +141,7 @@
   s2: c_d
   s1: c_c
   s0^ c_b (base)
-  $ hg up b2
+  $ hg up s2
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
 
 Also test the revset:
@@ -294,7 +294,7 @@
   s2@ c_D (current)
   s1: c_c
   s0^ c_b (base)
-  $ hg phase --public b1
+  $ hg phase --public s1
   $ hg stack
   ### target: foo (branch) (2 heads)
   s5: c_h
@@ -308,7 +308,7 @@
 Check that stack doesn't show changeset with a topic
 ----------------------------------------------------
 
-  $ hg topic --rev b4::b5 sometopic
+  $ hg topic --rev s4::s5 sometopic
   changed topic on 2 changesets to "sometopic"
   $ hg stack
   ### target: foo (branch)