##// END OF EJS Templates
narrowwirepeer: rename expandnarrow capability to exp-expandnarrow...
Augie Fackler -
r36118:22ed16ca default
parent child Browse files
Show More
@@ -1,51 +1,51 b''
1 1 # narrowwirepeer.py - passes narrow spec with unbundle command
2 2 #
3 3 # Copyright 2017 Google, Inc.
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 from mercurial.i18n import _
11 11 from mercurial import (
12 12 error,
13 13 extensions,
14 14 hg,
15 15 node,
16 16 )
17 17
18 18 from . import narrowspec
19 19
20 20 def uisetup():
21 21 def peersetup(ui, peer):
22 22 # We must set up the expansion before reposetup below, since it's used
23 23 # at clone time before we have a repo.
24 24 class expandingpeer(peer.__class__):
25 25 def expandnarrow(self, narrow_include, narrow_exclude, nodes):
26 26 ui.status(_("expanding narrowspec\n"))
27 if not self.capable('expandnarrow'):
27 if not self.capable('exp-expandnarrow'):
28 28 raise error.Abort(
29 29 'peer does not support expanding narrowspecs')
30 30
31 31 hex_nodes = (node.hex(n) for n in nodes)
32 32 new_narrowspec = self._call(
33 33 'expandnarrow',
34 34 includepats=','.join(narrow_include),
35 35 excludepats=','.join(narrow_exclude),
36 36 nodes=','.join(hex_nodes))
37 37
38 38 return narrowspec.parseserverpatterns(new_narrowspec)
39 39 peer.__class__ = expandingpeer
40 40 hg.wirepeersetupfuncs.append(peersetup)
41 41
42 42 def reposetup(repo):
43 43 def wirereposetup(ui, peer):
44 44 def wrapped(orig, cmd, *args, **kwargs):
45 45 if cmd == 'unbundle':
46 46 include, exclude = repo.narrowpats
47 47 kwargs["includepats"] = ','.join(include)
48 48 kwargs["excludepats"] = ','.join(exclude)
49 49 return orig(cmd, *args, **kwargs)
50 50 extensions.wrapfunction(peer, '_calltwowaystream', wrapped)
51 51 hg.wirepeersetupfuncs.append(wirereposetup)
General Comments 0
You need to be logged in to leave comments. Login now