Debian Codegraph @

tests/test-issue2137.t

raw
1 https://bz.mercurial-scm.org/2137
2
3 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
11 $ cat > commitwrapper.py <<EOF
12 > from mercurial import extensions, node, revlog
13 >
14 > def reposetup(ui, repo):
15 > class wraprepo(repo.__class__):
16 > def commit(self, *args, **kwargs):
17 > result = super(wraprepo, self).commit(*args, **kwargs)
18 > tip1 = node.short(repo.changelog.tip())
19 > tip2 = node.short(repo.lookup(tip1))
20 > assert tip1 == tip2
21 > ui.write(b'new tip: %s\n' % tip1)
22 > return result
23 > repo.__class__ = wraprepo
24 >
25 > def extsetup(ui):
26 > revlog._maxinline = 8 # split out 00changelog.d early
27 > revlog._prereadsize = 8 # use revlog.lazyparser
28 > EOF
29
30 $ cat >> $HGRCPATH <<EOF
31 > [extensions]
32 > commitwrapper = `pwd`/commitwrapper.py
33 > EOF
34
35 $ hg init repo1
36 $ cd repo1
37 $ echo a > a
38 $ hg commit -A -m'add a with a long commit message to make the changelog a bit bigger'
39 adding a
40 new tip: 553596fad57b
41
42 Test that new changesets are visible to repo.lookup():
43
44 $ echo a >> a
45 $ hg commit -m'one more commit to demonstrate the bug'
46 new tip: 799ae3599e0e
47
48 $ hg tip
49 changeset: 1:799ae3599e0e
50 tag: tip
51 user: test
52 date: Thu Jan 01 00:00:00 1970 +0000
53 summary: one more commit to demonstrate the bug
54
55
56 $ cd ..