# HG changeset patch # User Anton Shestakov # Date 1700445611 10800 # Node ID 90f867d5be225864b3d4a15d5e3cad973fba40b2 # Parent eb8a648d90dead208b224a43f1ab3e190c141254 topic: make hg branch command output FQBN diff -r eb8a648d90de -r 90f867d5be22 hgext3rd/topic/__init__.py --- 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 diff -r eb8a648d90de -r 90f867d5be22 tests/test-namespaces.t --- 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 diff -r eb8a648d90de -r 90f867d5be22 tests/test-split.t --- 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 diff -r eb8a648d90de -r 90f867d5be22 tests/test-stack-branch.t --- a/tests/test-stack-branch.t Fri Nov 03 15:11:06 2023 -0300 +++ b/tests/test-stack-branch.t Sun Nov 19 23:00:11 2023 -0300 @@ -76,7 +76,7 @@ 'hg stack' lists all changeset on the branch $ hg branch - foo//bar + foo//bar// $ hg stack ### target: foo//bar (branch) s4@ c_f (current)