Mercurial > hg > mercurial-crew-with-dirclash
view tests/test-hook @ 2079:ee96ca273f32
New lazy index code for revlogs.
This tunes for large repositories. It does not read the whole
index file in one big chunk, but tries to buffer reads in more
reasonable chunks instead.
Search speeds are improved in two ways. When trying to find a
specific sha hash, it searches from the end of the file backward.
More recent entries are more likely to be relevant, especially the
tip.
Also, this can load only the mapping of nodes to revlog index number.
Loading the map uses less cpu (no struct.unpack) and much less
memory than loading both the map and the index.
This cuts down the time for hg tip on the 80,000 changeset
kernel repo from 1.8s to 3.69s. Most commands the pull a single
rev out of a big index get roughly the same benefit. Commands
that read the whole index are not slower.
author | mason@suse.com |
---|---|
date | Tue, 04 Apr 2006 16:47:12 -0400 |
parents | 7544700fd931 |
children | ff255b41b4aa |
line wrap: on
line source
#!/bin/sh # commit hooks can see env vars hg init a cd a echo "[hooks]" > .hg/hgrc echo 'commit = echo commit hook: n=$HG_NODE p1=$HG_PARENT1 p2=$HG_PARENT2' >> .hg/hgrc echo 'commit.b = echo commit hook b' >> .hg/hgrc echo 'precommit = echo precommit hook: p1=$HG_PARENT1 p2=$HG_PARENT2' >> .hg/hgrc echo 'pretxncommit = echo pretxncommit hook: n=$HG_NODE p1=$HG_PARENT1 p2=$HG_PARENT2; hg -q tip' >> .hg/hgrc echo a > a hg add a hg commit -m a -d "1000000 0" hg clone . ../b cd ../b # changegroup hooks can see env vars echo '[hooks]' > .hg/hgrc echo 'prechangegroup = echo prechangegroup hook' >> .hg/hgrc echo 'changegroup = echo changegroup hook: n=$HG_NODE' >> .hg/hgrc echo 'incoming = echo incoming hook: n=$HG_NODE' >> .hg/hgrc # pretxncommit and commit hooks can see both parents of merge cd ../a echo b >> a hg commit -m a1 -d "1 0" hg update -C 0 echo b > b hg add b hg commit -m b -d '1 0' hg update -m 1 hg commit -m merge -d '2 0' cd ../b hg pull ../a # tag hooks can see env vars cd ../a echo 'pretag = echo pretag hook: t=$HG_TAG n=$HG_NODE l=$HG_LOCAL' >> .hg/hgrc echo 'tag = echo tag hook: t=$HG_TAG n=$HG_NODE l=$HG_LOCAL' >> .hg/hgrc hg tag -d '3 0' a hg tag -l la # pretag hook can forbid tagging echo 'pretag.forbid = echo pretag.forbid hook; exit 1' >> .hg/hgrc hg tag -d '4 0' fa hg tag -l fla # pretxncommit hook can see changeset, can roll back txn, changeset # no more there after echo 'pretxncommit.forbid = echo pretxncommit.forbid hook: tip=`hg -q tip`; exit 1' >> .hg/hgrc echo z > z hg add z hg -q tip hg commit -m 'fail' -d '4 0' hg -q tip # precommit hook can prevent commit echo 'precommit.forbid = echo precommit.forbid hook; exit 1' >> .hg/hgrc hg commit -m 'fail' -d '4 0' hg -q tip # prechangegroup hook can prevent incoming changes cd ../b hg -q tip echo '[hooks]' > .hg/hgrc echo 'prechangegroup.forbid = echo prechangegroup.forbid hook; exit 1' >> .hg/hgrc hg pull ../a # pretxnchangegroup hook can see incoming changes, can roll back txn, # incoming changes no longer there after echo '[hooks]' > .hg/hgrc echo 'pretxnchangegroup.forbid = echo pretxnchangegroup.forbid hook: tip=`hg -q tip`; exit 1' >> .hg/hgrc hg pull ../a hg -q tip # outgoing hooks can see env vars rm .hg/hgrc echo '[hooks]' > ../a/.hg/hgrc echo 'preoutgoing = echo preoutgoing hook: s=$HG_SOURCE' >> ../a/.hg/hgrc echo 'outgoing = echo outgoing hook: n=$HG_NODE s=$HG_SOURCE' >> ../a/.hg/hgrc hg pull ../a hg undo # preoutgoing hook can prevent outgoing changes echo 'preoutgoing.forbid = echo preoutgoing.forbid hook; exit 1' >> ../a/.hg/hgrc hg pull ../a exit 0