mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
fastannotate: support remotefilelog
Summary: In order to support remotefilelog, do not construct `mercurial.context.context` object directly. This reverts a previous attempt to use the fastest manifest look up - `ctx[path]` actually seems good enough. A minor change is made in `protocol.py` to ignore failed requests. Test Plan: Run existing tests Reviewers: #sourcecontrol, rmcelroy Reviewed By: rmcelroy Subscribers: mjpieters Differential Revision: https://phabricator.intern.facebook.com/D4127025 Signature: t1:4127025:1478541481:c15477332582e2c9b22e2732e9e76bf37b5fba74
This commit is contained in:
parent
1e067cbd84
commit
855af710bb
@ -13,7 +13,6 @@ import hashlib
|
||||
import os
|
||||
|
||||
from mercurial import (
|
||||
context as hgcontext,
|
||||
error,
|
||||
lock as lockmod,
|
||||
mdiff,
|
||||
@ -98,21 +97,7 @@ def resolvefctx(repo, rev, path, resolverev=False, adjustctx=None):
|
||||
ctx = _revsingle(repo, rev)
|
||||
else:
|
||||
ctx = repo[rev]
|
||||
# special handling working copy context
|
||||
if ctx.rev() is None:
|
||||
return ctx[path]
|
||||
# manifest.find is optimized for single file resolution. use it instead
|
||||
# of manifest.get or ctx.__getitem__ or ctx.filectx for better performance.
|
||||
# note: this is kind of reinventing ctx.filectx.
|
||||
try:
|
||||
fnode, flag = ctx.manifest().find(path)
|
||||
except KeyError:
|
||||
raise error.ManifestLookupError(rev, path, _('not found in manifest'))
|
||||
# TODO: remotefilelog compatibility - remotefilelog does not have a real
|
||||
# filelog - need a different approach
|
||||
flog = _getflog(repo, path)
|
||||
fctx = hgcontext.filectx(repo, path, fileid=fnode, filelog=flog,
|
||||
changeid=ctx.rev(), changectx=ctx)
|
||||
fctx = ctx[path]
|
||||
if adjustctx is not None:
|
||||
if adjustctx == 'linkrev':
|
||||
introrev = fctx.linkrev()
|
||||
|
@ -143,6 +143,8 @@ def clientfetch(repo, paths, lastnodemap=None, peer=None):
|
||||
|
||||
ui.debug('fastannotate: server returned\n')
|
||||
for result in results:
|
||||
if result.value is None:
|
||||
continue
|
||||
for path, content in result.value.iteritems():
|
||||
# ignore malicious paths
|
||||
if not path.startswith('fastannotate/') or '/../' in (path + '/'):
|
||||
|
@ -18,7 +18,7 @@ Obtaining the test runners
|
||||
If you do not already have a copy of the Mercurial repository, you can obtains
|
||||
one with:
|
||||
|
||||
$ hg clone http://selenic.com/hg/
|
||||
$ hg clone http://mercurial-scm.org/hg
|
||||
|
||||
Running against various Mercurial versions
|
||||
------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user