##// END OF EJS Templates
hgweb/sshserver: extract capabilities for easier modification
Dirkjan Ochtman -
r9713:d193cc97 default
parent child Browse files
Show More
@@ -5,7 +5,7 b''
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2, incorporated herein by reference.
7 7
8 import cStringIO, zlib, tempfile, errno, os, sys, urllib
8 import cStringIO, zlib, tempfile, errno, os, sys, urllib, copy
9 9 from mercurial import util, streamclone
10 10 from mercurial.node import bin, hex
11 11 from mercurial import changegroup as changegroupmod
@@ -21,6 +21,7 b' from common import ErrorResponse, HTTP_O'
21 21 ]
22 22
23 23 HGTYPE = 'application/mercurial-0.1'
24 basecaps = 'lookup changegroupsubset branchmap'.split()
24 25
25 26 def lookup(repo, req):
26 27 try:
@@ -109,7 +110,7 b' def changegroupsubset(repo, req):'
109 110 yield z.flush()
110 111
111 112 def capabilities(repo, req):
112 caps = ['lookup', 'changegroupsubset', 'branchmap']
113 caps = copy.copy(basecaps)
113 114 if repo.ui.configbool('server', 'uncompressed', untrusted=True):
114 115 caps.append('stream=%d' % repo.changelog.version)
115 116 if changegroupmod.bundlepriority:
@@ -9,9 +9,12 b''
9 9 from i18n import _
10 10 from node import bin, hex
11 11 import streamclone, util, hook
12 import os, sys, tempfile, urllib
12 import os, sys, tempfile, urllib, copy
13 13
14 14 class sshserver(object):
15
16 caps = 'unbundle lookup changegroupsubset branchmap'.split()
17
15 18 def __init__(self, ui, repo):
16 19 self.ui = ui
17 20 self.repo = repo
@@ -85,8 +88,7 b' class sshserver(object):'
85 88
86 89 capabilities: space separated list of tokens
87 90 '''
88
89 caps = ['unbundle', 'lookup', 'changegroupsubset', 'branchmap']
91 caps = copy.copy(self.caps)
90 92 if self.ui.configbool('server', 'uncompressed'):
91 93 caps.append('stream=%d' % self.repo.changelog.version)
92 94 self.respond("capabilities: %s\n" % (' '.join(caps),))
General Comments 0
You need to be logged in to leave comments. Login now