changeset 793:fa746ef46e8a

fastobs: fix a bunch of stupid errors that prevented it from working at all
author Augie Fackler <raf@durin42.com>
date Fri, 26 Jul 2013 21:35:56 -0400
parents 36d0e71aa9e4
children 089755743050
files hgfastobs.py
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgfastobs.py	Fri Jul 26 16:08:56 2013 -0400
+++ b/hgfastobs.py	Fri Jul 26 21:35:56 2013 -0400
@@ -15,6 +15,7 @@
 """
 import sys
 
+from mercurial import base85
 from mercurial import commands
 from mercurial import extensions
 from mercurial import obsolete
@@ -71,6 +72,8 @@
         '(descendants(precursors(%ln)) or descendants(%ln)) and hidden()',
         outgoing.missing, outgoing.missing)
     transmit = []
+    for node in outgoing.missing:
+        transmit.extend(obsolete.precursormarkers(urepo[node]))
     for node in boxedges:
         transmit.extend(obsolete.successormarkers(urepo[node]))
     xmit, total = len(transmit), len(repo.obsstore._all)
@@ -78,17 +81,23 @@
         'boxpush: about to transmit %d obsolete markers (%d markers total)\n'
         % (xmit, total))
     parts, size, chunk = [], 0, 0
+    def transmitmarks():
+            repo.ui.note(
+                'boxpush: sending a chunk of obsolete markers\n')
+            data = ''.join([obsolete._pack('>B', obsolete._fmversion)] + parts)
+            remote.pushkey('obsolete', 'dump-%d' % chunk, '',
+                           base85.b85encode(data))
+
     for marker in transmit:
         enc = obsolete._encodeonemarker(_markertuple(marker))
         parts.append(enc)
         size += len(enc)
         if size > obsolete._maxpayload:
-            repo.ui.note(
-                'boxpush: sending a chunk of obsolete markers\n')
-            data = ''.join([obsolete._pack('>B', _fmversion)], parts)
-            remote.pushkey('obsolete', 'dump%d' % chunk, base85.b85encode(data))
+            transmitmarks()
             parts, size = [], 0
             chunk += 1
+    if parts:
+        transmitmarks()
 
 def _markertuple(marker):
     return marker._data