Mercurial > evolve
changeset 6245:a54db3e55c88
topic: switch to namespace when updating to a commit, similar to topic
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Mon, 23 May 2022 14:02:54 +0400 |
parents | 945d27da146c |
children | fc60328270ac |
files | hgext3rd/topic/__init__.py tests/test-namespaces.t |
diffstat | 2 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Thu May 26 14:16:58 2022 +0400 +++ b/hgext3rd/topic/__init__.py Mon May 23 14:02:54 2022 +0400 @@ -1468,16 +1468,22 @@ # if rebase is running and update the currenttopic to topic of new # rebased commit. We have explicitly stored in config if rebase is # running. + otns = repo.currenttns ot = repo.currenttopic if repo.ui.hasconfig(b'experimental', b'topicrebase'): isrebase = True if repo.ui.configbool(b'_internal', b'keep-topic'): ist0 = True if ((not partial and not branchmerge) or isrebase) and not ist0: + tns = b'default' t = b'' pctx = repo[node] if pctx.phase() > phases.public: + tns = pctx.topic_namespace() t = pctx.topic() + repo.vfs.write(b'topic-namespace', tns) + if tns != b'default' and tns != otns: + repo.ui.status(_(b"switching to topic-namespace %s\n") % tns) repo.vfs.write(b'topic', t) if t and t != ot: repo.ui.status(_(b"switching to topic %s\n") % t)
--- a/tests/test-namespaces.t Thu May 26 14:16:58 2022 +0400 +++ b/tests/test-namespaces.t Mon May 23 14:02:54 2022 +0400 @@ -45,6 +45,23 @@ $ hg log -r . -T '{rev}: {fqbn}\n' 0: stable//alice/feature +Updating to a revision with a namespace should activate it + + $ hg up null + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg debug-topic-namespace + default + $ hg topics + feature (1 changesets) + $ hg up 0 + switching to topic-namespace alice + switching to topic feature + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg debug-topic-namespace + alice + $ hg topics + * feature (1 changesets) + Parsing $ hg debugparsefqbn foo/bar//user26/feature -T '[{branch}] <{topic_namespace}> ({topic})\n'