Show More
@@ -0,0 +1,52 b'' | |||
|
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 |
@@ -0,0 +1,14 b'' | |||
|
1 | % setup | |
|
2 | adding a | |
|
3 | new tip: 685c8b50a4fa | |
|
4 | adding b | |
|
5 | new tip: 0dc3f194257e | |
|
6 | ||
|
7 | % test that new changesets are visible to repo.lookup() | |
|
8 | new tip: 76721648e605 | |
|
9 | changeset: 2:76721648e605 | |
|
10 | tag: tip | |
|
11 | user: test test test test test test test test test test test | |
|
12 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
13 | summary: one more commit to demonstrate the bug | |
|
14 |
@@ -294,8 +294,7 b' class lazymap(object):' | |||
|
294 | 294 | return key in self.p.map |
|
295 | 295 | def __iter__(self): |
|
296 | 296 | yield nullid |
|
297 |
for i in |
|
|
298 | ret = self.p.index[i] | |
|
297 | for i, ret in enumerate(self.p.index): | |
|
299 | 298 | if not ret: |
|
300 | 299 | self.p.loadindex(i) |
|
301 | 300 | ret = self.p.index[i] |
General Comments 0
You need to be logged in to leave comments.
Login now