tests/test-copies-in-changeset.t
author Martin von Zweigbergk <martinvonz@google.com>
Mon, 19 Aug 2019 12:30:02 -0700
changeset 42858 170b070ec6a5
parent 42427 027f1567f97f
child 42859 2b869a515ba6
permissions -rw-r--r--
tests: demonstrate crash when committing subset of copies to changeset When writing copy metadata to the changeset and not committing all copies in the dirstate, we get a ProgrammingError. This commit adds two tests showing how to trigger this bug. Differential Revision: https://phab.mercurial-scm.org/D6749
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     1
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     2
  $ cat >> $HGRCPATH << EOF
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     3
  > [experimental]
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     4
  > copies.write-to=changeset-only
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
     5
  > copies.read-from=changeset-only
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     6
  > [alias]
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     7
  > changesetcopies = log -r . -T 'files: {files}
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
     8
  >   {extras % "{ifcontains("files", key, "{key}: {value}\n")}"}
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     9
  >   {extras % "{ifcontains("copies", key, "{key}: {value}\n")}"}'
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
    10
  > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}'
42289
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
    11
  > [extensions]
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
    12
  > rebase =
42858
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
    13
  > split =
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    14
  > EOF
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    15
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    16
Check that copies are recorded correctly
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    17
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    18
  $ hg init repo
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    19
  $ cd repo
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    20
  $ echo a > a
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    21
  $ hg add a
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    22
  $ hg ci -m initial
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    23
  $ hg cp a b
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    24
  $ hg cp a c
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    25
  $ hg cp a d
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    26
  $ hg ci -m 'copy a to b, c, and d'
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    27
  $ hg changesetcopies
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    28
  files: b c d
42427
027f1567f97f copies: separate added/removed files by newline instead of null
Martin von Zweigbergk <martinvonz@google.com>
parents: 42426
diff changeset
    29
  filesadded: 0
027f1567f97f copies: separate added/removed files by newline instead of null
Martin von Zweigbergk <martinvonz@google.com>
parents: 42426
diff changeset
    30
  1
027f1567f97f copies: separate added/removed files by newline instead of null
Martin von Zweigbergk <martinvonz@google.com>
parents: 42426
diff changeset
    31
  2
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
    32
  
42426
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
    33
  p1copies: 0\x00a (esc)
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
    34
  1\x00a (esc)
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
    35
  2\x00a (esc)
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
    36
  $ hg showcopies
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
    37
  a -> b
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
    38
  a -> c
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
    39
  a -> d
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
    40
  $ hg showcopies --config experimental.copies.read-from=compatibility
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
    41
  a -> b
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
    42
  a -> c
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
    43
  a -> d
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
    44
  $ hg showcopies --config experimental.copies.read-from=filelog-only
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    45
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    46
Check that renames are recorded correctly
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    47
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    48
  $ hg mv b b2
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    49
  $ hg ci -m 'rename b to b2'
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    50
  $ hg changesetcopies
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    51
  files: b b2
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
    52
  filesadded: 1
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
    53
  filesremoved: 0
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
    54
  
42426
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
    55
  p1copies: 1\x00b (esc)
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
    56
  $ hg showcopies
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
    57
  b -> b2
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    58
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    59
Rename onto existing file. This should get recorded in the changeset files list and in the extras,
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    60
even though there is no filelog entry.
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    61
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    62
  $ hg cp b2 c --force
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    63
  $ hg st --copies
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    64
  M c
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    65
    b2
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    66
  $ hg debugindex c
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    67
     rev linkrev nodeid       p1           p2
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    68
       0       1 b789fdd96dc2 000000000000 000000000000
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    69
  $ hg ci -m 'move b onto d'
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    70
  $ hg changesetcopies
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    71
  files: c
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
    72
  
