Patchwork [1,of,2] debugbundle: do not display detailed part data in --quiet mode

login
register
mail settings
Submitter Boris Feld
Date March 14, 2018, 3:37 p.m.
Message ID <894cf14ad5d770100eec.1521041844@FB>
Download mbox | patch
Permalink /patch/29497/
State Accepted
Headers show

Comments

Boris Feld - March 14, 2018, 3:37 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1519229816 -3600
#      Wed Feb 21 17:16:56 2018 +0100
# Node ID 894cf14ad5d770100eecf112cff94c7a7b19679b
# Parent  a88d68dc3ee82993597f3f90527eed8d9c270fdd
# EXP-Topic debug-improvement
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 894cf14ad5d7
debugbundle: do not display detailed part data in --quiet mode

This changeset makes `hg debugbundle` respect --quiet and only display data
about part headers.

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -345,11 +345,14 @@  def _debugbundle2(ui, gen, all=None, **o
         if part.type == 'changegroup':
             version = part.params.get('version', '01')
             cg = changegroup.getunbundler(version, part, 'UN')
-            _debugchangegroup(ui, cg, all=all, indent=4, **opts)
+            if not ui.quiet:
+                _debugchangegroup(ui, cg, all=all, indent=4, **opts)
         if part.type == 'obsmarkers':
-            _debugobsmarkers(ui, part, indent=4, **opts)
+            if not ui.quiet:
+                _debugobsmarkers(ui, part, indent=4, **opts)
         if part.type == 'phase-heads':
-            _debugphaseheads(ui, part, indent=4)
+            if not ui.quiet:
+                _debugphaseheads(ui, part, indent=4)
 
 @command('debugbundle',
         [('a', 'all', None, _('show all details')),
diff --git a/tests/test-debugbundle.t b/tests/test-debugbundle.t
--- a/tests/test-debugbundle.t
+++ b/tests/test-debugbundle.t
@@ -35,6 +35,12 @@  Terse output:
       0e067c57feba1a5694ca4844f05588bb1bf82342
       991a3460af53952d10ec8a295d3d2cc2e5fa9690
 
+Quiet output
+
+  $ hg debugbundle --quiet bundle2.hg
+  Stream params: {}
+  changegroup -- {nbchanges: 2, version: 02}
+
 Verbose output:
 
   $ hg debugbundle --all bundle.hg