@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Speed up diffusion_browsequery for mercurial repositories

Summary:
Ref T4387. By using `hg locate` to attempt to only list files in the given path
browsing diffusion is a bit faster. In a repo of about 600M it shaves a rough 100ms
off viewing the root of the project.

Test Plan: Looked around in diffusion and saw it showed everything including .files, which was nice

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4387

Differential Revision: https://secure.phabricator.com/D8163

authored by

Richard van Velzen and committed by
epriestley
5771d139 df98ea3b

+7 -14
+7 -14
src/applications/diffusion/conduit/ConduitAPI_diffusion_browsequery_Method.php
··· 197 197 $commit = $request->getValue('commit'); 198 198 $result = $this->getEmptyResultSet(); 199 199 200 - // TODO: This is a really really awful mess but Mercurial doesn't offer 201 - // an equivalent of "git ls-files -- directory". If it's any comfort, this 202 - // is what "hgweb" does too, see: 203 - // 204 - // http://selenic.com/repo/hg/file/91dc8878f888/mercurial/hgweb/webcommands.py#l320 205 - // 206 - // derp derp derp derp 207 - // 208 - // Anyway, figure out what's in this path by applying massive amounts 209 - // of brute force. 200 + $match_against = trim($path, '/'); 201 + 202 + $prefix = trim('./'.$match_against, '/'); 210 203 211 204 list($entire_manifest) = $repository->execxLocalCommand( 212 - 'manifest --rev %s', 213 - hgsprintf('%s', $commit)); 214 - $entire_manifest = explode("\n", $entire_manifest); 205 + 'locate --print0 --rev %s -I %s', 206 + hgsprintf('%s', $commit), 207 + $prefix); 208 + $entire_manifest = explode("\0", $entire_manifest); 215 209 216 210 $results = array(); 217 211 218 - $match_against = trim($path, '/'); 219 212 $match_len = strlen($match_against); 220 213 221 214 // For the root, don't trim. For other paths, trim the "/" after we match.