# HG changeset patch # User Dirkjan Ochtman # Date 2009-11-05 10:07:01 # Node ID d193cc97c4e8f8b4e6e941612cf6a6b11b462db9 # Parent 18b134ef294cdeb49b507f5252f9ee8878f0ccb6 hgweb/sshserver: extract capabilities for easier modification diff --git a/mercurial/hgweb/protocol.py b/mercurial/hgweb/protocol.py --- a/mercurial/hgweb/protocol.py +++ b/mercurial/hgweb/protocol.py @@ -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, urllib +import cStringIO, zlib, tempfile, errno, os, sys, urllib, copy from mercurial import util, streamclone from mercurial.node import bin, hex from mercurial import changegroup as changegroupmod @@ -21,6 +21,7 @@ from common import ErrorResponse, HTTP_O ] HGTYPE = 'application/mercurial-0.1' +basecaps = 'lookup changegroupsubset branchmap'.split() def lookup(repo, req): try: @@ -109,7 +110,7 @@ def changegroupsubset(repo, req): yield z.flush() def capabilities(repo, req): - caps = ['lookup', 'changegroupsubset', 'branchmap'] + caps = copy.copy(basecaps) if repo.ui.configbool('server', 'uncompressed', untrusted=True): caps.append('stream=%d' % repo.changelog.version) if changegroupmod.bundlepriority: diff --git a/mercurial/sshserver.py b/mercurial/sshserver.py --- a/mercurial/sshserver.py +++ b/mercurial/sshserver.py @@ -9,9 +9,12 @@ from i18n import _ from node import bin, hex import streamclone, util, hook -import os, sys, tempfile, urllib +import os, sys, tempfile, urllib, copy class sshserver(object): + + caps = 'unbundle lookup changegroupsubset branchmap'.split() + def __init__(self, ui, repo): self.ui = ui self.repo = repo @@ -85,8 +88,7 @@ class sshserver(object): capabilities: space separated list of tokens ''' - - caps = ['unbundle', 'lookup', 'changegroupsubset', 'branchmap'] + caps = copy.copy(self.caps) if self.ui.configbool('server', 'uncompressed'): caps.append('stream=%d' % self.repo.changelog.version) self.respond("capabilities: %s\n" % (' '.join(caps),))