tests/test-issue2137.t
author Patrick Mezard <patrick@mezard.eu>
Sat, 28 Apr 2012 15:01:57 +0200
branchstable
changeset 16536 63c817ea4a70
parent 12328 b63f6422d2a7
child 16913 f2719b387380
permissions -rw-r--r--
commit: abort on merge with missing files Here is a script illustrating the previous behaviour: The merge brings a new file 'b' from remote $ hg merge 1 --debug searching for copies back to rev 1 unmatched files in other: b resolving manifests overwrite: False, partial: False ancestor: 07f494440405, local: 540395c44225+, remote: 102a90ea7b4a b: remote created -> g updating: b 1/1 files (100.00%) getting b 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) Delete but do not remove b $ rm b $ hg st ! b The commit succeeds $ hg commit -m merge $ hg parents --template "{rev} {desc|firstline} files: {files}\n" 3 merge files: $ hg st ! b b changes were ignored, but even b existence was ignored $ hg manifest a This happens because localrepo.commitctx() checks the input ctx.files(), which is empty for workingctx.files() only returns added, modified or removed entries, and bypass files/manifest updates completely. So the committed revision manifest is the same as its first parent one, not containing the 'b' file. This patch forces the commit to abort in presence of a merge and missing files. test-merge4.t is modified accordingly as it was introduced to check hg was not just terminating with a traceback (5e9e8b8d2629).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12204
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
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12204
diff changeset
     5
create a little extension that has 3 side-effects:
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12204
diff changeset
     6
1) ensure changelog data is not inlined
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12204
diff changeset
     7
2) make revlog to use lazyparser
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12204
diff changeset
     8
3) test that repo.lookup() works
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12204
diff changeset
     9
1 and 2 are preconditions for the bug; 3 is the bug.
10914
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
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    42
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
    43
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    44
  $ echo a >> a
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    45
  $ 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
    46
  new tip: 799ae3599e0e
10914
b7ca37b90762 revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Greg Ward <greg-hg@gerg.ca>
parents:
diff changeset
    47
12204
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    48
  $ hg tip
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    49
  changeset:   1:799ae3599e0e
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    50
  tag:         tip
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    51
  user:        test
c55d69c5fb77 tests: unify test-issue1438 and test-issue2137
Adrian Buehlmann <adrian@cadifra.com>
parents: 11072
diff changeset
    52
  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
    53
  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
    54