diff mercurial/commands.py @ 27885:2370c66110cb

commands: teach debugbundle to print bundle specification This seems like the most logical place to put this functionality. Test coverage over existing known bundle specs has been added.
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 14 Jan 2016 22:57:55 -0800
parents acfe40eb8cb5
children a30b582b8be4
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Jan 14 21:27:53 2016 -0800
+++ b/mercurial/commands.py	Thu Jan 14 22:57:55 2016 -0800
@@ -2007,12 +2007,18 @@
         release(tr, lock)
 
 @command('debugbundle',
-        [('a', 'all', None, _('show all details'))],
+        [('a', 'all', None, _('show all details')),
+         ('', 'spec', None, _('print the bundlespec of the bundle'))],
         _('FILE'),
         norepo=True)
-def debugbundle(ui, bundlepath, all=None, **opts):
+def debugbundle(ui, bundlepath, all=None, spec=None, **opts):
     """lists the contents of a bundle"""
     with hg.openpath(ui, bundlepath) as f:
+        if spec:
+            spec = exchange.getbundlespec(ui, f)
+            ui.write('%s\n' % spec)
+            return
+
         gen = exchange.readbundle(ui, f, bundlepath)
         if isinstance(gen, bundle2.unbundle20):
             return _debugbundle2(ui, gen, all=all, **opts)