mercurial/hgweb/protocol.py
changeset 5915 d0576d065993
parent 5598 d534ba1c4eb4
child 5963 5be210afe1b8
equal deleted inserted replaced
5914:8e7796a990c5 5915:d0576d065993
    26     req.httphdr("application/mercurial-0.1", length=len(resp))
    26     req.httphdr("application/mercurial-0.1", length=len(resp))
    27     req.write(resp)
    27     req.write(resp)
    28 
    28 
    29 def branches(web, req):
    29 def branches(web, req):
    30     nodes = []
    30     nodes = []
    31     if req.form.has_key('nodes'):
    31     if 'nodes' in req.form:
    32         nodes = map(bin, req.form['nodes'][0].split(" "))
    32         nodes = map(bin, req.form['nodes'][0].split(" "))
    33     resp = cStringIO.StringIO()
    33     resp = cStringIO.StringIO()
    34     for b in web.repo.branches(nodes):
    34     for b in web.repo.branches(nodes):
    35         resp.write(" ".join(map(hex, b)) + "\n")
    35         resp.write(" ".join(map(hex, b)) + "\n")
    36     resp = resp.getvalue()
    36     resp = resp.getvalue()
    37     req.httphdr("application/mercurial-0.1", length=len(resp))
    37     req.httphdr("application/mercurial-0.1", length=len(resp))
    38     req.write(resp)
    38     req.write(resp)
    39 
    39 
    40 def between(web, req):
    40 def between(web, req):
    41     if req.form.has_key('pairs'):
    41     if 'pairs' in req.form:
    42         pairs = [map(bin, p.split("-"))
    42         pairs = [map(bin, p.split("-"))
    43                  for p in req.form['pairs'][0].split(" ")]
    43                  for p in req.form['pairs'][0].split(" ")]
    44     resp = cStringIO.StringIO()
    44     resp = cStringIO.StringIO()
    45     for b in web.repo.between(pairs):
    45     for b in web.repo.between(pairs):
    46         resp.write(" ".join(map(hex, b)) + "\n")
    46         resp.write(" ".join(map(hex, b)) + "\n")
    52     req.httphdr("application/mercurial-0.1")
    52     req.httphdr("application/mercurial-0.1")
    53     nodes = []
    53     nodes = []
    54     if not web.allowpull:
    54     if not web.allowpull:
    55         return
    55         return
    56 
    56 
    57     if req.form.has_key('roots'):
    57     if 'roots' in req.form:
    58         nodes = map(bin, req.form['roots'][0].split(" "))
    58         nodes = map(bin, req.form['roots'][0].split(" "))
    59 
    59 
    60     z = zlib.compressobj()
    60     z = zlib.compressobj()
    61     f = web.repo.changegroup(nodes, 'serve')
    61     f = web.repo.changegroup(nodes, 'serve')
    62     while 1:
    62     while 1:
    72     bases = []
    72     bases = []
    73     heads = []
    73     heads = []
    74     if not web.allowpull:
    74     if not web.allowpull:
    75         return
    75         return
    76 
    76 
    77     if req.form.has_key('bases'):
    77     if 'bases' in req.form:
    78         bases = [bin(x) for x in req.form['bases'][0].split(' ')]
    78         bases = [bin(x) for x in req.form['bases'][0].split(' ')]
    79     if req.form.has_key('heads'):
    79     if 'heads' in req.form:
    80         heads = [bin(x) for x in req.form['heads'][0].split(' ')]
    80         heads = [bin(x) for x in req.form['heads'][0].split(' ')]
    81 
    81 
    82     z = zlib.compressobj()
    82     z = zlib.compressobj()
    83     f = web.repo.changegroupsubset(bases, heads, 'serve')
    83     f = web.repo.changegroupsubset(bases, heads, 'serve')
    84     while 1:
    84     while 1: