author | Martin Geisler <mg@lazybytes.net> |
Mon, 17 May 2010 23:11:27 +0200 | |
changeset 11191 | c45a47bc4114 |
parent 11072 | 6bbe4886740e |
permissions | -rwxr-xr-x |
10914
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
1 |
#!/bin/sh |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
2 |
|
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
3 |
echo "% setup" |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
4 |
|
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
5 |
# create a little extension that has 3 side-effects: |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
6 |
# 1) ensure changelog data is not inlined |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
7 |
# 2) make revlog to use lazyparser |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
8 |
# 3) test that repo.lookup() works |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
9 |
# 1 and 2 are preconditions for the bug; 3 is the bug. |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
10 |
cat > commitwrapper.py <<EOF |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
11 |
from mercurial import extensions, node, revlog |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
12 |
|
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
13 |
def reposetup(ui, repo): |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
14 |
def wrapcommit(orig, *args, **kwargs): |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
15 |
result = orig(*args, **kwargs) |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
16 |
tip1 = node.short(repo.changelog.tip()) |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
17 |
tip2 = node.short(repo.lookup(tip1)) |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
18 |
assert tip1 == tip2 |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
19 |
ui.write('new tip: %s\n' % tip1) |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
20 |
return result |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
21 |
|
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
22 |
extensions.wrapfunction(repo, 'commit', wrapcommit) |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
23 |
|
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
24 |
def extsetup(ui): |
10917
bce47e253b61
simplify test-issue2137, make it more portable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10914
diff
changeset
|
25 |
revlog._maxinline = 8 # split out 00changelog.d early |
bce47e253b61
simplify test-issue2137, make it more portable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10914
diff
changeset
|
26 |
revlog._prereadsize = 8 # use revlog.lazyparser |
10914
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
27 |
EOF |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
28 |
|
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
29 |
cat >> $HGRCPATH <<EOF |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
30 |
[extensions] |
11072
6bbe4886740e
test-issue2137: don't use $PWD; use `pwd` instead
Mads Kiilerich <mads@kiilerich.com>
parents:
10917
diff
changeset
|
31 |
commitwrapper = `pwd`/commitwrapper.py |
10914
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
32 |
EOF |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
33 |
|
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
34 |
hg init repo1 |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
35 |
cd repo1 |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
36 |
echo a > a |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
37 |
hg commit -A -m'add a with a long commit message to make the changelog a bit bigger' |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
38 |
|
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
39 |
echo "" |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
40 |
echo "% test that new changesets are visible to repo.lookup()" |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
41 |
echo a >> a |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
42 |
hg commit -m'one more commit to demonstrate the bug' |
b7ca37b90762
revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff
changeset
|
43 |
hg tip |