tests/test-rename-rev.t
author Gregory Szorc <gregory.szorc@gmail.com>
Sat, 19 Feb 2022 18:42:12 -0700
changeset 48938 4561ec90d3c1
parent 48258 c62e4397eb28
permissions -rw-r--r--
automation: delete code related to Python 2.7 support The building of Inno and WiX installers took a python_version argument that allowed us to specify "2" or "3" for the major Python version. Since we no longer support Python 2, we can delete this argument and everything feeding into it. Differential Revision: https://phab.mercurial-scm.org/D12264
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
     1
  $ hg init
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
     2
  $ mkdir d1 d1/d11 d2
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
     3
  $ echo d1/a > d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
     4
  $ echo d1/ba > d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
     5
  $ echo d1/a1 > d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
     6
  $ echo d1/b > d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
     7
  $ echo d2/b > d2/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
     8
  $ hg add d1/a d1/b d1/ba d1/d11/a1 d2/b
44401
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
     9
  $ hg commit -m "intial"
12898
f2fd909053d9 test-rename: test with absolute paths
Martin Geisler <mg@aragost.com>
parents: 12897
diff changeset
    10
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    11
44401
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    12
Test single file
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    13
44771
d2741ab1f8b7 tests: show poor error message for `hg cp -A --at-rev . non-existent dst`
Martin von Zweigbergk <martinvonz@google.com>
parents: 44770
diff changeset
    14
# One recorded copy, one copy to record after commit
44401
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    15
  $ hg cp d1/b d1/c
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    16
  $ cp d1/b d1/d
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    17
  $ hg add d1/d
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    18
  $ hg ci -m 'copy d1/b to d1/c and d1/d'
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    19
  $ hg st -C --change .
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    20
  A d1/c
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    21
    d1/b
44401
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    22
  A d1/d
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    23
# Errors out without --after for now
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    24
  $ hg cp --at-rev . d1/b d1/d
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    25
  abort: --at-rev requires --after
45846
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 45389
diff changeset
    26
  [10]
44771
d2741ab1f8b7 tests: show poor error message for `hg cp -A --at-rev . non-existent dst`
Martin von Zweigbergk <martinvonz@google.com>
parents: 44770
diff changeset
    27
# Errors out with non-existent source
d2741ab1f8b7 tests: show poor error message for `hg cp -A --at-rev . non-existent dst`
Martin von Zweigbergk <martinvonz@google.com>
parents: 44770
diff changeset
    28
  $ hg cp -A --at-rev . d1/non-existent d1/d
d2741ab1f8b7 tests: show poor error message for `hg cp -A --at-rev . non-existent dst`
Martin von Zweigbergk <martinvonz@google.com>
parents: 44770
diff changeset
    29
  d1/non-existent: no such file in rev 55d1fd85ef0a
44772
c5574408254a copy: give better error message when no source paths found with --at-rev
Martin von Zweigbergk <martinvonz@google.com>
parents: 44771
diff changeset
    30
  abort: no files to copy
45846
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 45389
diff changeset
    31
  [10]
44401
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    32
# Errors out with non-existent destination
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    33
  $ hg cp -A --at-rev . d1/b d1/non-existent
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    34
  abort: d1/non-existent: copy destination does not exist in 8a9d70fa20c9
45846
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 45389
diff changeset
    35
  [10]
44401
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    36
# Successful invocation
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    37
  $ hg cp -A --at-rev . d1/b d1/d
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    38
  saved backup bundle to $TESTTMP/.hg/strip-backup/8a9d70fa20c9-973ae357-copy.hg
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    39
# New copy is recorded, and previously recorded copy is also still there
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    40
  $ hg st -C --change .
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    41
  A d1/c
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    42
    d1/b
44401
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
    43
  A d1/d
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    44
    d1/b
48258
c62e4397eb28 copy: recommend `--at-rev .` if target was added in parent commit
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    45
# Should get helpful message if we try to copy or rename after commit
c62e4397eb28 copy: recommend `--at-rev .` if target was added in parent commit
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    46
  $ hg cp --forget --at-rev . d1/d
c62e4397eb28 copy: recommend `--at-rev .` if target was added in parent commit
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    47
  saved backup bundle to $TESTTMP/.hg/strip-backup/3f7c325d3f9e-46f377bb-uncopy.hg
c62e4397eb28 copy: recommend `--at-rev .` if target was added in parent commit
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    48
  $ hg cp d1/b d1/d
c62e4397eb28 copy: recommend `--at-rev .` if target was added in parent commit
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    49
  d1/d: not overwriting - file already committed
c62e4397eb28 copy: recommend `--at-rev .` if target was added in parent commit
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    50
  ('hg copy --at-rev .' to record the copy in the parent of the working copy)
c62e4397eb28 copy: recommend `--at-rev .` if target was added in parent commit
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    51
  [1]
c62e4397eb28 copy: recommend `--at-rev .` if target was added in parent commit
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    52
  $ hg mv d1/b d1/d
c62e4397eb28 copy: recommend `--at-rev .` if target was added in parent commit
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    53
  d1/d: not overwriting - file already committed
c62e4397eb28 copy: recommend `--at-rev .` if target was added in parent commit
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    54
  ('hg rename --at-rev .' to record the rename in the parent of the working copy)
c62e4397eb28 copy: recommend `--at-rev .` if target was added in parent commit
Martin von Zweigbergk <martinvonz@google.com>
parents: 45846
diff changeset
    55
  [1]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    56
