tests/test-convert-hg-sink.t
author Patrick Mezard <patrick@mezard.eu>
Sat, 28 Apr 2012 15:01:57 +0200
branchstable
changeset 16536 63c817ea4a70
parent 12525 81bf25ddd76a
child 19892 77872b002e73
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:
5278
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     1
12525
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     2
  $ cat >> $HGRCPATH <<EOF
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     3
  > [extensions]
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     4
  > convert=
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     5
  > [convert]
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     6
  > hg.saverev=False
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     7
  > EOF
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     8
  $ hg init orig
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
     9
  $ cd orig
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    10
  $ echo foo > foo
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    11
  $ echo bar > bar
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    12
  $ hg ci -qAm 'add foo and bar'
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    13
  $ hg rm foo
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    14
  $ hg ci -m 'remove foo'
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    15
  $ mkdir foo
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    16
  $ echo file > foo/file
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    17
  $ hg ci -qAm 'add foo/file'
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    18
  $ hg tag some-tag
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    19
  $ hg log
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    20
  changeset:   3:593cbf6fb2b4
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    21
  tag:         tip
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    22
  user:        test
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    23
  date:        Thu Jan 01 00:00:00 1970 +0000
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    24
  summary:     Added tag some-tag for changeset ad681a868e44
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    25
  
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    26
  changeset:   2:ad681a868e44
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    27
  tag:         some-tag
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    28
  user:        test
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    29
  date:        Thu Jan 01 00:00:00 1970 +0000
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    30
  summary:     add foo/file
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    31
  
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    32
  changeset:   1:cbba8ecc03b7
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    33
  user:        test
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    34
  date:        Thu Jan 01 00:00:00 1970 +0000
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    35
  summary:     remove foo
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    36
  
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    37
  changeset:   0:327daa9251fa
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    38
  user:        test
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    39
  date:        Thu Jan 01 00:00:00 1970 +0000
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    40
  summary:     add foo and bar
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    41
  
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    42
  $ cd ..
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    43
  $ hg convert orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    44
  initializing destination new repository
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    45
  scanning source...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    46
  sorting...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    47
  converting...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    48
  3 add foo and bar
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    49
  2 remove foo
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    50
  1 add foo/file
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    51
  0 Added tag some-tag for changeset ad681a868e44
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    52
  $ cd new
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    53
  $ hg out ../orig
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    54
  comparing with ../orig
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    55
  searching for changes
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    56
  no changes found
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    57
  [1]
5278
70e9a527cc61 convert: avoid dirstate checks; add a test
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    58
12525
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    59
dirstate should be empty:
5279
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    60
12525
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    61
  $ hg debugstate
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    62
  $ hg parents -q
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    63
  $ hg up -C
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    64
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    65
  $ hg copy bar baz
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    66
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    67
put something in the dirstate:
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    68
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    69
  $ hg debugstate > debugstate
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    70
  $ grep baz debugstate
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    71
  a   0         -1 unset               baz
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    72
  copy: bar -> baz
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    73
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    74
add a new revision in the original repo
5279
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    75
12525
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    76
  $ cd ../orig
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    77
  $ echo baz > baz
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    78
  $ hg ci -qAm 'add baz'
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    79
  $ cd ..
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    80
  $ hg convert orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    81
  scanning source...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    82
  sorting...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    83
  converting...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    84
  0 add baz
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    85
  $ cd new
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    86
  $ hg out ../orig
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    87
  comparing with ../orig
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    88
  searching for changes
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    89
  no changes found
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    90
  [1]
5279
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
    91
12525
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    92
dirstate should be the same (no output below):
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    93
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    94
  $ hg debugstate > new-debugstate
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    95
  $ diff debugstate new-debugstate
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    96
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    97
no copies
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    98
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
    99
  $ hg up -C
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   100
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   101
  $ hg debugrename baz
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   102
  baz not renamed
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   103
  $ cd ..
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   104
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   105
test tag rewriting
5279
2dbd750b3ddd convert: clear the dirstate before a conversion, invalidate it afterwards
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 5278
diff changeset
   106
12525
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   107
  $ cat > filemap <<EOF
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   108
  > exclude foo
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   109
  > EOF
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   110
  $ hg convert --filemap filemap orig new-filemap 2>&1 | grep -v 'subversion python bindings could not be loaded'
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   111
  initializing destination new-filemap repository
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   112
  scanning source...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   113
  sorting...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   114
  converting...
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   115
  4 add foo and bar
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   116
  3 remove foo
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   117
  2 add foo/file
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   118
  1 Added tag some-tag for changeset ad681a868e44
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   119
  0 add baz
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   120
  $ cd new-filemap
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   121
  $ hg tags
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   122
  tip                                2:6f4fd1df87fb
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   123
  some-tag                           0:ba8636729451
81bf25ddd76a tests: unify test-convert-hg-sink
Matt Mackall <mpm@selenic.com>
parents: 8693
diff changeset
   124
  $ cd ..