From bef53b0ff4e236ac4dfd857927ae5dc7aaf33441 Mon Sep 17 00:00:00 2001 From: Phil Cohen Date: Mon, 30 Oct 2017 20:48:06 -0700 Subject: [PATCH] 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 --- hgext3rd/rage.py | 23 +++++++++++++++++++++++ remotefilelog/constants.py | 2 ++ 2 files changed, 25 insertions(+) diff --git a/hgext3rd/rage.py b/hgext3rd/rage.py index b421ebb7b8..14d660e163 100644 --- a/hgext3rd/rage.py +++ b/hgext3rd/rage.py @@ -30,6 +30,11 @@ from phabricator import ( ) import os, socket, re, tempfile, time, traceback +from remotefilelog import ( + constants, + shallowutil +) + cmdtable = {} command = registrar.command(cmdtable) @@ -228,6 +233,24 @@ def rage(ui, repo, *pats, **opts): ('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 if ui.configbool("rage", "fastmanifestcached", False): detailed.append( diff --git a/remotefilelog/constants.py b/remotefilelog/constants.py index de46c1bf9d..b3e9707558 100644 --- a/remotefilelog/constants.py +++ b/remotefilelog/constants.py @@ -19,6 +19,8 @@ PATHCOUNTSIZE = struct.calcsize(PATHCOUNTSTRUCT) FILEPACK_CATEGORY="" TREEPACK_CATEGORY="manifests" +ALL_CATEGORIES = [FILEPACK_CATEGORY, TREEPACK_CATEGORY] + # revision metadata keys. must be a single character. METAKEYFLAG = 'f' # revlog flag METAKEYSIZE = 's' # full rawtext size