tests/test-merge-types.t
author Remy Blank <remy.blank@pobox.com>
Wed, 09 Jan 2013 20:27:17 +0100
changeset 18288 0d5a22f73a1f
parent 17110 722fd97f6645
child 18334 44bda93df90e
permissions -rw-r--r--
posix: fix split() for the case where the path is at the root of the filesystem posixpath.split() strips '/' from the dirname *unless it is the root*. This patch reproduces this behavior in posix.split(). The old behavior causes a crash when creating a file at the root of the repo with localrepo.wfile() when the repo is at the root of the filesystem.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15442
db0340f4b507 tests: use 'hghave execbit' for tests that manipulate x bit in file system
Mads Kiilerich <mads@kiilerich.com>
parents: 15441
diff changeset
     1
  $ "$TESTDIR/hghave" symlink execbit || exit 80
15441
e0348815e806 tests: use 'hghave symlink' for tests using symlinks
Mads Kiilerich <mads@kiilerich.com>
parents: 12279
diff changeset
     2
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
     3
  $ hg init
5503
6f26c7677463 Test a merge of a symlink against an executable file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
     4
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
     5
  $ echo a > a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
     6
  $ hg ci -Amadd
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
     7
  adding a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
     8
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
     9
  $ chmod +x a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    10
  $ hg ci -mexecutable
5503
6f26c7677463 Test a merge of a symlink against an executable file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    11
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    12
  $ hg up 0
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    13
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    14
  $ rm a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    15
  $ ln -s symlink a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    16
  $ hg ci -msymlink
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    17
  created new head
5503
6f26c7677463 Test a merge of a symlink against an executable file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    18
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    19
  $ hg merge --debug
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    20
    searching for copies back to rev 1
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    21
  resolving manifests
15625
efdcce3fd2d5 merge: make debug output easier to read
Martin Geisler <mg@aragost.com>
parents: 15442
diff changeset
    22
   overwrite: False, partial: False
efdcce3fd2d5 merge: make debug output easier to read
Martin Geisler <mg@aragost.com>
parents: 15442
diff changeset
    23
   ancestor: c334dc3be0da, local: 521a1e40188f+, remote: 3574f3e69b1c
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    24
   conflicting flags for a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    25
  (n)one, e(x)ec or sym(l)ink? n
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    26
   a: update permissions -> e
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    27
  updating: a 1/1 files (100.00%)
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    28
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    29
  (branch merge, don't forget to commit)
5503
6f26c7677463 Test a merge of a symlink against an executable file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    30
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    31
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    32
Symlink is local parent, executable is other:
5503
6f26c7677463 Test a merge of a symlink against an executable file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    33
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    34
  $ if [ -h a ]; then
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    35
  >     echo a is a symlink
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    36
  >     $TESTDIR/readlink.py a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    37
  > elif [ -x a ]; then
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    38
  >     echo a is executable
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    39
  > else
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    40
  >     echo "a has no flags (default for conflicts)"
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    41
  > fi
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    42
  a has no flags (default for conflicts)
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    43
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    44
  $ hg update -C 1
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    45
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
5503
6f26c7677463 Test a merge of a symlink against an executable file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    46
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    47
  $ hg merge --debug
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    48
    searching for copies back to rev 1
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    49
  resolving manifests
15625
efdcce3fd2d5 merge: make debug output easier to read
Martin Geisler <mg@aragost.com>
parents: 15442
diff changeset
    50
   overwrite: False, partial: False
efdcce3fd2d5 merge: make debug output easier to read
Martin Geisler <mg@aragost.com>
parents: 15442
diff changeset
    51
   ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    52
   conflicting flags for a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    53
  (n)one, e(x)ec or sym(l)ink? n
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    54
   a: remote is newer -> g
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    55
  updating: a 1/1 files (100.00%)
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    56
  getting a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    57
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    58
  (branch merge, don't forget to commit)
5503
6f26c7677463 Test a merge of a symlink against an executable file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff changeset
    59
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    60
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    61
Symlink is other parent, executable is local:
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    62
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    63
  $ if [ -h a ]; then
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    64
  >    echo a is a symlink
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    65
  >    $TESTDIR/readlink.py a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    66
  > elif [ -x a ]; then
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    67
  >     echo a is executable
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    68
  > else
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    69
  >     echo "a has no flags (default for conflicts)"
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    70
  > fi
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    71
  a has no flags (default for conflicts)
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 5710
diff changeset
    72
16255
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    73
Update to link without local change should get us a symlink (issue3316):
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    74
17110
722fd97f6645 tests: fix test markup in test-merge-types.t
Mads Kiilerich <mads@kiilerich.com>
parents: 16355
diff changeset
    75
  $ hg up -C 0
722fd97f6645 tests: fix test markup in test-merge-types.t
Mads Kiilerich <mads@kiilerich.com>
parents: 16355
diff changeset
    76
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
722fd97f6645 tests: fix test markup in test-merge-types.t
Mads Kiilerich <mads@kiilerich.com>
parents: 16355
diff changeset
    77
  $ hg up
722fd97f6645 tests: fix test markup in test-merge-types.t
Mads Kiilerich <mads@kiilerich.com>
parents: 16355
diff changeset
    78
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
722fd97f6645 tests: fix test markup in test-merge-types.t
Mads Kiilerich <mads@kiilerich.com>
parents: 16355
diff changeset
    79
  $ hg st
16255
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    80
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    81
Update to link with local change should cause a merge prompt (issue3200):
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    82
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    83
  $ hg up -C 0
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    84
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    85
  $ echo data > a
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    86
  $ HGMERGE= hg up -y --debug
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    87
    searching for copies back to rev 2
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    88
  resolving manifests
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    89
   overwrite: False, partial: False
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    90
   ancestor: c334dc3be0da, local: c334dc3be0da+, remote: 521a1e40188f
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    91
   a: versions differ -> m
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    92
  preserving a for resolve of a
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    93
  updating: a 1/1 files (100.00%)
16355
cb1475e7e5a2 test-merge-types: allow different output with existing hgmerge (issue3346)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 16255
diff changeset
    94
  (couldn't find merge tool hgmerge|tool hgmerge can't handle symlinks) (re)
16255
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    95
  picked tool 'internal:prompt' for a (binary False symlink True)
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    96
   no tool found to merge a
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    97
  keep (l)ocal or take (o)ther? l
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    98
  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
    99
  $ hg diff --git
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
   100
  diff --git a/a b/a
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
   101
  old mode 120000
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
   102
  new mode 100644
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
   103
  --- a/a
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
   104
  +++ b/a
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
   105
  @@ -1,1 +1,1 @@
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
   106
  -symlink
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
   107
  \ No newline at end of file
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
   108
  +data
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
   109
ca5cc2976574 merge: handle linear update to symlink correctly (issue3316)
Matt Mackall <mpm@selenic.com>
parents: 15625
diff changeset
   110