##// END OF EJS Templates
pushkey: add pushkey core
Matt Mackall -
r11367:ca4fc993 default
parent child Browse files
Show More
@@ -0,0 +1,31 b''
1 # pushkey.py - dispatching for pushing and pulling keys
2 #
3 # Copyright 2010 Matt Mackall <mpm@selenic.com>
4 #
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
7
8 def _nslist(repo):
9 n = {}
10 for k in _namespaces:
11 n[k] = ""
12 return n
13
14 _namespaces = {"namespaces": (lambda *x: False, _nslist)}
15
16 def register(namespace, pushkey, listkeys):
17 _namespaces[namespace] = (pushkey, listkeys)
18
19 def _get(namespace):
20 return _namespaces.get(namespace, (lambda *x: False, lambda *x: {}))
21
22 def push(repo, namespace, key, old, new):
23 '''should succeed iff value was old'''
24 pk = _get(namespace)[0]
25 return pk(repo, key, old, new)
26
27 def list(repo, namespace):
28 '''return a dict'''
29 lk = _get(namespace)[1]
30 return lk(repo)
31
General Comments 0
You need to be logged in to leave comments. Login now