Mercurial > hg
changeset 9713:d193cc97c4e8
hgweb/sshserver: extract capabilities for easier modification
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Thu, 05 Nov 2009 11:07:01 +0100 |
parents | 18b134ef294c |
children | 2f1ab7f77ddc |
files | mercurial/hgweb/protocol.py mercurial/sshserver.py |
diffstat | 2 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/protocol.py Thu Nov 05 10:44:36 2009 +0100 +++ b/mercurial/hgweb/protocol.py Thu Nov 05 11:07:01 2009 +0100 @@ -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 @@ ] HGTYPE = 'application/mercurial-0.1' +basecaps = 'lookup changegroupsubset branchmap'.split() def lookup(repo, req): try: @@ -109,7 +110,7 @@ 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:
--- a/mercurial/sshserver.py Thu Nov 05 10:44:36 2009 +0100 +++ b/mercurial/sshserver.py Thu Nov 05 11:07:01 2009 +0100 @@ -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 @@ 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),))