changeset 6830:c539a2fb600d

topic: add fqbn method to dirstate to use instead of repo[None].fqbn() This is closer to what `hg branch` does in core.
author Anton Shestakov <av6@dwimlabs.net>
date Tue, 20 Aug 2024 17:01:50 +0400
parents 3977624060dc
children 64056ade712c
files hgext3rd/topic/__init__.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Sun Feb 25 17:55:06 2024 -0300
+++ b/hgext3rd/topic/__init__.py	Tue Aug 20 17:01:50 2024 +0400
@@ -979,6 +979,12 @@
             if ce:
                 ce.refresh()
 
+        def fqbn(self):
+            branch = encoding.tolocal(self._branch)
+            tns = encoding.tolocal(self._tns)
+            topic = encoding.tolocal(self._topic)
+            return common.formatfqbn(branch, tns, topic)
+
     dirstate.dirstate = topicdirstate
 
 templatekeyword = registrar.templatekeyword()
@@ -1744,7 +1750,7 @@
 
 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())
+        ui.write(b'%s\n' % repo.dirstate.fqbn())
         return
     return orig(ui, repo, label=label, **opts)