tests/test-pathconflicts-basic.t
author Mark Thomas <mbthomas@fb.com>
Mon, 02 Oct 2017 14:05:30 -0700
changeset 34555 989e884d1be9
parent 34553 0217d66846f7
child 34556 7a8a16f8ea22
permissions -rw-r--r--
merge: check for path conflicts when merging (issue5628) When merging, check for any path conflicts introduced by the manifest merge and rename the conflicting file to a safe name. Differential Revision: https://phab.mercurial-scm.org/D784
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     1
  $ hg init repo
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     2
  $ cd repo
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     3
  $ echo base > base
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     4
  $ hg add base
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     5
  $ hg commit -m "base"
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     6
  $ hg bookmark -i base
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     7
  $ echo 1 > a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     8
  $ hg add a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     9
  $ hg commit -m "file"
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    10
  $ hg bookmark -i file
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    11
  $ echo 2 > a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    12
  $ hg commit -m "file2"
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    13
  $ hg bookmark -i file2
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    14
  $ hg up -q 0
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    15
  $ mkdir a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    16
  $ echo 2 > a/b
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    17
  $ hg add a/b
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    18
  $ hg commit -m "dir"
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    19
  created new head
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    20
  $ hg bookmark -i dir
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    21
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    22
Basic merge - local file conflicts with remote directory
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    23
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    24
  $ hg up -q file
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    25
  $ hg bookmark -i
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    26
  $ hg merge --verbose dir
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    27
  resolving manifests
34555
989e884d1be9 merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34553
diff changeset
    28
  a: path conflict - a file or link has the same name as a directory
989e884d1be9 merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34553
diff changeset
    29
  the local file has been renamed to a~853701544ac3
989e884d1be9 merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34553
diff changeset
    30
  resolve manually then use 'hg resolve --mark a'
989e884d1be9 merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34553
diff changeset
    31
  moving a to a~853701544ac3
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    32
  getting a/b
34555
989e884d1be9 merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34553
diff changeset
    33
  1 files updated, 0 files merged, 0 files removed, 1 files unresolved
989e884d1be9 merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34553
diff changeset
    34
  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
989e884d1be9 merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34553
diff changeset
    35
  [1]
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    36
  $ hg update --clean .
34555
989e884d1be9 merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34553
diff changeset
    37
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    38
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    39
Basic update - local directory conflicts with remote file
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    40
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    41
  $ hg up -q 0
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    42
  $ mkdir a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    43
  $ echo 3 > a/b
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    44
  $ hg up file
34553
0217d66846f7 merge: improve error messages for path conflicts during update
Mark Thomas <mbthomas@fb.com>
parents: 34552
diff changeset
    45
  a: untracked directory conflicts with file
34552
33c8a6837181 merge: check for path conflicts when updating (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34544
diff changeset
    46
  abort: untracked files in working directory differ from files in requested revision
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    47
  [255]
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    48
  $ hg up --clean file
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    49
  abort: *: '$TESTTMP/repo/a' (glob)
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    50
  [255]
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    51
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    52
Repo is in a very bad state now - recover manually
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    53
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    54
  $ rm -r a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    55
  $ hg up -q --clean 0
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    56
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    57
Basic update - untracked file conflicts with remote directory
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    58
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    59
  $ hg up -q 0
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    60
  $ echo untracked > a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    61
  $ hg up --config merge.checkunknown=warn dir
34552
33c8a6837181 merge: check for path conflicts when updating (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34544
diff changeset
    62
  a: replacing untracked file
33c8a6837181 merge: check for path conflicts when updating (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34544
diff changeset
    63
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
33c8a6837181 merge: check for path conflicts when updating (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34544
diff changeset
    64
  (activating bookmark dir)
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    65
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    66
Basic clean update - local directory conflicts with changed remote file
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    67
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    68
  $ hg up -q file
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    69
  $ rm a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    70
  $ mkdir a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    71
  $ echo 4 > a/b
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    72
  $ hg up file2
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    73
  abort: *: '$TESTTMP/repo/a' (glob)
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    74
  [255]
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    75
  $ hg up --clean file2
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    76
  abort: *: '$TESTTMP/repo/a' (glob)
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    77
  [255]
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    78
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    79
Repo is in a very bad state now - recover manually
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    80
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    81
  $ rm -r a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    82
  $ hg up -q --clean 0
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    83