Mercurial > evolve
comparison hgext3rd/topic/__init__.py @ 4628:c4097632a1a3
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.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sat, 27 Apr 2019 01:18:08 +0300 |
parents | 48521a49a07e |
children | 7b986968700b |
comparison
equal
deleted
inserted
replaced
4626:561e97db1cf7 | 4628:c4097632a1a3 |
---|---|
254 return None | 254 return None |
255 context.basectx.topicidx = _contexttopicidx | 255 context.basectx.topicidx = _contexttopicidx |
256 | 256 |
257 stackrev = re.compile(r'^s\d+$') | 257 stackrev = re.compile(r'^s\d+$') |
258 topicrev = re.compile(r'^t\d+$') | 258 topicrev = re.compile(r'^t\d+$') |
259 branchrev = re.compile(r'^b\d+$') | |
260 | 259 |
261 hastopicext = common.hastopicext | 260 hastopicext = common.hastopicext |
262 | 261 |
263 def _namemap(repo, name): | 262 def _namemap(repo, name): |
264 revs = None | 263 revs = None |
277 ttype = 'topic' | 276 ttype = 'topic' |
278 tname = topic = repo.currenttopic | 277 tname = topic = repo.currenttopic |
279 if not tname: | 278 if not tname: |
280 raise error.Abort(_('cannot resolve "%s": no active topic') % name) | 279 raise error.Abort(_('cannot resolve "%s": no active topic') % name) |
281 revs = list(stack.stack(repo, topic=topic)) | 280 revs = list(stack.stack(repo, topic=topic)) |
282 elif branchrev.match(name): | |
283 ttype = 'branch' | |
284 idx = int(name[1:]) | |
285 tname = branch = repo[None].branch() | |
286 revs = list(stack.stack(repo, branch=branch)) | |
287 | 281 |
288 if revs is not None: | 282 if revs is not None: |
289 try: | 283 try: |
290 r = revs[idx] | 284 r = revs[idx] |
291 except IndexError: | 285 except IndexError: |
292 if ttype == 'topic': | 286 if ttype == 'topic': |
293 msg = _('cannot resolve "%s": %s "%s" has only %d changesets') | 287 msg = _('cannot resolve "%s": %s "%s" has only %d changesets') |
294 elif ttype == 'branch': | 288 elif ttype == 'branch': |
295 msg = _('cannot resolve "%s": %s "%s" has only %d non-public changesets') | 289 msg = _('cannot resolve "%s": %s "%s" has only %d non-public changesets') |
296 raise error.Abort(msg % (name, ttype, tname, len(revs) - 1)) | 290 raise error.Abort(msg % (name, ttype, tname, len(revs) - 1)) |
297 # b0 or t0 or s0 can be None | 291 # t0 or s0 can be None |
298 if r == -1 and idx == 0: | 292 if r == -1 and idx == 0: |
299 msg = _('the %s "%s" has no %s') | 293 msg = _('the %s "%s" has no %s') |
300 raise error.Abort(msg % (ttype, tname, name)) | 294 raise error.Abort(msg % (ttype, tname, name)) |
301 return [repo[r].node()] | 295 return [repo[r].node()] |
302 if name not in repo.topics: | 296 if name not in repo.topics: |