##// END OF EJS Templates
tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann -
r12204:c55d69c5 default
parent child Browse files
Show More
@@ -1,16 +1,23 b''
1 #!/bin/sh
1 # http://mercurial.selenic.com/bts/issue1438
2 "$TESTDIR/hghave" symlink || exit 80
3
2
4 rm -rf a
3 $ "$TESTDIR/hghave" symlink || exit 80
5 hg init a
4
6 cd a
5 $ hg init
7
6
8 ln -s foo link
7 $ ln -s foo link
9 hg add link
8 $ hg add link
10 hg ci -mbad link
9 $ hg ci -mbad link
11 hg rm link
10 $ hg rm link
12 hg ci -mok
11 $ hg ci -mok
13 hg diff -g -r 0:1 > bad.patch
12 $ hg diff -g -r 0:1 > bad.patch
14 hg up 0
13
15 hg import --no-commit bad.patch
14 $ hg up 0
16 hg st
15 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16
17 $ hg import --no-commit bad.patch
18 applying bad.patch
19
20 $ hg status
21 R link
22 ? bad.patch
23
@@ -1,43 +1,56 b''
1 #!/bin/sh
1 # http://mercurial.selenic.com/bts/issue2137
2
2
3 echo "% setup"
3 Setup:
4
4
5 # create a little extension that has 3 side-effects:
5 # create a little extension that has 3 side-effects:
6 # 1) ensure changelog data is not inlined
6 # 1) ensure changelog data is not inlined
7 # 2) make revlog to use lazyparser
7 # 2) make revlog to use lazyparser
8 # 3) test that repo.lookup() works
8 # 3) test that repo.lookup() works
9 # 1 and 2 are preconditions for the bug; 3 is the bug.
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
10
13 def reposetup(ui, repo):
11 $ cat > commitwrapper.py <<EOF
14 def wrapcommit(orig, *args, **kwargs):
12 > from mercurial import extensions, node, revlog
15 result = orig(*args, **kwargs)
13 >
16 tip1 = node.short(repo.changelog.tip())
14 > def reposetup(ui, repo):
17 tip2 = node.short(repo.lookup(tip1))
15 > def wrapcommit(orig, *args, **kwargs):
18 assert tip1 == tip2
16 > result = orig(*args, **kwargs)
19 ui.write('new tip: %s\n' % tip1)
17 > tip1 = node.short(repo.changelog.tip())
20 return result
18 > tip2 = node.short(repo.lookup(tip1))
21
19 > assert tip1 == tip2
22 extensions.wrapfunction(repo, 'commit', wrapcommit)
20 > ui.write('new tip: %s\n' % tip1)
21 > return result
22 >
23 > extensions.wrapfunction(repo, 'commit', wrapcommit)
24 >
25 > def extsetup(ui):
26 > revlog._maxinline = 8 # split out 00changelog.d early
27 > revlog._prereadsize = 8 # use revlog.lazyparser
28 > EOF
23
29
24 def extsetup(ui):
30 $ cat >> $HGRCPATH <<EOF
25 revlog._maxinline = 8 # split out 00changelog.d early
31 > [extensions]
26 revlog._prereadsize = 8 # use revlog.lazyparser
32 > commitwrapper = `pwd`/commitwrapper.py
27 EOF
33 > EOF
28
34
29 cat >> $HGRCPATH <<EOF
35 $ hg init repo1
30 [extensions]
36 $ cd repo1
31 commitwrapper = `pwd`/commitwrapper.py
37 $ echo a > a
32 EOF
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
33
42
34 hg init repo1
43 Test that new changesets are visible to repo.lookup():
35 cd repo1
44
36 echo a > a
45 $ echo a >> a
37 hg commit -A -m'add a with a long commit message to make the changelog a bit bigger'
46 $ hg commit -m'one more commit to demonstrate the bug'
47 new tip: 799ae3599e0e
38
48
39 echo ""
49 $ hg tip
40 echo "% test that new changesets are visible to repo.lookup()"
50 changeset: 1:799ae3599e0e
41 echo a >> a
51 tag: tip
42 hg commit -m'one more commit to demonstrate the bug'
52 user: test
43 hg tip
53 date: Thu Jan 01 00:00:00 1970 +0000
54 summary: one more commit to demonstrate the bug
55
56
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now