tests/test-pathconflicts-basic.t
author Kyle Lippincott <spectral@google.com>
Wed, 27 Jan 2021 10:29:21 -0800
branchstable
changeset 46415 8deab876fb59
parent 40230 0b46e1aa7760
child 46418 dc00324e80f4
permissions -rw-r--r--
wix: tell ComponentSearch that it is finding a directory (not a file) This is to fix an issue we've noticed where fresh installations start at `C:\Program Files\Mercurial`, and then upgrades "walk up" the tree and end up in `C:\Program Files` and finally `C:\` (where they stay). ComponentSearch defaults to finding files, which I think means "it produces a string like `C:\Program Files\Mercurial`", whereas with the type being explicitly a directory, it would return `C:\Program Files\Mercurial\` (note the final trailing backslash). Presumably, a latter step then tries to turn that file name into a proper directory, by removing everything after the last `\`. This could likely also be fixed by actually searching for the component for hg.exe itself. That seemed a lot more complicated, as the GUID for hg.exe isn't known in this file (it's one of the "auto-derived" ones). We could also consider adding a Condition that I think could check the Property and ensure it's either empty or ends in a trailing slash, but that would be an installer runtime check and I'm not convinced it'd actually be useful. This will *not* cause existing installations that are in one of the bad directories to fix themselves. Doing that would require a fair amount more understanding of wix and windows installer than I have, and it *probably* wouldn't be possible to be 100% correct about it either (there's nothing preventing a user from intentionally installing it in C:\, though I don't know why they would do so). If someone wants to tackle fixing existing installations, I think that the first installation is actually the only one that shows up in "Add or Remove Programs", and that its registry keys still exist. You might be able to find something under HKEY_USERS that lists both the "good" and the "bad" InstallDirs. Mine was under `HKEY_USERS\S-1-5-18\Software\Mercurial\InstallDir` (C:\), and `HKEY_USERS\S-1-5-21-..numbers..\Software\Mercurial\InstallDir` (C:\Program Files\Mercurial). If you find exactly two, with one being the default path, and the other being a prefix of it, the user almost certainly hit this bug :D We had originally thought that this bug might be due to unattended installations/upgrades, but I no longer think that's the case. We were able to reproduce the issue by uninstalling all copies of Mercurial I could find, installing one version (it chose the correct location), and then starting the installer for a different version (higher or lower didn't matter). I did not need to deal with an unattended or headless installation/upgrade to trigger the issue, but it's possible that my system was "primed" for this bug to happen because of a previous unattended installation/upgrade. Differential Revision: https://phab.mercurial-scm.org/D9891
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
34544
34c8080d12ac tests: add a test demonstrating basic path conflict failures
Mark Thomas <mbthomas@fb.com>
parents:
diff changeset
    56
  [255]
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