comparison hgext3rd/topic/__init__.py @ 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 90f867d5be22
children 12a031f3587f
comparison
equal deleted inserted replaced
6829:3977624060dc 6830:c539a2fb600d
976 else: 976 else:
977 vfs.tryunlink(b'topic-namespace') 977 vfs.tryunlink(b'topic-namespace')
978 ce = self._filecache[b'_tns'] 978 ce = self._filecache[b'_tns']
979 if ce: 979 if ce:
980 ce.refresh() 980 ce.refresh()
981
982 def fqbn(self):
983 branch = encoding.tolocal(self._branch)
984 tns = encoding.tolocal(self._tns)
985 topic = encoding.tolocal(self._topic)
986 return common.formatfqbn(branch, tns, topic)
981 987
982 dirstate.dirstate = topicdirstate 988 dirstate.dirstate = topicdirstate
983 989
984 templatekeyword = registrar.templatekeyword() 990 templatekeyword = registrar.templatekeyword()
985 991
1742 with configoverride: 1748 with configoverride:
1743 return orig(ui, repo, node=node, rev=rev, *args, **kwargs) 1749 return orig(ui, repo, node=node, rev=rev, *args, **kwargs)
1744 1750
1745 def wrap_branch_cmd(orig, ui, repo, label=None, **opts): 1751 def wrap_branch_cmd(orig, ui, repo, label=None, **opts):
1746 if not opts.get('clean') and not label and not opts.get('rev'): 1752 if not opts.get('clean') and not label and not opts.get('rev'):
1747 ui.write(b'%s\n' % repo[None].fqbn()) 1753 ui.write(b'%s\n' % repo.dirstate.fqbn())
1748 return 1754 return
1749 return orig(ui, repo, label=label, **opts) 1755 return orig(ui, repo, label=label, **opts)
1750 1756
1751 def _fixrebase(loaded): 1757 def _fixrebase(loaded):
1752 if not loaded: 1758 if not loaded: