hgext/simple4server.py
changeset 826 bee5e1105e6c
parent 822 5f5d269278e9
child 852 aa722de36179
equal deleted inserted replaced
825:7671717afef8 826:bee5e1105e6c
    31             tr.release()
    31             tr.release()
    32     finally:
    32     finally:
    33         lock.release()
    33         lock.release()
    34     return wireproto.pushres(0)
    34     return wireproto.pushres(0)
    35 
    35 
       
    36 def srv_pullobsmarkers(repo, proto, others):
       
    37     opts = wireproto.options('', ['heads', 'common'], others)
       
    38     for k, v in opts.iteritems():
       
    39         if k in ('heads', 'common'):
       
    40             opts[k] = wireproto.decodelist(v)
       
    41     obsdata = _getobsmarkersstream(repo, **opts)
       
    42     length = '%20i' % len(obsdata.getvalue())
       
    43     def data():
       
    44         yield length
       
    45         for c in proto.groupchunks(obsdata):
       
    46             yield c
       
    47     return wireproto.streamres(data())
       
    48 
    36 def capabilities(orig, repo, proto):
    49 def capabilities(orig, repo, proto):
    37     """wrapper to advertise new capability"""
    50     """wrapper to advertise new capability"""
    38     caps = orig(repo, proto)
    51     caps = orig(repo, proto)
    39     if obsolete._enabled:
    52     if obsolete._enabled:
    40         caps += ' _evoext_pushobsmarkers_0'
    53         caps += ' _evoext_pushobsmarkers_0'
       
    54         caps += ' _evoext_pullobsmarkers_0'
    41     return caps
    55     return caps
    42 
    56 
    43 def extsetup(ui):
    57 def extsetup(ui):
    44     wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '')
    58     wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '')
       
    59     wireproto.commands['evoext_pullobsmarkers_0'] = (srv_pullobsmarkers, '*')
    45     extensions.wrapfunction(wireproto, 'capabilities', capabilities)
    60     extensions.wrapfunction(wireproto, 'capabilities', capabilities)