obsexc: add support for evoext_pushobsmarkers_0 on localpeer
This will unify the behavior of exchange in the tests.
--- a/hgext/evolve.py Wed Aug 27 17:24:40 2014 +0200
+++ b/hgext/evolve.py Wed Aug 27 17:25:18 2014 +0200
@@ -2503,6 +2503,26 @@
self.ui.status(_('remote: '), l)
return ret
+@eh.wrapfunction(localrepo.localrepository, '_restrictcapabilities')
+def local_pushobsmarker_capabilities(orig, repo, caps):
+ caps = orig(repo, caps)
+ caps.add('_evoext_pushobsmarkers_0')
+ return caps
+
+@eh.addattr(localrepo.localpeer, 'evoext_pushobsmarkers_0')
+def local_pushobsmarkers(peer, obsfile):
+ data = obsfile.read()
+ lock = peer._repo.lock()
+ try:
+ tr = peer._repo.transaction('pushkey: obsolete markers')
+ try:
+ peer._repo.obsstore.mergemarkers(tr, data)
+ tr.close()
+ finally:
+ tr.release()
+ finally:
+ lock.release()
+ peer._repo.hook('evolve_pushobsmarkers')
def srv_pushobsmarkers(repo, proto):
"""wireprotocol command"""