42426
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
    73
  p1copies: 0\x00b2 (esc)
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
    74
  $ hg showcopies
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
    75
  b2 -> c
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    76
  $ hg debugindex c
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    77
     rev linkrev nodeid       p1           p2
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    78
       0       1 b789fdd96dc2 000000000000 000000000000
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    79
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    80
Create a merge commit with copying done during merge.
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    81
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    82
  $ hg co 0
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    83
  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    84
  $ hg cp a e
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    85
  $ hg cp a f
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    86
  $ hg ci -m 'copy a to e and f'
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    87
  created new head
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    88
  $ hg merge 3
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    89
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    90
  (branch merge, don't forget to commit)
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    91
File 'a' exists on both sides, so 'g' could be recorded as being from p1 or p2, but we currently
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    92
always record it as being from p1
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    93
  $ hg cp a g
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    94
File 'd' exists only in p2, so 'h' should be from p2
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    95
  $ hg cp d h
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    96
File 'f' exists only in p1, so 'i' should be from p1
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    97
  $ hg cp f i
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    98
  $ hg ci -m 'merge'
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    99
  $ hg changesetcopies
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   100
  files: g h i
42427
027f1567f97f copies: separate added/removed files by newline instead of null
Martin von Zweigbergk <martinvonz@google.com>
parents: 42426
diff changeset
   101
  filesadded: 0
027f1567f97f copies: separate added/removed files by newline instead of null
Martin von Zweigbergk <martinvonz@google.com>
parents: 42426
diff changeset
   102
  1
027f1567f97f copies: separate added/removed files by newline instead of null
Martin von Zweigbergk <martinvonz@google.com>
parents: 42426
diff changeset
   103
  2
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
   104
  
42426
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
   105
  p1copies: 0\x00a (esc)
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
   106
  2\x00f (esc)
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
   107
  p2copies: 1\x00d (esc)
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   108
  $ hg showcopies
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   109
  a -> g
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   110
  d -> h
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   111
  f -> i
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   112
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   113
Test writing to both changeset and filelog
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   114
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   115
  $ hg cp a j
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   116
  $ hg ci -m 'copy a to j' --config experimental.copies.write-to=compatibility
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   117
  $ hg changesetcopies
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   118
  files: j
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
   119
  filesadded: 0
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
   120
  filesremoved: 
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
   121
  
42426
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
   122
  p1copies: 0\x00a (esc)
42300
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
   123
  p2copies: 
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   124
  $ hg debugdata j 0
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   125
  \x01 (esc)
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   126
  copy: a
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   127
  copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   128
  \x01 (esc)
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   129
  a
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   130
  $ hg showcopies
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   131
  a -> j
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   132
  $ hg showcopies --config experimental.copies.read-from=compatibility
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   133
  a -> j
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   134
  $ hg showcopies --config experimental.copies.read-from=filelog-only
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   135
  a -> j
42300
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
   136
The entries should be written to extras even if they're empty (so the client
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
   137
won't have to fall back to reading from filelogs)
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
   138
  $ echo x >> j
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
   139
  $ hg ci -m 'modify j' --config experimental.copies.write-to=compatibility
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
   140
  $ hg changesetcopies
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
   141
  files: j
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
   142
  filesadded: 
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
   143
  filesremoved: 
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
   144
  
42300
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
   145
  p1copies: 
278dcb24e535 copies: write empty entries in changeset when also writing to filelog
Martin von Zweigbergk <martinvonz@google.com>
parents: 42291
diff changeset
   146
  p2copies: 
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   147
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   148
Test writing only to filelog
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   149
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   150
  $ hg cp a k
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   151
  $ hg ci -m 'copy a to k' --config experimental.copies.write-to=filelog-only
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   152
  $ hg changesetcopies
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   153
  files: k
42406
f385ba70e4af changelog: optionally store added and removed files in changeset extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42300
diff changeset
   154
  
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   155
  $ hg debugdata k 0
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   156
  \x01 (esc)
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   157
  copy: a
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   158
  copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   159
  \x01 (esc)
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   160
  a
42142
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   161
  $ hg showcopies
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   162
  $ hg showcopies --config experimental.copies.read-from=compatibility
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   163
  a -> k
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   164
  $ hg showcopies --config experimental.copies.read-from=filelog-only
5382d8f8530b changelog: parse copy metadata if available in extras
Martin von Zweigbergk <martinvonz@google.com>
parents: 42141
diff changeset
   165
  a -> k
42141
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   166
0e41f40b01cc copies: add config option for writing copy metadata to file and/or changset
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
   167
  $ cd ..
42289
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   168
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   169
Test rebasing a commit with copy information
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   170
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   171
  $ hg init rebase-rename
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   172
  $ cd rebase-rename
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   173
  $ echo a > a
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   174
  $ hg ci -Aqm 'add a'
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   175
  $ echo a2 > a
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   176
  $ hg ci -m 'modify a'
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   177
  $ hg co -q 0
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   178
  $ hg mv a b
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   179
  $ hg ci -qm 'rename a to b'
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   180
  $ hg rebase -d 1 --config rebase.experimental.inmemory=yes
42426
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
   181
  rebasing 2:fc7287ac5b9b "rename a to b" (tip)
42289
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   182
  merging a and b to b
42426
a1f87294471f copies: also encode p[12]copies destination as index into "files" list
Martin von Zweigbergk <martinvonz@google.com>
parents: 42406
diff changeset
   183
  saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/fc7287ac5b9b-8f2a95ec-rebase.hg
42289
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   184
  $ hg st --change . --copies
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   185
  A b
42291
a13b30555ffb context: reuse changectx._copies() in all but workingctx
Martin von Zweigbergk <martinvonz@google.com>
parents: 42289
diff changeset
   186
    a
42289
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   187
  R a
83b225fbd788 tests: demonstrate loss of changeset copy metadata on rebase
Martin von Zweigbergk <martinvonz@google.com>
parents: 42142
diff changeset
   188
  $ cd ..
42858
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   189
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   190
Test splitting a commit
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   191
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   192
  $ hg init split
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   193
  $ cd split
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   194
  $ echo a > a
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   195
  $ echo b > b
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   196
  $ hg ci -Aqm 'add a and b'
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   197
  $ echo a2 > a
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   198
  $ hg mv b c
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   199
  $ hg ci -m 'modify a, move b to c'
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   200
  $ (hg --config ui.interactive=yes split 2>&1 | grep mercurial.error) <<EOF
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   201
  > y
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   202
  > y
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   203
  > n
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   204
  > y
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   205
  > EOF
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   206
  mercurial.error.ProgrammingError: some copy targets missing from file list
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   207
  $ cd ..
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   208
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   209
Test committing half a rename
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   210
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   211
  $ hg init partial
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   212
  $ cd partial
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   213
  $ echo a > a
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   214
  $ hg ci -Aqm 'add a'
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   215
  $ hg mv a b
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   216
  $ hg ci -m 'remove a' a 2>&1 | grep mercurial.error
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   217
  mercurial.error.ProgrammingError: some copy targets missing from file list
170b070ec6a5 tests: demonstrate crash when committing subset of copies to changeset
Martin von Zweigbergk <martinvonz@google.com>
parents: 42427
diff changeset
   218
  $ cd ..