--- a/mercurial/hgweb/protocol.py Sun May 24 02:56:03 2009 -0500
+++ b/mercurial/hgweb/protocol.py Sat May 23 17:02:49 2009 +0200
@@ -5,7 +5,7 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2, incorporated herein by reference.
-import cStringIO, zlib, tempfile, errno, os, sys
+import cStringIO, zlib, tempfile, errno, os, sys, urllib
from mercurial import util, streamclone
from mercurial.node import bin, hex
from mercurial import changegroup as changegroupmod
@@ -17,6 +17,7 @@
__all__ = [
'lookup', 'heads', 'branches', 'between', 'changegroup',
'changegroupsubset', 'capabilities', 'unbundle', 'stream_out',
+ 'branchmap',
]
HGTYPE = 'application/mercurial-0.1'
@@ -37,6 +38,17 @@
req.respond(HTTP_OK, HGTYPE, length=len(resp))
yield resp
+def branchmap(repo, req):
+ branches = repo.branchmap()
+ heads = []
+ for branch, nodes in branches.iteritems():
+ branchname = urllib.quote(branch)
+ branchnodes = [hex(node) for node in nodes]
+ heads.append('%s %s' % (branchname, ' '.join(branchnodes)))
+ resp = '\n'.join(heads)
+ req.respond(HTTP_OK, HGTYPE, length=len(resp))
+ yield resp
+
def branches(repo, req):
nodes = []
if 'nodes' in req.form:
@@ -97,7 +109,7 @@
yield z.flush()
def capabilities(repo, req):
- caps = ['lookup', 'changegroupsubset']
+ caps = ['lookup', 'changegroupsubset', 'branchmap']
if repo.ui.configbool('server', 'uncompressed', untrusted=True):
caps.append('stream=%d' % repo.changelog.version)
if changegroupmod.bundlepriority: