Anonymous committed 2244ecb

Wrap the existing 'hg branches' command with one that also displays remotebranches.

Comments (0)

Files changed (1)

 import os
 from mercurial import config
+from mercurial import encoding
+from mercurial import extensions
 from mercurial import hg
 from mercurial import node
-from mercurial import ui
 from mercurial import url
 from mercurial import util
+from mercurial import commands
+from mercurial.node import short
 from hgext import schemes
         repo.__class__ = remotebranchesrepo
+def extsetup():
+    def branches(orig, ui, repo, active=False, closed=False):
+        orig(ui, repo, active, closed)
+        hexfunc = ui.debugflag and hex or short
+        tags = sorted(repo._remotebranches.keys())
+        for tag in tags:
+            encodedtag = encoding.tolocal(tag)
+            hn = repo.lookup(tag)
+            rev = str(repo.changelog.rev(hn)).rjust(31 - encoding.colwidth(encodedtag))
+            data = encodedtag, rev, hexfunc(hn)
+            ui.write('%s %s:%s\n' % data)
+    extensions.wrapcommand(commands.table, 'branches', branches)