rage: include contents of packdirs

Example output:
```
shared packs (files):
---------------------------
/var/cache/hgcache/fbsource/packs:
total 64K
drwxrwsr-x. 2 phillco svnuser 36K Oct 26 14:09 manifests
...

shared packs (trees):
---------------------------
/var/cache/hgcache/fbsource/packs/manifests:
total 741M
-r--r--r--. 1 phillco svnuser 1.8K Oct  9 00:37 0a0d759b468bf3766b1596d133d7dcf5c55db702.dataidx
-r--r--r--. 1 phillco svnuser  77K Oct  9 00:37 0a0d759b468bf3766b1596d133d7dcf5c55db702.datapack
-r--r--r--. 1 phillco svnuser  33K Oct  9 12:54 0b233c54960ad32a75238334b18bdb8176b95dae.dataidx
-r--r--r--. 1 phillco svnuser 1.7M Oct  9 12:54 0b233c54960ad32a75238334b18bdb8176b95dae.datapack
-r--r--r--. 1 phillco svnuser  74K Oct  8 23:40 0b33a64b257bee2583ded9d38f13404f52a33670.dataidx
...

local packs (files):
---------------------------
/data/users/phillco/fbsource/.hg/store/packs/:
total 856K
drwxrwsr-x. 2 phillco svnuser 856K Oct 26 14:14 manifests


local packs (trees):
---------------------------
/data/users/phillco/fbsource/.hg/store/packs/manifests:
total 27M
-r--r--r--. 1 phillco svnuser 1.2K Oct  3 13:37 000004931915fa871abb373503d0e8656f543d59.dataidx
-r--r--r--. 1 phillco svnuser 4.4K Oct  3 13:37 000004931915fa871abb373503d0e8656f543d59.datapack
-r--r--r--. 1 phillco svnuser 1.2K Oct  3 13:34 0009e3182c6268d64a3c6d9cb79ba74a0f5e3fa2.dataidx
-r--r--r--. 1 phillco svnuser 3.1K Oct  3 13:34 0009e3182c6268d64a3c6d9cb79ba74a0f5e3fa2.datapack
...
```

Differential Revision: https://phab.mercurial-scm.org/D1261
This commit is contained in:
Phil Cohen 2017-10-30 20:48:06 -07:00
parent f64fb99447
commit bef53b0ff4
2 changed files with 25 additions and 0 deletions

View File

@ -30,6 +30,11 @@ from phabricator import (
) )
import os, socket, re, tempfile, time, traceback import os, socket, re, tempfile, time, traceback
from remotefilelog import (
constants,
shallowutil
)
cmdtable = {} cmdtable = {}
command = registrar.command(cmdtable) command = registrar.command(cmdtable)
@ -228,6 +233,24 @@ def rage(ui, repo, *pats, **opts):
('hg config (all)', _failsafe(lambda: hgcmd(commands.config))), ('hg config (all)', _failsafe(lambda: hgcmd(commands.config))),
] ]
if util.safehasattr(repo, 'name'):
# Add the contents of both local and shared pack directories.
packlocs = {
'local': lambda category: shallowutil.getlocalpackpath(
repo.svfs.vfs.base, category),
'shared': lambda category: shallowutil.getcachepackpath(repo,
category),
}
for loc, getpath in packlocs.iteritems():
for category in constants.ALL_CATEGORIES:
path = getpath(category)
detailed.append((
"%s packs (%s)" % (loc, constants.getunits(category)),
"%s:\n%s" %
(path, _failsafe(lambda: shcmd("ls -lh %s" % path)))
))
# This is quite slow, so we don't want to do it by default # This is quite slow, so we don't want to do it by default
if ui.configbool("rage", "fastmanifestcached", False): if ui.configbool("rage", "fastmanifestcached", False):
detailed.append( detailed.append(

View File

@ -19,6 +19,8 @@ PATHCOUNTSIZE = struct.calcsize(PATHCOUNTSTRUCT)
FILEPACK_CATEGORY="" FILEPACK_CATEGORY=""
TREEPACK_CATEGORY="manifests" TREEPACK_CATEGORY="manifests"
ALL_CATEGORIES = [FILEPACK_CATEGORY, TREEPACK_CATEGORY]
# revision metadata keys. must be a single character. # revision metadata keys. must be a single character.
METAKEYFLAG = 'f' # revlog flag METAKEYFLAG = 'f' # revlog flag
METAKEYSIZE = 's' # full rawtext size METAKEYSIZE = 's' # full rawtext size