diff -r a2c0133006c6 -r fbc51e98cf13 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Sat Sep 01 14:00:41 2018 +0200 +++ b/hgext3rd/topic/__init__.py Mon Sep 03 16:29:02 2018 +0200 @@ -29,8 +29,10 @@ your current topic. Topic is offering you aliases reference to changeset in your current topic -stack as 't#'. For example, 't1' refers to the root of your stack, 't2' to the -second commits, etc. The 'hg stack' command show these number. +stack as 't#'. For example, 's1' refers to the root of your stack, 's2' to the +second commits, etc. The 'hg stack' command show these number. 's0' can be used +to refer to the parent of the topic root. Updating using `hg up s0` will keep +the topic active. Push behavior will change a bit with topic. When pushing to a publishing repository the changesets will turn public and the topic data on them will fade @@ -253,12 +255,23 @@ return None context.basectx.topicidx = _contexttopicidx +stackrev = re.compile(r'^s\d+$') topicrev = re.compile(r'^t\d+$') branchrev = re.compile(r'^b\d+$') def _namemap(repo, name): revs = None - if topicrev.match(name): + if stackrev.match(name): + idx = int(name[1:]) + tname = topic = repo.currenttopic + if topic: + ttype = 'topic' + revs = list(stack.stack(repo, topic=topic)) + else: + ttype = 'branch' + tname = branch = repo[None].branch() + revs = list(stack.stack(repo, branch=branch)) + elif topicrev.match(name): idx = int(name[1:]) ttype = 'topic' tname = topic = repo.currenttopic @@ -1174,7 +1187,7 @@ def checkt0(orig, ui, repo, node=None, rev=None, *args, **kwargs): - thezeros = set(['t0', 'b0']) + thezeros = set(['t0', 'b0', 's0']) backup = repo.ui.backupconfig('_internal', 'keep-topic') try: if node in thezeros or rev in thezeros: