Patchwork [2,of,5,v4] debugcommands: pass part, not read data, into _debugobsmarker()

login
register
mail settings
Submitter via Mercurial-devel
Date June 23, 2017, 8:17 p.m.
Message ID <b89dd86e628a70a6dc3c.1498249059@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/21654/
State Accepted
Headers show

Comments

via Mercurial-devel - June 23, 2017, 8:17 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1498151715 25200
#      Thu Jun 22 10:15:15 2017 -0700
# Node ID b89dd86e628a70a6dc3cc8bc9de13b933eaa1643
# Parent  75f126ed313986c1fe6380a031a131f69c49b0fd
debugcommands: pass part, not read data, into _debugobsmarker()

This matches how it's done for _debugchangegroup() and how we will
soon do it for _debugphaseheads().

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -289,8 +289,9 @@ 
             ui.write("%s%s\n" % (indent_string, hex(node)))
             chain = node
 
-def _debugobsmarkers(ui, data, indent=0, **opts):
+def _debugobsmarkers(ui, part, indent=0, **opts):
     """display version and markers contained in 'data'"""
+    data = part.read()
     indent_string = ' ' * indent
     try:
         version, markers = obsolete._readmarkers(data)
@@ -325,7 +326,7 @@ 
             cg = changegroup.getunbundler(version, part, 'UN')
             _debugchangegroup(ui, cg, all=all, indent=4, **opts)
         if part.type == 'obsmarkers':
-            _debugobsmarkers(ui, part.read(), indent=4, **opts)
+            _debugobsmarkers(ui, part, indent=4, **opts)
 
 @command('debugbundle',
         [('a', 'all', None, _('show all details')),