packs: make debug*pack commands take more paths

Summary:
Previously 'hg debug[data|hist]pack' required passing the filepath without the
suffix (just up to the hash). This was kind of a pain when using tab complete,
and a pain in tests when trying to use 'find' to run hg debugdatapack on a
number of files. Let's make the debug commands more forgiving.

Test Plan: Manual verification

Reviewers: #mercurial, dsyang, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4261586

Signature: t1:4261586:1480705548:1aa5dbe44ed5e29c28a29a8256de12ffee8d7387
This commit is contained in:
Durham Goode 2016-12-02 14:37:53 -08:00
parent fe149d0caa
commit 9514bca8ce

View File

@ -189,6 +189,8 @@ def parsefileblob(path, decompress):
return size, firstnode, mapping
def debugdatapack(ui, path, **opts):
if '.data' in path:
path = path[:path.index('.data')]
dpack = datapack.datapack(path)
node = opts.get('node')
@ -239,6 +241,8 @@ def dumpdeltachain(ui, deltachain, **opts):
len(delta)))
def debughistorypack(ui, path):
if '.hist' in path:
path = path[:path.index('.hist')]
hpack = historypack.historypack(path)
lastfilename = None