tests/test-pathconflicts-merge.t
author Augie Fackler <augie@google.com>
Tue, 13 Mar 2018 18:05:49 -0400
changeset 36941 3f7bbce8fbaa
parent 35704 41ef02ba329b
child 37114 a8a0cafcef79
permissions -rw-r--r--
hghave: fix xdiff check on Python 3 Differential Revision: https://phab.mercurial-scm.org/D2845
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35437
cf532a62e337 tests: test-pathconflicts-merge.t requires symlinks
Augie Fackler <augie@google.com>
parents: 35393
diff changeset
     1
#require symlink
cf532a62e337 tests: test-pathconflicts-merge.t requires symlinks
Augie Fackler <augie@google.com>
parents: 35393
diff changeset
     2
34942
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34571
diff changeset
     3
Path conflict checking is currently disabled by default because of issue5716.
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34571
diff changeset
     4
Turn it on for this test.
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34571
diff changeset
     5
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34571
diff changeset
     6
  $ cat >> $HGRCPATH << EOF
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34571
diff changeset
     7
  > [experimental]
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34571
diff changeset
     8
  > merge.checkpathconflicts=True
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34571
diff changeset
     9
  > EOF
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34571
diff changeset
    10
34558
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    11
  $ hg init repo
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    12
  $ cd repo
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    13
  $ echo base > base
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    14
  $ hg add base
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    15
  $ hg commit -m "base"
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    16
  $ hg bookmark -i base
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    17
  $ mkdir a
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    18
  $ echo 1 > a/b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    19
  $ hg add a/b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    20
  $ hg commit -m "file"
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    21
  $ hg bookmark -i file
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    22
  $ echo 2 > a/b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    23
  $ hg commit -m "file2"
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    24
  $ hg bookmark -i file2
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    25
  $ hg up 0
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    26
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    27
  $ mkdir a
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    28
  $ ln -s c a/b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    29
  $ hg add a/b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    30
  $ hg commit -m "link"
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    31
  created new head
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    32
  $ hg bookmark -i link
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    33
  $ hg up 0
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    34
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    35
  $ mkdir -p a/b/c
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    36
  $ echo 2 > a/b/c/d
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    37
  $ hg add a/b/c/d
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    38
  $ hg commit -m "dir"
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    39
  created new head
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    40
  $ hg bookmark -i dir
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    41
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    42
Merge - local file conflicts with remote directory
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    43
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    44
  $ hg up file
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    45
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    46
  (activating bookmark file)
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    47
  $ hg bookmark -i
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    48
  $ hg merge --verbose dir
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    49
  resolving manifests
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    50
  a/b: path conflict - a file or link has the same name as a directory
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    51
  the local file has been renamed to a/b~0ed027b96f31
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    52
  resolve manually then use 'hg resolve --mark a/b'
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34942
diff changeset
    53
  moving a/b to a/b~0ed027b96f31
34558
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    54
  getting a/b/c/d
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    55
  1 files updated, 0 files merged, 0 files removed, 1 files unresolved
35704
41ef02ba329b merge: add `--abort` flag which can abort the merge
Pulkit Goyal <7895pulkit@gmail.com>
parents: 35437
diff changeset
    56
  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
34558
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    57
  [1]
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    58
  $ hg status
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    59
  M a/b/c/d
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    60
  A a/b~0ed027b96f31
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    61
  R a/b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    62
  $ hg resolve --all
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    63
  a/b: path conflict must be resolved manually
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    64
  $ hg forget a/b~0ed027b96f31 && rm a/b~0ed027b96f31
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    65
  $ hg resolve --mark a/b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    66
  (no more unresolved files)
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    67
  $ hg commit -m "merge file and dir (deleted file)"
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    68
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    69
Merge - local symlink conflicts with remote directory
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    70
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    71
  $ hg up link
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    72
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    73
  (activating bookmark link)
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    74
  $ hg bookmark -i
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    75
  $ hg merge dir
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    76
  a/b: path conflict - a file or link has the same name as a directory
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    77
  the local file has been renamed to a/b~2ea68033e3be
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    78
  resolve manually then use 'hg resolve --mark a/b'
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    79
  1 files updated, 0 files merged, 0 files removed, 1 files unresolved
35704
41ef02ba329b merge: add `--abort` flag which can abort the merge
Pulkit Goyal <7895pulkit@gmail.com>
parents: 35437
diff changeset
    80
  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
34558
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    81
  [1]
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    82
  $ hg status
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    83
  M a/b/c/d
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    84
  A a/b~2ea68033e3be
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    85
  R a/b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    86
  $ hg resolve --list
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    87
  P a/b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    88
  $ hg resolve --all
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    89
  a/b: path conflict must be resolved manually
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    90
  $ hg mv a/b~2ea68033e3be a/b.old
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    91
  $ hg resolve --mark a/b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    92
  (no more unresolved files)
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    93
  $ hg resolve --list
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    94
  R a/b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    95
  $ hg commit -m "merge link and dir (renamed link)"
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    96
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    97
Merge - local directory conflicts with remote file or link
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    98
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    99
  $ hg up dir
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   100
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   101
  (activating bookmark dir)
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   102
  $ hg bookmark -i
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   103
  $ hg merge file
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   104
  a/b: path conflict - a file or link has the same name as a directory
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   105
  the remote file has been renamed to a/b~0ed027b96f31
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   106
  resolve manually then use 'hg resolve --mark a/b'
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   107
  1 files updated, 0 files merged, 0 files removed, 1 files unresolved
35704
41ef02ba329b merge: add `--abort` flag which can abort the merge
Pulkit Goyal <7895pulkit@gmail.com>
parents: 35437
diff changeset
   108
  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
34558
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   109
  [1]
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   110
  $ hg status
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   111
  A a/b~0ed027b96f31
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   112
  $ hg resolve --all
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   113
  a/b: path conflict must be resolved manually
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   114
  $ hg mv a/b~0ed027b96f31 a/b/old-b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   115
  $ hg resolve --mark a/b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   116
  (no more unresolved files)
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   117
  $ hg commit -m "merge dir and file (move file into dir)"
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   118
  created new head
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   119
  $ hg merge file2
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   120
  merging a/b/old-b and a/b to a/b/old-b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   121
  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   122
  (branch merge, don't forget to commit)
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   123
  $ cat a/b/old-b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   124
  2
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   125
  $ hg commit -m "merge file2 (copytrace tracked rename)"
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   126
  $ hg merge link
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   127
  a/b: path conflict - a file or link has the same name as a directory
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   128
  the remote file has been renamed to a/b~2ea68033e3be
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   129
  resolve manually then use 'hg resolve --mark a/b'
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   130
  1 files updated, 0 files merged, 0 files removed, 1 files unresolved
35704
41ef02ba329b merge: add `--abort` flag which can abort the merge
Pulkit Goyal <7895pulkit@gmail.com>
parents: 35437
diff changeset
   131
  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
34558
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   132
  [1]
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   133
  $ hg mv a/b~2ea68033e3be a/b.old
34571
75bd034a1e00 tests: use readlink.py instead of readlink
Augie Fackler <augie@google.com>
parents: 34558
diff changeset
   134
  $ readlink.py a/b.old
75bd034a1e00 tests: use readlink.py instead of readlink
Augie Fackler <augie@google.com>
parents: 34558
diff changeset
   135
  a/b.old -> c
34558
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   136
  $ hg resolve --mark a/b
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   137
  (no more unresolved files)
f71c712ebdec tests: add test for path conflicts during merge
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
   138
  $ hg commit -m "merge link (rename link)"