mirror of
https://github.com/facebook/sapling.git
synced 2025-01-06 04:43:19 +03:00
remotefilelog: do no build the entire ancestormap in remotefilectx.parents
Summary: While working on a stack, I noticed that `hg amend -e` would sometimes download a lot of history information. For a 4 files change, I saw 738 history entry fetched individually... Looking at the profile, this pointed towards remotefilectx.parents requesting the entire ancestormap. Since that function really only need the nodeinfo, let's only get that. Reviewed By: DurhamG Differential Revision: D17104263 fbshipit-source-id: fae1f673b2d2a641ae4f22d1099317cc5abd8447
This commit is contained in:
parent
243716cdc4
commit
309229fdf5
@ -214,15 +214,14 @@ class remotefilectx(context.filectx):
|
||||
|
||||
def parents(self):
|
||||
repo = self._repo
|
||||
ancestormap = self.ancestormap()
|
||||
|
||||
p1, p2, linknode, copyfrom = ancestormap[self._filenode]
|
||||
p1, p2, linknode, copyfrom = self.getnodeinfo()
|
||||
results = []
|
||||
if p1 != nullid:
|
||||
path = copyfrom or self._path
|
||||
flog = repo.file(path)
|
||||
p1ctx = remotefilectx(
|
||||
repo, path, fileid=p1, filelog=flog, ancestormap=ancestormap
|
||||
repo, path, fileid=p1, filelog=flog, ancestormap=self._ancestormap
|
||||
)
|
||||
if self._descendantrevfastpath or "_changeid" in self.__dict__:
|
||||
p1ctx._descendantrev = self.rev()
|
||||
@ -232,7 +231,7 @@ class remotefilectx(context.filectx):
|
||||
path = self._path
|
||||
flog = repo.file(path)
|
||||
p2ctx = remotefilectx(
|
||||
repo, path, fileid=p2, filelog=flog, ancestormap=ancestormap
|
||||
repo, path, fileid=p2, filelog=flog, ancestormap=self._ancestormap
|
||||
)
|
||||
if self._descendantrevfastpath or "_changeid" in self.__dict__:
|
||||
p2ctx._descendantrev = self.rev()
|
||||
|
@ -29,4 +29,4 @@ Test blame
|
||||
0: x
|
||||
1: y
|
||||
2: z
|
||||
2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob)
|
||||
2 files fetched over 2 fetches - (2 misses, 0.00% hit ratio) over 0.00s
|
||||
|
@ -258,7 +258,7 @@ Case 1: fastlog service calls fails or times out
|
||||
32e6611f6149 xx2-fake-rebased public x
|
||||
0632994590a8 xx public x
|
||||
b292c1e3311f x public x
|
||||
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
|
||||
2 files fetched over 2 fetches - (2 misses, 0.00% hit ratio) over 0.00s
|
||||
|
||||
Case 2: fastlog returns empty results
|
||||
|
||||
@ -321,6 +321,8 @@ Fastlog should never get called on draft commits
|
||||
|
||||
Test linknode fixup logging
|
||||
|
||||
$ clearcache
|
||||
|
||||
Setup extension that logs ui.log linkrevfixup output on the stderr
|
||||
$ cat >> $TESTTMP/uilog.py <<EOF
|
||||
> from edenscm.mercurial import extensions
|
||||
@ -334,6 +336,10 @@ Setup extension that logs ui.log linkrevfixup output on the stderr
|
||||
> msgstr = msg[0] % msg[1:]
|
||||
> self.warn('%s: %s (%s)\n' % (service, msgstr, kwstr))
|
||||
> return orig(self, service, *msg, **opts)
|
||||
> def call_conduit(*args, **kwargs):
|
||||
> return [{'hash': '123456'}]
|
||||
> def conduit_config(*args, **kwargs):
|
||||
> return True
|
||||
> EOF
|
||||
$ cat >> $HGRCPATH <<EOF
|
||||
> [extensions]
|
||||
@ -344,6 +350,7 @@ Silencing stdout because we are interested only in ui.log output
|
||||
$ hg log -f x -T '{node|short} {desc} {phase} {files}\n' > /dev/null
|
||||
linkrevfixup: adjusting linknode (filepath=x, fnode=d4a3ed9310e5bd9887e3bf779da5077efab28216, reponame=master, revs=a5957b6bf0bdeb9b96368bddd2838004ad966b7d, user=test)
|
||||
linkrevfixup: fastlog succeded (elapsed=*, filepath=x, fnode=d4a3ed9310e5bd9887e3bf779da5077efab28216, reponame=master, revs=a5957b6bf0bdeb9b96368bddd2838004ad966b7d, user=test) (glob)
|
||||
2 files fetched over 2 fetches - (2 misses, 0.00% hit ratio) over 0.00s
|
||||
|
||||
Fastlog fails
|
||||
$ cat > $TESTTMP/bad_conduit.py <<EOF
|
||||
@ -357,3 +364,4 @@ Fastlog fails
|
||||
linkrevfixup: adjusting linknode (filepath=x, fnode=d4a3ed9310e5bd9887e3bf779da5077efab28216, reponame=master, revs=a5957b6bf0bdeb9b96368bddd2838004ad966b7d, user=test)
|
||||
linkrevfixup: fastlog failed (error) (elapsed=*, filepath=x, fnode=d4a3ed9310e5bd9887e3bf779da5077efab28216, reponame=master, revs=a5957b6bf0bdeb9b96368bddd2838004ad966b7d, user=test) (glob)
|
||||
linkrevfixup: remotefilelog prefetching succeeded (elapsed=*, filepath=x, fnode=d4a3ed9310e5bd9887e3bf779da5077efab28216, reponame=master, revs=a5957b6bf0bdeb9b96368bddd2838004ad966b7d, user=test) (glob)
|
||||
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over 0.00s
|
||||
|
@ -91,7 +91,7 @@ The history for y has to be refetched from the server.
|
||||
deleting corrupt pack '$TESTTMP/hgcache/master/packs/37db2caec222ca26824a52d6bdc778344e0d1440'
|
||||
xy2
|
||||
xy
|
||||
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob)
|
||||
2 files fetched over 2 fetches - (2 misses, 0.00% hit ratio) over 0.00s
|
||||
|
||||
Next, do the same for local data. This time there is data loss, as there are no more copies
|
||||
of the data available.
|
||||
|
Loading…
Reference in New Issue
Block a user