Patchwork [1,of,4] push: explicitly encode a list of obsmarkers to push

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 6, 2014, 12:07 a.m.
Message ID <ce55e0fa6279db4e80b8.1407283663@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5278/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 6, 2014, 12:07 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1404495109 -7200
#      Fri Jul 04 19:31:49 2014 +0200
# Node ID ce55e0fa6279db4e80b8195308f3df64e6ba70ec
# Parent  2ea6d906cf9b7b7338594bff33dffb7d6a43384f
push: explicitly encode a list of obsmarkers to push

Sending obsmarkers through pushkey requires extra encoding (since pushky can't
take binary content) and slicing (since we can hit http header limit). As we
send all obsolescences markers that exists in the repo for each push, we used to
just look at the content of the "obsolete" pushkey namespace (already encoded
and sliced) and send its
content.

However, future changeset will make it possible to push only parts of the
obsmarkers. To prepare this we now explicitly encode a list of markers. The list
of markers is still "all of them" but future changeset will takes care
of that.

The new code use a "_protected" method but that seems reasonable to keep it
private as this is the is the only external user of it and this whole pushing
obsmarker through pushkey things in fairly hacky already)

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -588,11 +588,11 @@  def _pushobsolete(pushop):
     repo = pushop.repo
     remote = pushop.remote
     if (obsolete._enabled and repo.obsstore and
         'obsolete' in remote.listkeys('namespaces')):
         rslts = []
-        remotedata = repo.listkeys('obsolete')
+        remotedata = obsolete._pushkeyescape(repo.obsstore)
         for key in sorted(remotedata, reverse=True):
             # reverse sort to ensure we end with dump0
             data = remotedata[key]
             rslts.append(remote.pushkey('obsolete', key, '', data))
         if [r for r in rslts if not r]: