changeset 1081:dddb8a70437c

obsexc: add support for evoext_pushobsmarkers_0 on localpeer This will unify the behavior of exchange in the tests.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 27 Aug 2014 17:25:18 +0200
parents 41d2555141ea
children 74bc8a0c2c02
files hgext/evolve.py
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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"""