tests/test-rename-after-merge.t
author Matt Harbison <matt_harbison@yahoo.com>
Sun, 24 Jun 2018 01:13:09 -0400
changeset 38483 3efadf2317c7
parent 38250 d0abd7949ea3
child 44365 7c4b98a4e536
permissions -rw-r--r--
windows: add a method to convert Unix style command lines to Windows style This started as a copy/paste of `os.path.expandvars()`, but limited to a given dictionary of variables, converting `foo = foo + bar` to `foo += bar`, and adding 'b' string prefixes. Then code was added to make sure that a value being substituted in wouldn't itself be expanded by cmd.exe. But that left inconsistent results between `$var1` and `%var1%` when its value was '%foo%'- since neither were touched, `$var1` wouldn't expand but `%var1%` would. So instead, this just converts the Unix style to Windows style (if the variable exists, because Windows will leave `%missing%` as-is), and lets cmd.exe do its thing. I then dropped the %% -> % conversion (because Windows doesn't do this), and added the ability to escape the '$' with '\'. The escape character is dropped, for consistency with shell handling. After everything seemed stable and working, running the whole test suite flagged a problem near the end of test-bookmarks.t:1069. The problem is cmd.exe won't pass empty variables to its child, so defined but empty variables are now skipped. I can't think of anything better, and it seems like a pre-existing violation of the documentation, which calls out that HG_OLDNODE is empty on bookmark creation. Future additions could potentially be replacing strong quotes with double quotes (cmd.exe doesn't know what to do with the former), escaping a double quote, and some tilde expansion via os.path.expanduser(). I've got some doubts about replacing the strong quotes in case sh.exe is run, but it seems like the right thing to do the vast majority of the time. The original form of this was discussed about a year ago[1]. [1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-July/100735.html
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12328
diff changeset
     1
Issue746: renaming files brought by the second parent of a merge was
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12328
diff changeset
     2
broken.
5318
c6682cdada2f Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     3
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
     4
Create source repository:
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
     5
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
     6
  $ hg init t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
     7
  $ cd t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
     8
  $ echo a > a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
     9
  $ hg ci -Am a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    10
  adding a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    11
  $ cd ..
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    12
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    13
Fork source repository:
5318
c6682cdada2f Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    14
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    15
  $ hg clone t t2
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    16
  updating to branch default
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    17
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    18
  $ cd t2
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    19
  $ echo b > b
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    20
  $ hg ci -Am b
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    21
  adding b
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    22
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    23
Update source repository:
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    24
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    25
  $ cd ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    26
  $ echo a >> a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    27
  $ hg ci -m a2
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    28
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    29
Merge repositories:
5318
c6682cdada2f Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    30
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    31
  $ hg pull ../t2
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    32
  pulling from ../t2
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    33
  searching for changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    34
  adding changesets
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    35
  adding manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    36
  adding file changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    37
  added 1 changesets with 1 changes to 1 files (+1 heads)
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 16913
diff changeset
    38
  new changesets d2ae7f538514
38250
d0abd7949ea3 phases: use "published" in the phase movement message
Boris Feld <boris.feld@octobus.net>
parents: 38249
diff changeset
    39
  1 local changesets published
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    40
  (run 'hg heads' to see heads, 'hg merge' to merge)
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    41
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    42
  $ hg merge
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    43
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    44
  (branch merge, don't forget to commit)
5318
c6682cdada2f Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    45
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    46
  $ hg st
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    47
  M b
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    48
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    49
Rename b as c:
5318
c6682cdada2f Test renaming files brought by merge second parent (issue 746)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    51
  $ hg mv b c
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    52
  $ hg st
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    53
  A c
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    54
  R b
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    55
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    56
Rename back c as b:
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    57
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    58
  $ hg mv c b
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    59
  $ hg st
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    60
  M b
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    61
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    62
  $ cd ..
7689
d821ea464465 Fix a corner case when committing a rename after a merge (issue1476)
Patrick Mezard <pmezard@gmail.com>
parents: 5608
diff changeset
    63
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12328
diff changeset
    64
Issue 1476: renaming a first parent file into another first parent
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12328
diff changeset
    65
file while none of them belong to the second parent was broken
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    66
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    67
  $ hg init repo1476
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    68
  $ cd repo1476
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    69
  $ echo a > a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    70
  $ hg ci -Am adda
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    71
  adding a
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    72
  $ echo b1 > b1
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    73
  $ echo b2 > b2
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    74
  $ hg ci -Am changea
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    75
  adding b1
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    76
  adding b2
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    77
  $ hg up -C 0
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    78
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    79
  $ echo c1 > c1
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    80
  $ echo c2 > c2
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    81
  $ hg ci -Am addcandd
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    82
  adding c1
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    83
  adding c2
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    84
  created new head
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    85
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    86
Merge heads:
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    87
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    88
  $ hg merge
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    89
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    90
  (branch merge, don't forget to commit)
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    91
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    92
  $ hg mv -Af c1 c2
7689
d821ea464465 Fix a corner case when committing a rename after a merge (issue1476)
Patrick Mezard <pmezard@gmail.com>
parents: 5608
diff changeset
    93
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    94
Commit issue 1476:
7689
d821ea464465 Fix a corner case when committing a rename after a merge (issue1476)
Patrick Mezard <pmezard@gmail.com>
parents: 5608
diff changeset
    95
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    96
  $ hg ci -m merge
7689
d821ea464465 Fix a corner case when committing a rename after a merge (issue1476)
Patrick Mezard <pmezard@gmail.com>
parents: 5608
diff changeset
    97
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    98
  $ hg log -r tip -C -v | grep copies
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
    99
  copies:      c2 (c1)
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   100
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   101
  $ hg rollback
13446
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 12399
diff changeset
   102
  repository tip rolled back to revision 2 (undo commit)
13455
053c042118bc rollback, i18n: avoid parameterized message
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 13446
diff changeset
   103
  working directory now based on revisions 2 and 1
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   104
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   105
  $ hg up -C .
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   106
  2 files updated, 0 files merged, 2 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   107
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   108
Merge heads again:
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   109
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   110
  $ hg merge
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   111
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   112
  (branch merge, don't forget to commit)
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   113
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   114
  $ hg mv -Af b1 b2
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   115
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   116
Commit issue 1476 with a rename on the other side:
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   117
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   118
  $ hg ci -m merge
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   119
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   120
  $ hg log -r tip -C -v | grep copies
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   121
  copies:      b2 (b1)
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7689
diff changeset
   122
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 13455
diff changeset
   123
  $ cd ..