equal
deleted
inserted
replaced
13 def dispatch(repo, proto, command): |
13 def dispatch(repo, proto, command): |
14 if command not in commands: |
14 if command not in commands: |
15 return False |
15 return False |
16 func, spec = commands[command] |
16 func, spec = commands[command] |
17 args = proto.getargs(spec) |
17 args = proto.getargs(spec) |
18 proto.respond(func(repo, proto, *args)) |
18 r = func(repo, proto, *args) |
|
19 if r != None: |
|
20 proto.respond(r) |
19 return True |
21 return True |
20 |
22 |
21 def between(repo, proto, pairs): |
23 def between(repo, proto, pairs): |
22 pairs = [map(bin, p.split("-")) for p in pairs.split(" ")] |
24 pairs = [map(bin, p.split("-")) for p in pairs.split(" ")] |
23 r = [] |
25 r = [] |
38 nodes = map(bin, nodes.split(" ")) |
40 nodes = map(bin, nodes.split(" ")) |
39 r = [] |
41 r = [] |
40 for b in repo.branches(nodes): |
42 for b in repo.branches(nodes): |
41 r.append(" ".join(map(hex, b)) + "\n") |
43 r.append(" ".join(map(hex, b)) + "\n") |
42 return "".join(r) |
44 return "".join(r) |
|
45 |
|
46 def changegroup(repo, proto, roots): |
|
47 nodes = map(bin, roots.split(" ")) |
|
48 cg = repo.changegroup(nodes, 'serve') |
|
49 proto.sendchangegroup(cg) |
|
50 |
|
51 def changegroupsubset(repo, proto, bases, heads): |
|
52 bases = [bin(n) for n in bases.split(' ')] |
|
53 heads = [bin(n) for n in heads.split(' ')] |
|
54 cg = repo.changegroupsubset(bases, heads, 'serve') |
|
55 proto.sendchangegroup(cg) |
43 |
56 |
44 def heads(repo, proto): |
57 def heads(repo, proto): |
45 h = repo.heads() |
58 h = repo.heads() |
46 return " ".join(map(hex, h)) + "\n" |
59 return " ".join(map(hex, h)) + "\n" |
47 |
60 |
66 |
79 |
67 commands = { |
80 commands = { |
68 'between': (between, 'pairs'), |
81 'between': (between, 'pairs'), |
69 'branchmap': (branchmap, ''), |
82 'branchmap': (branchmap, ''), |
70 'branches': (branches, 'nodes'), |
83 'branches': (branches, 'nodes'), |
|
84 'changegroup': (changegroup, 'roots'), |
|
85 'changegroupsubset': (changegroupsubset, 'bases heads'), |
71 'heads': (heads, ''), |
86 'heads': (heads, ''), |
72 'listkeys': (listkeys, 'namespace'), |
87 'listkeys': (listkeys, 'namespace'), |
73 'lookup': (lookup, 'key'), |
88 'lookup': (lookup, 'key'), |
74 'pushkey': (pushkey, 'namespace key old new'), |
89 'pushkey': (pushkey, 'namespace key old new'), |
75 } |
90 } |