45389
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    57
Test moved file (not copied) using 'hg cp' command
44769
af9970501021 tests: show that `hg cp -A --at-rev .` doesn't work for renames
Martin von Zweigbergk <martinvonz@google.com>
parents: 44401
diff changeset
    58
af9970501021 tests: show that `hg cp -A --at-rev .` doesn't work for renames
Martin von Zweigbergk <martinvonz@google.com>
parents: 44401
diff changeset
    59
  $ hg co 0
af9970501021 tests: show that `hg cp -A --at-rev .` doesn't work for renames
Martin von Zweigbergk <martinvonz@google.com>
parents: 44401
diff changeset
    60
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
af9970501021 tests: show that `hg cp -A --at-rev .` doesn't work for renames
Martin von Zweigbergk <martinvonz@google.com>
parents: 44401
diff changeset
    61
  $ mv d1/b d1/d
af9970501021 tests: show that `hg cp -A --at-rev .` doesn't work for renames
Martin von Zweigbergk <martinvonz@google.com>
parents: 44401
diff changeset
    62
  $ hg rm -A d1/b
af9970501021 tests: show that `hg cp -A --at-rev .` doesn't work for renames
Martin von Zweigbergk <martinvonz@google.com>
parents: 44401
diff changeset
    63
  $ hg add d1/d
af9970501021 tests: show that `hg cp -A --at-rev .` doesn't work for renames
Martin von Zweigbergk <martinvonz@google.com>
parents: 44401
diff changeset
    64
  $ hg ci -m 'move d1/b to d1/d'
af9970501021 tests: show that `hg cp -A --at-rev .` doesn't work for renames
Martin von Zweigbergk <martinvonz@google.com>
parents: 44401
diff changeset
    65
  created new head
af9970501021 tests: show that `hg cp -A --at-rev .` doesn't work for renames
Martin von Zweigbergk <martinvonz@google.com>
parents: 44401
diff changeset
    66
  $ hg cp -A --at-rev . d1/b d1/d
44770
1cdc80280286 copy: to find copy source, walk parent of revision we're marking copies in
Martin von Zweigbergk <martinvonz@google.com>
parents: 44769
diff changeset
    67
  saved backup bundle to $TESTTMP/.hg/strip-backup/519850c3ea27-153c8fbb-copy.hg
44769
af9970501021 tests: show that `hg cp -A --at-rev .` doesn't work for renames
Martin von Zweigbergk <martinvonz@google.com>
parents: 44401
diff changeset
    68
  $ hg st -C --change .
af9970501021 tests: show that `hg cp -A --at-rev .` doesn't work for renames
Martin von Zweigbergk <martinvonz@google.com>
parents: 44401
diff changeset
    69
  A d1/d
44770
1cdc80280286 copy: to find copy source, walk parent of revision we're marking copies in
Martin von Zweigbergk <martinvonz@google.com>
parents: 44769
diff changeset
    70
    d1/b
44769
af9970501021 tests: show that `hg cp -A --at-rev .` doesn't work for renames
Martin von Zweigbergk <martinvonz@google.com>
parents: 44401
diff changeset
    71
  R d1/b
af9970501021 tests: show that `hg cp -A --at-rev .` doesn't work for renames
Martin von Zweigbergk <martinvonz@google.com>
parents: 44401
diff changeset
    72
45389
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    73
Test moved file (not copied) using 'hg mv' command
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    74
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    75
  $ hg co 0
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    76
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    77
  $ mv d1/b d1/d
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    78
  $ hg rm -A d1/b
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    79
  $ hg add d1/d
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    80
  $ hg ci -m 'move d1/b to d1/d'
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    81
  created new head
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    82
  $ hg mv -A --at-rev . d1/b d1/d
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    83
  saved backup bundle to $TESTTMP/.hg/strip-backup/519850c3ea27-153c8fbb-copy.hg
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    84
  $ hg st -C --change .
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    85
  A d1/d
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    86
    d1/b
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    87
  R d1/b
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    88
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    89
Test moved file (not copied) for which source still exists
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    90
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    91
  $ hg co 0
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    92
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    93
  $ cp d1/b d1/d
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    94
  $ hg add d1/d
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    95
  $ hg ci -m 'copy d1/b to d1/d'
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    96
  created new head
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    97
  $ hg mv -A --at-rev . d1/b d1/d
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    98
  saved backup bundle to $TESTTMP/.hg/strip-backup/c8d0f6bcf7ca-1c9bb53e-copy.hg
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
    99
  $ hg st -C --change .
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
   100
  A d1/d
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
   101
    d1/b
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
   102
44401
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
   103
Test using directory as destination
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   104
44401
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
   105
  $ hg co 0
45389
5178dd2233d0 rename: add support for --at-rev, which marks as copy and removes the source
Martin von Zweigbergk <martinvonz@google.com>
parents: 44772
diff changeset
   106
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
44401
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
   107
  $ cp -R d1 d3
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
   108
  $ hg add d3
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
   109
  adding d3/a
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
   110
  adding d3/b
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
   111
  adding d3/ba
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
   112
  adding d3/d11/a1
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
   113
  $ hg ci -m 'copy d1/ to d3/'
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
   114
  created new head
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
   115
  $ hg cp -A --at-rev . d1 d3
9dab3fa64325 copy: add experimental support for marking committed copies
Martin von Zweigbergk <martinvonz@google.com>
parents: 39377
diff changeset
   116
  abort: d3: --at-rev does not support a directory as destination
45846
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 45389
diff changeset
   117
  [10]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   118