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