[PATCH] obsolete: experimental flag to get debug about obsmarkers exchange

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Apr 14 17:04:49 UTC 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1429026244 14400
#      Tue Apr 14 11:44:04 2015 -0400
# Node ID b36bddb86b281eb6c4abd631c57eec47f6de5198
# Parent  c229ba58b956c7872af7ed220ad5099ea4a6ecf7
obsolete: experimental flag to get debug about obsmarkers exchange

The obsolescence markers exchange is still experimental. We (developer) need
more information about what is going on. I'm adding an experimental flag to add
display the amount of data exchanged during bundle2 exchanges.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1215,11 +1215,15 @@ def handlepushkeyreply(op, inpart):
 
 @parthandler('obsmarkers')
 def handleobsmarker(op, inpart):
     """add a stream of obsmarkers to the repo"""
     tr = op.gettransaction()
-    new = op.repo.obsstore.mergemarkers(tr, inpart.read())
+    markerdata = inpart.read()
+    if op.ui.config('experimental', 'obsmarkers-exchange-debug', False):
+        op.ui.write(('obsmarker-exchange: %i bytes received\n')
+                    % len(markerdata))
+    new = op.repo.obsstore.mergemarkers(tr, markerdata)
     if new:
         op.repo.ui.status(_('%i new obsolescence markers\n') % new)
     op.records.add('obsmarkers', {'new': new})
     if op.reply is not None:
         rpart = op.reply.newpart('reply:obsmarkers')
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -614,10 +614,19 @@ List of both
   cda648ca50f50482b7055c0b0c4c117bba6733d9 3de5eca88c00aa039da7399a220f4a5221faa585 0 (*) {'user': 'test'} (glob)
   cdbce2fbb16313928851e97e0d85413f3f7eb77f ca819180edb99ed25ceafb3e9584ac287e240b00 0 (Thu Jan 01 00:22:17 1970 +0000) {'user': 'test'}
 
 #if serve
 
+Test the debug output for exchange
+----------------------------------
+
+  $ hg pull ../tmpb --config 'experimental.obsmarkers-exchange-debug=True' --config 'experimental.bundle2-exp=True'
+  pulling from ../tmpb
+  searching for changes
+  no changes found
+  obsmarker-exchange: 346 bytes received
+
 check hgweb does not explode
 ====================================
 
   $ hg unbundle $TESTDIR/bundles/hgweb+obs.hg
   adding changesets


More information about the Mercurial-devel mailing list