diff hgext3rd/topic/__init__.py @ 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 ba7ede61f6d4
children c539a2fb600d
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