Mercurial > hg
comparison tests/test-issue2137 @ 10914:b7ca37b90762 stable
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Previously, it only returned revisions that were in the revlog when it
was originally opened; revisions added since then were invisible.
This broke revlog._partialmatch() and therefore repo.lookup().
(Credit to Benoit Boissinot for simplifying my original test script
and for the actual fix.)
author | Greg Ward <greg-hg@gerg.ca> |
---|---|
date | Wed, 14 Apr 2010 15:06:40 -0400 |
parents | |
children | bce47e253b61 |
comparison
equal
deleted
inserted
replaced
10913:f2ecc5733c89 | 10914:b7ca37b90762 |
---|---|
1 #!/bin/sh | |
2 | |
3 echo "% setup" | |
4 | |
5 # create a little extension that has 3 side-effects: | |
6 # 1) ensure changelog data is not inlined | |
7 # 2) make revlog to use lazyparser | |
8 # 3) test that repo.lookup() works | |
9 # 1 and 2 are preconditions for the bug; 3 is the bug. | |
10 cat > commitwrapper.py <<EOF | |
11 from mercurial import extensions, node, revlog | |
12 | |
13 def reposetup(ui, repo): | |
14 def wrapcommit(orig, *args, **kwargs): | |
15 result = orig(*args, **kwargs) | |
16 tip1 = node.short(repo.changelog.tip()) | |
17 tip2 = node.short(repo.lookup(tip1)) | |
18 assert tip1 == tip2 | |
19 ui.write('new tip: %s\n' % tip1) | |
20 return result | |
21 | |
22 extensions.wrapfunction(repo, 'commit', wrapcommit) | |
23 | |
24 def extsetup(ui): | |
25 revlog._maxinline = 128 # split out 00changelog.d early | |
26 revlog._prereadsize = 128 # use revlog.lazyparser | |
27 EOF | |
28 | |
29 cat >> $HGRCPATH <<EOF | |
30 [extensions] | |
31 commitwrapper = $PWD/commitwrapper.py | |
32 EOF | |
33 | |
34 # use a long username to make sure the changelog is bigger than 128 bytes | |
35 export HGUSER='test test test test test test test test test test test' | |
36 | |
37 hg init repo1 | |
38 cd repo1 | |
39 echo a > a | |
40 hg commit -A -m'add a with a long commit message to make the changelog a bit bigger' | |
41 | |
42 # This commit puts 00changelog.i over the 128-byte threshold to split | |
43 # out 00changelog.d, which is a precondition for reproducing the bug | |
44 # with the next commit. | |
45 echo b > b | |
46 hg commit -A -m'add b and ramble on a bit here too for the same reason' | |
47 | |
48 echo "" | |
49 echo "% test that new changesets are visible to repo.lookup()" | |
50 echo a >> a | |
51 hg commit -m'one more commit to demonstrate the bug' | |
52 hg tip |