tests/test-issue2137.t
author Adrian Buehlmann <adrian@cadifra.com>
Fri, 10 Sep 2010 17:59:17 +0200
changeset 12204 c55d69c5fb77
parent 11072 tests/test-issue2137@6bbe4886740e
child 12328 b63f6422d2a7
permissions -rw-r--r--
tests: unify test-issue1438 and test-issue2137
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12204
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
     1
# http://mercurial.selenic.com/bts/issue2137
10914
b7ca37b90762 revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
     2
12204
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
     3
Setup:
10914
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
12204
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    11
  $ cat > commitwrapper.py <<EOF
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    12
  > from mercurial import extensions, node, revlog
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    13
  > 
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    14
  > def reposetup(ui, repo):
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    15
  >     def wrapcommit(orig, *args, **kwargs):
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    16
  >         result = orig(*args, **kwargs)
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    17
  >         tip1 = node.short(repo.changelog.tip())
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    18
  >         tip2 = node.short(repo.lookup(tip1))
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    19
  >         assert tip1 == tip2
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    20
  >         ui.write('new tip: %s\n' % tip1)
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    21
  >         return result
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    22
  > 
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    23
  >     extensions.wrapfunction(repo, 'commit', wrapcommit)
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    24
  > 
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    25
  > def extsetup(ui):
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    26
  >     revlog._maxinline = 8             # split out 00changelog.d early
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    27
  >     revlog._prereadsize = 8           # use revlog.lazyparser
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    28
  > EOF
10914
b7ca37b90762 revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    29
12204
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    30
  $ cat >> $HGRCPATH <<EOF
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    31
  > [extensions]
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    32
  > commitwrapper = `pwd`/commitwrapper.py
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    33
  > EOF
10914
b7ca37b90762 revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    34
12204
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    35
  $ hg init repo1
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    36
  $ cd repo1
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    37
  $ echo a > a
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    38
  $ hg commit -A -m'add a with a long commit message to make the changelog a bit bigger'
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    39
  adding a
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    40
  new tip: 553596fad57b
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    41
10914
b7ca37b90762 revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    42
12204
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    43
Test that new changesets are visible to repo.lookup():
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    44
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    45
  $ echo a >> a
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    46
  $ hg commit -m'one more commit to demonstrate the bug'
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    47
  new tip: 799ae3599e0e
10914
b7ca37b90762 revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    48
12204
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    49
  $ hg tip
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    50
  changeset:   1:799ae3599e0e
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    51
  tag:         tip
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    52
  user:        test
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    53
  date:        Thu Jan 01 00:00:00 1970 +0000
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    54
  summary:     one more commit to demonstrate the bug
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    55
  
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    56