tests/test-eolfilename.t
author Patrick Mezard <patrick@mezard.eu>
Sat, 28 Apr 2012 15:01:57 +0200
branchstable
changeset 16536 63c817ea4a70
parent 13987 e0f07847f8de
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:
12425
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
     1
http://mercurial.selenic.com/bts/issue352
3607
f4c9bb4ad7b1 issue352: disallow '\n' and '\r' in filenames (dirstate and manifest)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     2
12425
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
     3
  $ "$TESTDIR/hghave" eol-in-paths || exit 80
3607
f4c9bb4ad7b1 issue352: disallow '\n' and '\r' in filenames (dirstate and manifest)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     4
12425
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
     5
test issue352
3607
f4c9bb4ad7b1 issue352: disallow '\n' and '\r' in filenames (dirstate and manifest)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     6
12425
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
     7
  $ hg init foo
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
     8
  $ cd foo
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
     9
  $ A=`printf 'he\rllo'`
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    10
  $ echo foo > "$A"
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    11
  $ hg add
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12425
diff changeset
    12
  adding he\rllo (esc)
12425
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    13
  abort: '\n' and '\r' disallowed in filenames: 'he\rllo'
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    14
  [255]
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    15
  $ hg ci -A -m m
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12425
diff changeset
    16
  adding he\rllo (esc)
12425
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    17
  abort: '\n' and '\r' disallowed in filenames: 'he\rllo'
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    18
  [255]
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    19
  $ rm "$A"
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    20
  $ echo foo > "hell
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    21
  > o"
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    22
  $ hg add
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    23
  adding hell
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    24
  o
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    25
  abort: '\n' and '\r' disallowed in filenames: 'hell\no'
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    26
  [255]
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    27
  $ hg ci -A -m m
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    28
  adding hell
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    29
  o
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    30
  abort: '\n' and '\r' disallowed in filenames: 'hell\no'
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    31
  [255]
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    32
  $ echo foo > "$A"
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    33
  $ hg debugwalk
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12425
diff changeset
    34
  f  he\rllo  he\rllo (esc)
12425
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    35
  f  hell
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    36
  o  hell
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    37
  o
10475
2253715fde97 color: don't crash on invalid status codes (issue2036)
Brodie Rao <me+hg@dackz.net>
parents: 8936
diff changeset
    38
13945
03f3ce7ca2a8 copy: do not copy file if name is disallowed anyway
Adrian Buehlmann <adrian@cadifra.com>
parents: 12942
diff changeset
    39
  $ echo bla > quickfox
03f3ce7ca2a8 copy: do not copy file if name is disallowed anyway
Adrian Buehlmann <adrian@cadifra.com>
parents: 12942
diff changeset
    40
  $ hg add quickfox
03f3ce7ca2a8 copy: do not copy file if name is disallowed anyway
Adrian Buehlmann <adrian@cadifra.com>
parents: 12942
diff changeset
    41
  $ hg ci -m 2
03f3ce7ca2a8 copy: do not copy file if name is disallowed anyway
Adrian Buehlmann <adrian@cadifra.com>
parents: 12942
diff changeset
    42
  $ A=`printf 'quick\rfox'`
03f3ce7ca2a8 copy: do not copy file if name is disallowed anyway
Adrian Buehlmann <adrian@cadifra.com>
parents: 12942
diff changeset
    43
  $ hg cp quickfox "$A"
03f3ce7ca2a8 copy: do not copy file if name is disallowed anyway
Adrian Buehlmann <adrian@cadifra.com>
parents: 12942
diff changeset
    44
  abort: '\n' and '\r' disallowed in filenames: 'quick\rfox'
03f3ce7ca2a8 copy: do not copy file if name is disallowed anyway
Adrian Buehlmann <adrian@cadifra.com>
parents: 12942
diff changeset
    45
  [255]
03f3ce7ca2a8 copy: do not copy file if name is disallowed anyway
Adrian Buehlmann <adrian@cadifra.com>
parents: 12942
diff changeset
    46
  $ hg mv quickfox "$A"
03f3ce7ca2a8 copy: do not copy file if name is disallowed anyway
Adrian Buehlmann <adrian@cadifra.com>
parents: 12942
diff changeset
    47
  abort: '\n' and '\r' disallowed in filenames: 'quick\rfox'
03f3ce7ca2a8 copy: do not copy file if name is disallowed anyway
Adrian Buehlmann <adrian@cadifra.com>
parents: 12942
diff changeset
    48
  [255]
03f3ce7ca2a8 copy: do not copy file if name is disallowed anyway
Adrian Buehlmann <adrian@cadifra.com>
parents: 12942
diff changeset
    49
12425
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    50
http://mercurial.selenic.com/bts/issue2036
10475
2253715fde97 color: don't crash on invalid status codes (issue2036)
Brodie Rao <me+hg@dackz.net>
parents: 8936
diff changeset
    51
12425
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    52
  $ cd ..
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    53
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    54
test issue2039
10475
2253715fde97 color: don't crash on invalid status codes (issue2036)
Brodie Rao <me+hg@dackz.net>
parents: 8936
diff changeset
    55
12425
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    56
  $ hg init bar
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    57
  $ cd bar
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    58
  $ echo "[extensions]" >> $HGRCPATH
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    59
  $ echo "color=" >> $HGRCPATH
13987
e0f07847f8de color: add support for terminfo-based attributes and color
Danek Duvall <duvall@comfychair.org>
parents: 13945
diff changeset
    60
  $ echo "[color]" >> $HGRCPATH
e0f07847f8de color: add support for terminfo-based attributes and color
Danek Duvall <duvall@comfychair.org>
parents: 13945
diff changeset
    61
  $ echo "mode = ansi" >> $HGRCPATH
12425
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    62
  $ A=`printf 'foo\nbar'`
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    63
  $ B=`printf 'foo\nbar.baz'`
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    64
  $ touch "$A"
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    65
  $ touch "$B"
fcf55506c2f4 tests: unify test-eolfilename
Matt Mackall <mpm@selenic.com>
parents: 10475
diff changeset
    66
  $ hg status --color=always
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12425
diff changeset
    67
  \x1b[0;35;1;4m? foo\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12425
diff changeset
    68
  \x1b[0;35;1;4mbar\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12425
diff changeset
    69
  \x1b[0;35;1;4m? foo\x1b[0m (esc)
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12425
diff changeset
    70
  \x1b[0;35;1;4mbar.baz\x1b[0m (esc)