Mercurial > evolve
changeset 6828:90f867d5be22
topic: make hg branch command output FQBN
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sun, 19 Nov 2023 23:00:11 -0300 |
parents | eb8a648d90de |
children | 3977624060dc |
files | hgext3rd/topic/__init__.py tests/test-namespaces.t tests/test-split.t tests/test-stack-branch.t |
diffstat | 4 files changed, 24 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Fri Nov 03 15:11:06 2023 -0300 +++ b/hgext3rd/topic/__init__.py Sun Nov 19 23:00:11 2023 -0300 @@ -583,6 +583,8 @@ extensions.wrapcommand(commands.table, b'summary', wrap_summary) + extensions.wrapcommand(commands.table, b'branch', wrap_branch_cmd) + try: evolve = extensions.find(b'evolve') extensions.wrapfunction(evolve.rewriteutil, "presplitupdate", @@ -1740,6 +1742,12 @@ with configoverride: return orig(ui, repo, node=node, rev=rev, *args, **kwargs) +def wrap_branch_cmd(orig, ui, repo, label=None, **opts): + if not opts.get('clean') and not label and not opts.get('rev'): + ui.write(b'%s\n' % repo[None].fqbn()) + return + return orig(ui, repo, label=label, **opts) + def _fixrebase(loaded): if not loaded: return
--- a/tests/test-namespaces.t Fri Nov 03 15:11:06 2023 -0300 +++ b/tests/test-namespaces.t Sun Nov 19 23:00:11 2023 -0300 @@ -33,6 +33,9 @@ $ hg log -r 'wdir()' -T '{fqbn}\n' default//space-name/feature + $ hg branch + default//space-name/feature + Non-ascii topic namespace name $ hg debug-topic-namespace --clear @@ -94,6 +97,8 @@ $ hg log -r . -T '{rev}: {join(extras, " ")}\n' 0: branch=stable topic=feature topic-namespace=alice + $ hg branch + stable//alice/feature $ hg branches stable//alice/feature 0:69c7dbf6acd1 @@ -115,6 +120,10 @@ $ hg up null 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg log -r 'wdir()' -T '{fqbn}\n' + default + $ hg branch + default $ hg debug-topic-namespace none $ test -f .hg/topic-namespace @@ -127,6 +136,10 @@ switching to topic-namespace alice switching to topic feature 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg log -r 'wdir()' -T '{fqbn}\n' + stable//alice/feature + $ hg branch + stable//alice/feature $ hg debug-topic-namespace alice $ cat .hg/topic-namespace
--- a/tests/test-split.t Fri Nov 03 15:11:06 2023 -0300 +++ b/tests/test-split.t Sun Nov 19 23:00:11 2023 -0300 @@ -633,7 +633,7 @@ summary: split10 $ hg branch - another-branch + another-branch//mynamespace/mytopic $ hg split -r tip << EOF > Y @@ -656,7 +656,7 @@ [250] $ hg branch - another-branch + another-branch//mynamespace/mytopic $ hg log -G -l 2 o changeset: 24:cffbaf700768