tests/test-add.t
author Matt Mackall <mpm@selenic.com>
Thu, 12 Jan 2012 14:39:02 -0600
changeset 15858 14132a55d66b
parent 15524 e7119b091809
child 16875 ee9bd7ef0a0e
permissions -rw-r--r--
run-tests: use a list comprehension instead of map
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15444
e1f05d7a8c7b tests: use 'hghave no-windows' to avoid testing reserved file names on windows
Mads Kiilerich <mads@kiilerich.com>
parents: 13962
diff changeset
     1
  $ "$TESTDIR/hghave" no-windows || exit 80
e1f05d7a8c7b tests: use 'hghave no-windows' to avoid testing reserved file names on windows
Mads Kiilerich <mads@kiilerich.com>
parents: 13962
diff changeset
     2
11795
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
     3
  $ hg init a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
     4
  $ cd a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
     5
  $ echo a > a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
     6
  $ hg add -n
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
     7
  adding a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
     8
  $ hg st
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
     9
  ? a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    10
  $ hg add
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    11
  adding a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    12
  $ hg st
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    13
  A a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    14
  $ hg forget a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    15
  $ hg add
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    16
  adding a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    17
  $ hg st
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    18
  A a
5207
212de429e000 make hg add of a removed file unremove the file
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    19
11795
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    20
  $ echo b > b
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    21
  $ hg add -n b
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    22
  $ hg st
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    23
  A a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    24
  ? b
12365
22f3353bcc36 tests: cleanup exit code handling in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
    25
  $ hg add b
11795
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    26
  $ hg st
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    27
  A a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    28
  A b
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    29
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    30
should fail
5207
212de429e000 make hg add of a removed file unremove the file
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    31
11795
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    32
  $ hg add b
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    33
  b already tracked!
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    34
  $ hg st
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    35
  A a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    36
  A b
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    37
13962
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    38
  $ echo foo > con.xml
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    39
  $ hg --config ui.portablefilenames=jump add con.xml
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    40
  abort: ui.portablefilenames value is invalid ('jump')
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    41
  [255]
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    42
  $ hg --config ui.portablefilenames=abort add con.xml
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    43
  abort: filename contains 'con', which is reserved on Windows: 'con.xml'
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    44
  [255]
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    45
  $ hg st
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    46
  A a
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    47
  A b
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    48
  ? con.xml
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    49
  $ hg add con.xml
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    50
  warning: filename contains 'con', which is reserved on Windows: 'con.xml'
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    51
  $ hg st
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    52
  A a
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    53
  A b
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    54
  A con.xml
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    55
  $ echo bla > 'hello:world'
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    56
  $ hg --config ui.portablefilenames=abort add
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    57
  adding hello:world
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    58
  abort: filename contains ':', which is reserved on Windows: 'hello:world'
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    59
  [255]
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    60
  $ hg st
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    61
  A a
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    62
  A b
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    63
  A con.xml
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    64
  ? hello:world
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    65
  $ hg --config ui.portablefilenames=ignore add
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    66
  adding hello:world
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    67
  $ hg st
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    68
  A a
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    69
  A b
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    70
  A con.xml
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    71
  A hello:world
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12399
diff changeset
    72
11795
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    73
  $ hg ci -m 0 --traceback
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    74
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    75
should fail
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    76
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    77
  $ hg add a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    78
  a already tracked!
5207
212de429e000 make hg add of a removed file unremove the file
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    79
11795
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    80
  $ echo aa > a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    81
  $ hg ci -m 1
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    82
  $ hg up 0
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    83
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    84
  $ echo aaa > a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    85
  $ hg ci -m 2
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    86
  created new head
5207
212de429e000 make hg add of a removed file unremove the file
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    87
11795
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    88
  $ hg merge
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    89
  merging a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    90
  warning: conflicts during merge.
15501
2371f4aea665 merge: give a special message for internal:merge failure (issue3105)
Matt Mackall <mpm@selenic.com>
parents: 15444
diff changeset
    91
  merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
11795
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    92
  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
12314
f2daa6ab514a merge: suggest 'hg up -C .' for discarding changes, not 'hg up -C'
Brodie Rao <brodie@bitheap.org>
parents: 11795
diff changeset
    93
  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12314
diff changeset
    94
  [1]
11795
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    95
  $ hg st
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    96
  M a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    97
  ? a.orig
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    98
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
    99
should fail
5207
212de429e000 make hg add of a removed file unremove the file
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
   100
11795
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   101
  $ hg add a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   102
  a already tracked!
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   103
  $ hg st
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   104
  M a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   105
  ? a.orig
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   106
  $ hg resolve -m a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   107
  $ hg ci -m merge
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   108
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12365
diff changeset
   109
Issue683: peculiarity with hg revert of an removed then added file
5688
883d887c6408 commands: add exits(1) if a specified file cannot be added (issue 891)
Patrick Mezard <pmezard@gmail.com>
parents: 5207
diff changeset
   110
11795
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   111
  $ hg forget a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   112
  $ hg add a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   113
  $ hg st
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   114
  ? a.orig
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   115
  $ hg rm a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   116
  $ hg st
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   117
  R a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   118
  ? a.orig
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   119
  $ echo a > a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   120
  $ hg add a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   121
  $ hg st
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   122
  M a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   123
  ? a.orig
5688
883d887c6408 commands: add exits(1) if a specified file cannot be added (issue 891)
Patrick Mezard <pmezard@gmail.com>
parents: 5207
diff changeset
   124
11795
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   125
  $ hg add c && echo "unexpected addition of missing file"
15521
117f9190c1ba tests: hide 'No such file or directory' messages
Mads Kiilerich <mads@kiilerich.com>
parents: 15444
diff changeset
   126
  c: * (glob)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12314
diff changeset
   127
  [1]
11795
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   128
  $ echo c > c
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   129
  $ hg add d c && echo "unexpected addition of missing file"
15521
117f9190c1ba tests: hide 'No such file or directory' messages
Mads Kiilerich <mads@kiilerich.com>
parents: 15444
diff changeset
   130
  d: * (glob)
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12314
diff changeset
   131
  [1]
11795
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   132
  $ hg st
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   133
  M a
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   134
  A c
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   135
  ? a.orig
06793ad30575 tests: unify test-add
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 9166
diff changeset
   136