tests/test-pathconflicts-basic.t
author Matt Harbison <matt_harbison@yahoo.com>
Mon, 19 Aug 2024 22:27:43 -0400
changeset 51823 5eb98ea78fd7
parent 46418 dc00324e80f4
permissions -rw-r--r--
typing: make the manifest classes known to pytype These are the same changes as c1d7ac70980b and 45270e286bdc made to dirstate, for the same reasons. The migration away from decorating the classes with `@interfaceutil.implementer` was started back in 3e9a660b074a, but missed one.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34942
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34556
diff changeset
     1
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: 34556
diff changeset
     2
Turn it on for this test.
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34556
diff changeset
     3
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34556
diff changeset
     4
  $ cat >> $HGRCPATH << EOF
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34556
diff changeset
     5
  > [experimental]
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34556
diff changeset
     6
  > merge.checkpathconflicts=True
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34556
diff changeset
     7
  > EOF
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34556
diff changeset
     8
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
     9
  $ hg init repo
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    10
  $ cd repo
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    11
  $ echo base > base
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    12
  $ hg add base
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    13
  $ hg commit -m "base"
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    14
  $ hg bookmark -i base
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    15
  $ echo 1 > a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    16
  $ hg add a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    17
  $ hg commit -m "file"
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    18
  $ hg bookmark -i file
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    19
  $ echo 2 > a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    20
  $ hg commit -m "file2"
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    21
  $ hg bookmark -i file2
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    22
  $ hg up -q 0
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    23
  $ mkdir a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    24
  $ echo 2 > a/b
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    25
  $ hg add a/b
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    26
  $ hg commit -m "dir"
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    27
  created new head
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    28
  $ hg bookmark -i dir
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    29
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    30
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
    31
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    32
  $ hg up -q file
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    33
  $ hg bookmark -i
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    34
  $ hg merge --verbose dir
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    35
  resolving manifests
34555
989e884d1be9 merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34553
diff changeset
    36
  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
    37
  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
    38
  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
    39
  moving a to a~853701544ac3
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    40
  getting a/b
34555
989e884d1be9 merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34553
diff changeset
    41
  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: 34942
diff changeset
    42
  use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
34555
989e884d1be9 merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34553
diff changeset
    43
  [1]
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    44
  $ hg update --clean .
34555
989e884d1be9 merge: check for path conflicts when merging (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34553
diff changeset
    45
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
34556
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    46
  $ rm a~853701544ac3
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    47
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    48
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
    49
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    50
  $ hg up -q 0
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    51
  $ mkdir a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    52
  $ echo 3 > a/b
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    53
  $ hg up file
34553
0217d66846f7 merge: improve error messages for path conflicts during update
Mark Thomas <mbthomas@fb.com>
parents: 34552
diff changeset
    54
  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
    55
  abort: untracked files in working directory differ from files in requested revision
46418
dc00324e80f4 errors: use StateError more in merge module
Martin von Zweigbergk <martinvonz@google.com>
parents: 40230
diff changeset
    56
  [20]
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    57
  $ hg up --clean file
34556
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    58
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    59
  (activating bookmark file)
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    60
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    61
Repo state is ok
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    62
34556
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    63
  $ hg sum
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    64
  parent: 1:853701544ac3 
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    65
   file
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    66
  branch: default
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    67
  bookmarks: *file
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    68
  commit: (clean)
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    69
  update: 2 new changesets (update)
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    70
  phases: 4 draft
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    71
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    72
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
    73
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    74
  $ hg up -q 0
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    75
  $ echo untracked > a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    76
  $ 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
    77
  a: replacing untracked file
33c8a6837181 merge: check for path conflicts when updating (issue5628)
Mark Thomas <mbthomas@fb.com>
parents: 34544
diff changeset
    78
  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
    79
  (activating bookmark dir)
34556
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    80
  $ cat a.orig
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    81
  untracked
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    82
  $ rm -f a.orig
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    83
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    84
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
    85
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    86
  $ hg up -q file
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    87
  $ rm a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    88
  $ mkdir a
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    89
  $ echo 4 > a/b
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    90
  $ hg up file2
40230
0b46e1aa7760 py3: add some glob to make output compatible with python 3
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 35704
diff changeset
    91
  abort: *: *$TESTTMP/repo/a* (glob)
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    92
  [255]
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    93
  $ hg up --clean file2
34556
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    94
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    95
  (activating bookmark file2)
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    96
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    97
Repo state is ok
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    98
34556
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
    99
  $ hg sum
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
   100
  parent: 2:f64e09fac717 
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
   101
   file2
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
   102
  branch: default
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
   103
  bookmarks: *file2
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
   104
  commit: (clean)
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
   105
  update: 1 new changesets, 2 branch heads (merge)
7a8a16f8ea22 context: also consider path conflicts when clearing unknown files
Mark Thomas <mbthomas@fb.com>
parents: 34555
diff changeset
   106
  phases: 4 draft