tests/test-close-head.t
author Kyle Lippincott <spectral@google.com>
Wed, 27 Jan 2021 10:29:21 -0800
branchstable
changeset 46415 8deab876fb59
parent 42295 fdd4d668ceb5
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:
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     1
  $ hg init test-content
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     2
  $ cd test-content
40096
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
     3
  $ hg debugbuilddag '+2*2*3*4+7'
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     4
  $ hg bookmark -r 1 @
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
     5
  $ hg log -G --template '{rev}:{node|short}'
40096
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
     6
  o  11:1d876b1f862c
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
     7
  |
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
     8
  o  10:ea5f71948eb8
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
     9
  |
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    10
  o  9:f1b0356d867a
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    11
  |
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    12
  o  8:e8d1253fb0d7
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    13
  |
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    14
  o  7:d423bbba4459
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    15
  |
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    16
  o  6:a2f58e9c1e56
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    17
  |
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    18
  o  5:3a367db1fabc
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    19
  |
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    20
  o  4:e7bd5218ca15
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    21
  |
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    22
  | o  3:6100d3090acf
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    23
  |/
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    24
  | o  2:fa942426a6fd
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    25
  |/
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    26
  | o  1:66f7d451a68b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    27
  |/
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    28
  o  0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    29
  
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    30
  $ hg --config extensions.closehead= close-head -m 'Not a head' 0 1
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    31
  abort: revision is not an open head: 0
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    32
  [255]
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    33
  $ hg --config extensions.closehead= close-head -m 'Not a head' -r 0 1
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    34
  abort: revision is not an open head: 0
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    35
  [255]
42294
c51b103220c7 tests: demonstrate that close-head command updates working copy
Martin von Zweigbergk <martinvonz@google.com>
parents: 40096
diff changeset
    36
  $ hg id
c51b103220c7 tests: demonstrate that close-head command updates working copy
Martin von Zweigbergk <martinvonz@google.com>
parents: 40096
diff changeset
    37
  000000000000
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    38
  $ hg --config extensions.closehead= close-head -m 'Close old heads' -r 1 2
42294
c51b103220c7 tests: demonstrate that close-head command updates working copy
Martin von Zweigbergk <martinvonz@google.com>
parents: 40096
diff changeset
    39
  $ hg id
42295
fdd4d668ceb5 context: move contents of committablectx.markcommitted() to workingctx
Martin von Zweigbergk <martinvonz@google.com>
parents: 42294
diff changeset
    40
  000000000000
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    41
  $ hg bookmark
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    42
     @                         1:66f7d451a68b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    43
  $ hg heads
40096
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    44
  changeset:   11:1d876b1f862c
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    45
  user:        debugbuilddag
40096
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    46
  date:        Thu Jan 01 00:00:11 1970 +0000
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    47
  summary:     r11
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    48
  
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    49
  changeset:   3:6100d3090acf
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    50
  parent:      0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    51
  user:        debugbuilddag
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    52
  date:        Thu Jan 01 00:00:03 1970 +0000
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    53
  summary:     r3
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    54
  
40096
12a72729678e closehead: fix close-head -r listification
Joerg Sonnenberger <joerg@bec.de>
parents: 39993
diff changeset
    55
  $ hg --config extensions.closehead= close-head -m 'Close more old heads' -r 11
39993
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    56
  $ hg heads
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    57
  changeset:   3:6100d3090acf
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    58
  parent:      0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    59
  user:        debugbuilddag
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    60
  date:        Thu Jan 01 00:00:03 1970 +0000
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    61
  summary:     r3
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    62
  
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    63
  $ hg --config extensions.closehead= close-head -m 'Not a head' 0
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    64
  abort: revision is not an open head: 0
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    65
  [255]
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    66
  $ hg --config extensions.closehead= close-head -m 'Already closed head' 1
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    67
  abort: revision is not an open head: 1
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    68
  [255]
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    69
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    70
  $ hg init ../test-empty
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    71
  $ cd ../test-empty
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    72
  $ hg debugbuilddag '+1'
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    73
  $ hg log -G --template '{rev}:{node|short}'
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    74
  o  0:1ea73414a91b
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    75
  
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    76
  $ hg --config extensions.closehead= close-head -m 'Close initial revision' 0
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    77
  $ hg heads
cd5f2e615262 extensions: new closehead module for closing arbitrary heads
Joerg Sonnenberger <joerg@bec.de>
parents:
diff changeset
    78
  [1]