tests/test-rename.t
author Simon Sapin <simon.sapin@octobus.net>
Fri, 15 Oct 2021 16:12:00 +0200
changeset 48250 1730b2fceaa1
parent 45844 3175b0e0058b
child 48369 35f1ecd84bd0
permissions -rw-r--r--
dirstate-v2: adds a flag to mark a file as modified Right now, a files with a file system state that requires a lookup (same size, different mtime) will requires a lookup. If the result of that lookup is a modified files, it will remains ambiguous, requiring a lookup on the next status run too. To fix this, we introduce a dedicated flag in the new format. Such flag will allow to record such file as "known modified" avoiding an extra lookup later. As None of the associate code currently exist in the status code, we do the minimal implementation: if we read a dirstate entry with this flag set, we make it as "ambiguous" so that the next status code has to look it up. The same as it would have to without this flag existing anyway. Differential Revision: https://phab.mercurial-scm.org/D11681
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
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 12098
diff changeset
     9
  $ hg commit -m "1"
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    10
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    11
rename a single file
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    12
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    13
  $ hg rename d1/d11/a1 d2/c
13962
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12898
diff changeset
    14
  $ hg --config ui.portablefilenames=abort rename d1/a d1/con.xml
33798
2cd5aba5e1d2 scmutil: use util.shellquote instead of %r
Augie Fackler <augie@google.com>
parents: 33212
diff changeset
    15
  abort: filename contains 'con', which is reserved on Windows: d1/con.xml
45844
3175b0e0058b errors: use InputError for errors about bad paths
Martin von Zweigbergk <martinvonz@google.com>
parents: 45827
diff changeset
    16
  [10]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    17
  $ hg sum
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 12098
diff changeset
    18
  parent: 0:9b4b6e7b2c26 tip
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    19
   1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    20
  branch: default
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    21
  commit: 1 renamed
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    22
  update: (current)
25382
6084926366b9 summary: move the parents phase marker to commit line (issue4688)
Gilles Moris <gilles.moris@free.fr>
parents: 25111
diff changeset
    23
  phases: 1 draft
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    24
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    25
  A d2/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    26
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    27
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    28
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    29
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    30
  $ rm d2/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    31
12898
f2fd909053d9 test-rename: test with absolute paths
Martin Geisler <mg@aragost.com>
parents: 12897
diff changeset
    32
rename a single file using absolute paths
f2fd909053d9 test-rename: test with absolute paths
Martin Geisler <mg@aragost.com>
parents: 12897
diff changeset
    33
f2fd909053d9 test-rename: test with absolute paths
Martin Geisler <mg@aragost.com>
parents: 12897
diff changeset
    34
  $ hg rename `pwd`/d1/d11/a1 `pwd`/d2/c
f2fd909053d9 test-rename: test with absolute paths
Martin Geisler <mg@aragost.com>
parents: 12897
diff changeset
    35
  $ hg status -C
f2fd909053d9 test-rename: test with absolute paths
Martin Geisler <mg@aragost.com>
parents: 12897
diff changeset
    36
  A d2/c
f2fd909053d9 test-rename: test with absolute paths
Martin Geisler <mg@aragost.com>
parents: 12897
diff changeset
    37
    d1/d11/a1
f2fd909053d9 test-rename: test with absolute paths
Martin Geisler <mg@aragost.com>
parents: 12897
diff changeset
    38
  R d1/d11/a1
f2fd909053d9 test-rename: test with absolute paths
Martin Geisler <mg@aragost.com>
parents: 12897
diff changeset
    39
  $ hg update -C
f2fd909053d9 test-rename: test with absolute paths
Martin Geisler <mg@aragost.com>
parents: 12897
diff changeset
    40
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
f2fd909053d9 test-rename: test with absolute paths
Martin Geisler <mg@aragost.com>
parents: 12897
diff changeset
    41
  $ rm d2/c
f2fd909053d9 test-rename: test with absolute paths
Martin Geisler <mg@aragost.com>
parents: 12897
diff changeset
    42
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    43
rename --after a single file
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    44
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    45
  $ mv d1/d11/a1 d2/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    46
  $ hg rename --after d1/d11/a1 d2/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    47
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    48
  A d2/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    49
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    50
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    51
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    52
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    53
  $ rm d2/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    54
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    55
rename --after a single file when src and tgt already tracked
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
    56
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    57
  $ mv d1/d11/a1 d2/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    58
  $ hg addrem -s 0
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    59
  removing d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    60
  adding d2/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    61
  $ hg rename --after d1/d11/a1 d2/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    62
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    63
  A d2/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    64
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    65
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    66
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    67
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    68
  $ rm d2/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    69
17492
973c2b0b403c spelling: nonexistent
timeless@mozdev.org
parents: 16902
diff changeset
    70
rename --after a single file to a nonexistent target filename
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    71
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    72
  $ hg rename --after d1/a dummy
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
    73
  d1/a: not recording move - dummy does not exist
39350
5b92a717bfc1 rename: return error status if any rename/copy failed
Martin von Zweigbergk <martinvonz@google.com>
parents: 39348
diff changeset
    74
  [1]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    75
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    76
move a single file to an existing directory
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
    77
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    78
  $ hg rename d1/d11/a1 d2
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    79
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    80
  A d2/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    81
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    82
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    83
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    84
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    85
  $ rm d2/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    86
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    87
move --after a single file to an existing directory
11223
0d09f2244805 rename: make --after work if source is already in R state
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 11152
diff changeset
    88
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    89
  $ mv d1/d11/a1 d2
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    90
  $ hg rename --after d1/d11/a1 d2
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    91
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    92
  A d2/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    93
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    94
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    95
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    96
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    97
  $ rm d2/a1
11152
e8d10d085f47 cmdutil: Warn when trying to copy/rename --after to a nonexistant file.
Steve Losh <steve@stevelosh.com>
parents: 10466
diff changeset
    98
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
    99
rename a file using a relative path
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   100
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   101
  $ (cd d1/d11; hg rename ../../d2/b e)
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   102
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   103
  A d1/d11/e
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   104
    d2/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   105
  R d2/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   106
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   107
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   108
  $ rm d1/d11/e
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   109
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   110
rename --after a file using a relative path
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   111
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   112
  $ (cd d1/d11; mv ../../d2/b e; hg rename --after ../../d2/b e)
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   113
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   114
  A d1/d11/e
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   115
    d2/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   116
  R d2/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   117
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   118
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   119
  $ rm d1/d11/e
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   120
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   121
rename directory d1 as d3
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   122
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   123
  $ hg rename d1/ d3
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   124
  moving d1/a to d3/a
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   125
  moving d1/b to d3/b
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   126
  moving d1/ba to d3/ba
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   127
  moving d1/d11/a1 to d3/d11/a1
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   128
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   129
  A d3/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   130
    d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   131
  A d3/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   132
    d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   133
  A d3/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   134
    d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   135
  A d3/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   136
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   137
  R d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   138
  R d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   139
  R d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   140
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   141
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   142
  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   143
  $ rm -rf d3
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   144
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   145
rename --after directory d1 as d3
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   146
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   147
  $ mv d1 d3
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   148
  $ hg rename --after d1 d3
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   149
  moving d1/a to d3/a
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   150
  moving d1/b to d3/b
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   151
  moving d1/ba to d3/ba
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   152
  moving d1/d11/a1 to d3/d11/a1
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   153
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   154
  A d3/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   155
    d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   156
  A d3/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   157
    d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   158
  A d3/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   159
    d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   160
  A d3/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   161
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   162
  R d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   163
  R d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   164
  R d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   165
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   166
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   167
  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   168
  $ rm -rf d3
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   169
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   170
move a directory using a relative path
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   171
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   172
  $ (cd d2; mkdir d3; hg rename ../d1/d11 d3)
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   173
  moving ../d1/d11/a1 to d3/d11/a1
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   174
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   175
  A d2/d3/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   176
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   177
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   178
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   179
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   180
  $ rm -rf d2/d3
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   181
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   182
move --after a directory using a relative path
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   183
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   184
  $ (cd d2; mkdir d3; mv ../d1/d11 d3; hg rename --after ../d1/d11 d3)
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   185
  moving ../d1/d11/a1 to d3/d11/a1
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   186
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   187
  A d2/d3/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   188
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   189
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   190
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   191
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   192
  $ rm -rf d2/d3
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   193
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   194
move directory d1/d11 to an existing directory d2 (removes empty d1)
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   195
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   196
  $ hg rename d1/d11/ d2
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   197
  moving d1/d11/a1 to d2/d11/a1
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   198
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   199
  A d2/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   200
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   201
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   202
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   203
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   204
  $ rm -rf d2/d11
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   205
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   206
move directories d1 and d2 to a new directory d3
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   207
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   208
  $ mkdir d3
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   209
  $ hg rename d1 d2 d3
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   210
  moving d1/a to d3/d1/a
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   211
  moving d1/b to d3/d1/b
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   212
  moving d1/ba to d3/d1/ba
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   213
  moving d1/d11/a1 to d3/d1/d11/a1
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   214
  moving d2/b to d3/d2/b
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   215
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   216
  A d3/d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   217
    d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   218
  A d3/d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   219
    d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   220
  A d3/d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   221
    d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   222
  A d3/d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   223
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   224
  A d3/d2/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   225
    d2/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   226
  R d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   227
  R d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   228
  R d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   229
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   230
  R d2/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   231
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   232
  5 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   233
  $ rm -rf d3
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   234
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   235
move --after directories d1 and d2 to a new directory d3
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   236
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   237
  $ mkdir d3
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   238
  $ mv d1 d2 d3
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   239
  $ hg rename --after d1 d2 d3
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   240
  moving d1/a to d3/d1/a
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   241
  moving d1/b to d3/d1/b
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   242
  moving d1/ba to d3/d1/ba
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   243
  moving d1/d11/a1 to d3/d1/d11/a1
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   244
  moving d2/b to d3/d2/b
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   245
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   246
  A d3/d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   247
    d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   248
  A d3/d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   249
    d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   250
  A d3/d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   251
    d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   252
  A d3/d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   253
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   254
  A d3/d2/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   255
    d2/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   256
  R d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   257
  R d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   258
  R d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   259
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   260
  R d2/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   261
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   262
  5 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   263
  $ rm -rf d3
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   264
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   265
move everything under directory d1 to existing directory d2, do not
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   266
overwrite existing files (d2/b)
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   267
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   268
  $ hg rename d1/* d2
30151
381293e1135e copy: distinguish "file exists" cases and add a hint (BC)
Augie Fackler <augie@google.com>
parents: 25382
diff changeset
   269
  d2/b: not overwriting - file already committed
39348
cde75233c415 rename: quote hg commands in warnings
Martin von Zweigbergk <martinvonz@google.com>
parents: 37088
diff changeset
   270
  ('hg rename --force' to replace the file by recording a rename)
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   271
  moving d1/d11/a1 to d2/d11/a1
39350
5b92a717bfc1 rename: return error status if any rename/copy failed
Martin von Zweigbergk <martinvonz@google.com>
parents: 39348
diff changeset
   272
  [1]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   273
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   274
  A d2/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   275
    d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   276
  A d2/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   277
    d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   278
  A d2/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   279
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   280
  R d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   281
  R d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   282
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   283
  $ diff -u d1/b d2/b
12376
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
   284
  --- d1/b	* (glob)
97ffc68f71d3 tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents: 12375
diff changeset
   285
  +++ d2/b	* (glob)
12405
1f6abbd38783 test-rename: accept solaris diff
Mads Kiilerich <mads@kiilerich.com>
parents: 12376
diff changeset
   286
  @@ * (glob)
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   287
  -d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   288
  +d2/b
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   289
  [1]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   290
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   291
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   292
  $ rm d2/a d2/ba d2/d11/a1
5329
7e6138cb8d38 copy: if destination ends with "/", make sure it's a directory
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4742
diff changeset
   293
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   294
attempt to move one file into a non-existent directory
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   295
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   296
  $ hg rename d1/a dx/
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   297
  abort: destination dx/ is not a directory
45827
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 39350
diff changeset
   298
  [10]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   299
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   300
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   301
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   302
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   303
attempt to move potentially more than one file into a non-existent directory
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   304
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   305
  $ hg rename 'glob:d1/**' dx
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   306
  abort: with multiple sources, destination must be an existing directory
45827
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 39350
diff changeset
   307
  [10]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   308
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   309
move every file under d1 to d2/d21
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   310
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   311
  $ mkdir d2/d21
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   312
  $ hg rename 'glob:d1/**' d2/d21
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   313
  moving d1/a to d2/d21/a
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   314
  moving d1/b to d2/d21/b
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   315
  moving d1/ba to d2/d21/ba
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   316
  moving d1/d11/a1 to d2/d21/a1
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   317
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   318
  A d2/d21/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   319
    d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   320
  A d2/d21/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   321
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   322
  A d2/d21/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   323
    d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   324
  A d2/d21/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   325
    d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   326
  R d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   327
  R d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   328
  R d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   329
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   330
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   331
  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   332
  $ rm -rf d2/d21
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   333
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   334
move --after some files under d1 to d2/d21
1512
53ad6ee6ede4 generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
diff changeset
   335
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   336
  $ mkdir d2/d21
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   337
  $ mv d1/a d1/d11/a1 d2/d21
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   338
  $ hg rename --after 'glob:d1/**' d2/d21
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   339
  moving d1/a to d2/d21/a
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   340
  d1/b: not recording move - d2/d21/b does not exist
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   341
  d1/ba: not recording move - d2/d21/ba does not exist
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   342
  moving d1/d11/a1 to d2/d21/a1
39350
5b92a717bfc1 rename: return error status if any rename/copy failed
Martin von Zweigbergk <martinvonz@google.com>
parents: 39348
diff changeset
   343
  [1]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   344
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   345
  A d2/d21/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   346
    d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   347
  A d2/d21/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   348
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   349
  R d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   350
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   351
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   352
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   353
  $ rm -rf d2/d21
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   354
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   355
move every file under d1 starting with an 'a' to d2/d21 (regexp)
1565
4bcbc126b80b fix rename --after
Robin Farine <robin.farine@terminus.org>
parents: 1515
diff changeset
   356
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   357
  $ mkdir d2/d21
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   358
  $ hg rename 're:d1/([^a][^/]*/)*a.*' d2/d21
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   359
  moving d1/a to d2/d21/a
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   360
  moving d1/d11/a1 to d2/d21/a1
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   361
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   362
  A d2/d21/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   363
    d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   364
  A d2/d21/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   365
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   366
  R d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   367
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   368
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   369
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   370
  $ rm -rf d2/d21
1513
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   371
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   372
attempt to overwrite an existing file
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   373
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   374
  $ echo "ca" > d1/ca
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   375
  $ hg rename d1/ba d1/ca
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   376
  d1/ca: not overwriting - file exists
39348
cde75233c415 rename: quote hg commands in warnings
Martin von Zweigbergk <martinvonz@google.com>
parents: 37088
diff changeset
   377
  ('hg rename --after' to record the rename)
39350
5b92a717bfc1 rename: return error status if any rename/copy failed
Martin von Zweigbergk <martinvonz@google.com>
parents: 39348
diff changeset
   378
  [1]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   379
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   380
  ? d1/ca
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   381
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   382
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   383
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   384
forced overwrite of an existing file
1513
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   385
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   386
  $ echo "ca" > d1/ca
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   387
  $ hg rename --force d1/ba d1/ca
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   388
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   389
  A d1/ca
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   390
    d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   391
  R d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   392
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   393
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   394
  $ rm d1/ca
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   395
12345
e0ee3e822a9a Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12342 12316
diff changeset
   396
attempt to overwrite an existing broken symlink
12342
70236d6fd844 rename: do not overwrite existing broken symlinks
Patrick Mezard <pmezard@gmail.com>
parents: 11331
diff changeset
   397
16902
7f1cec2f63ab test-rename.t: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 15447
diff changeset
   398
#if symlink
12345
e0ee3e822a9a Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12342 12316
diff changeset
   399
  $ ln -s ba d1/ca
e0ee3e822a9a Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12342 12316
diff changeset
   400
  $ hg rename --traceback d1/ba d1/ca
e0ee3e822a9a Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12342 12316
diff changeset
   401
  d1/ca: not overwriting - file exists
39348
cde75233c415 rename: quote hg commands in warnings
Martin von Zweigbergk <martinvonz@google.com>
parents: 37088
diff changeset
   402
  ('hg rename --after' to record the rename)
39350
5b92a717bfc1 rename: return error status if any rename/copy failed
Martin von Zweigbergk <martinvonz@google.com>
parents: 39348
diff changeset
   403
  [1]
12345
e0ee3e822a9a Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12342 12316
diff changeset
   404
  $ hg status -C
e0ee3e822a9a Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12342 12316
diff changeset
   405
  ? d1/ca
e0ee3e822a9a Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12342 12316
diff changeset
   406
  $ hg update -C
e0ee3e822a9a Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12342 12316
diff changeset
   407
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
e0ee3e822a9a Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12342 12316
diff changeset
   408
  $ rm d1/ca
e0ee3e822a9a Merge with stable
Patrick Mezard <pmezard@gmail.com>
parents: 12342 12316
diff changeset
   409
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   410
replace a symlink with a file
1513
5c3b93b244aa copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents: 1512
diff changeset
   411
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   412
  $ ln -s ba d1/ca
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   413
  $ hg rename --force d1/ba d1/ca
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   414
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   415
  A d1/ca
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   416
    d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   417
  R d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   418
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   419
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   420
  $ rm d1/ca
16902
7f1cec2f63ab test-rename.t: enable for Windows
Adrian Buehlmann <adrian@cadifra.com>
parents: 15447
diff changeset
   421
#endif
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   422
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   423
do not copy more than one source file to the same destination file
1514
faf46d810a85 avoid to copy more than one file to the same destination file
Robin Farine <robin.farine@terminus.org>
parents: 1513
diff changeset
   424
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   425
  $ mkdir d3
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   426
  $ hg rename d1/* d2/* d3
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   427
  moving d1/d11/a1 to d3/d11/a1
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   428
  d3/b: not overwriting - d2/b collides with d1/b
39350
5b92a717bfc1 rename: return error status if any rename/copy failed
Martin von Zweigbergk <martinvonz@google.com>
parents: 39348
diff changeset
   429
  [1]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   430
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   431
  A d3/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   432
    d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   433
  A d3/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   434
    d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   435
  A d3/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   436
    d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   437
  A d3/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   438
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   439
  R d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   440
  R d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   441
  R d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   442
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   443
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   444
  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   445
  $ rm -rf d3
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   446
12897
81cdf836457e test-rename: fix \" -> " in comments
Martin Geisler <mg@aragost.com>
parents: 12405
diff changeset
   447
move a whole subtree with "hg rename ."
1633
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   448
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   449
  $ mkdir d3
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   450
  $ (cd d1; hg rename . ../d3)
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   451
  moving a to ../d3/d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   452
  moving b to ../d3/d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   453
  moving ba to ../d3/d1/ba
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   454
  moving d11/a1 to ../d3/d1/d11/a1
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   455
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   456
  A d3/d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   457
    d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   458
  A d3/d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   459
    d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   460
  A d3/d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   461
    d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   462
  A d3/d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   463
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   464
  R d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   465
  R d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   466
  R d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   467
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   468
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   469
  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   470
  $ rm -rf d3
1633
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   471
12897
81cdf836457e test-rename: fix \" -> " in comments
Martin Geisler <mg@aragost.com>
parents: 12405
diff changeset
   472
move a whole subtree with "hg rename --after ."
1633
94c179a92f4a copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents: 1565
diff changeset
   473
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   474
  $ mkdir d3
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   475
  $ mv d1/* d3
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   476
  $ (cd d1; hg rename --after . ../d3)
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   477
  moving a to ../d3/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   478
  moving b to ../d3/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   479
  moving ba to ../d3/ba
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   480
  moving d11/a1 to ../d3/d11/a1
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   481
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   482
  A d3/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   483
    d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   484
  A d3/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   485
    d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   486
  A d3/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   487
    d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   488
  A d3/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   489
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   490
  R d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   491
  R d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   492
  R d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   493
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   494
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   495
  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   496
  $ rm -rf d3
1634
f49f602fae92 copy & rename can ignore removed source files
Robin Farine <robin.farine@terminus.org>
parents: 1633
diff changeset
   497
12897
81cdf836457e test-rename: fix \" -> " in comments
Martin Geisler <mg@aragost.com>
parents: 12405
diff changeset
   498
move the parent tree with "hg rename .."
1747
91c56c427171 transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents: 1634
diff changeset
   499
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   500
  $ (cd d1/d11; hg rename .. ../../d3)
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   501
  moving ../a to ../../d3/a
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   502
  moving ../b to ../../d3/b
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   503
  moving ../ba to ../../d3/ba
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   504
  moving a1 to ../../d3/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   505
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   506
  A d3/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   507
    d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   508
  A d3/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   509
    d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   510
  A d3/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   511
    d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   512
  A d3/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   513
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   514
  R d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   515
  R d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   516
  R d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   517
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   518
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   519
  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   520
  $ rm -rf d3
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   521
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   522
skip removed files
1747
91c56c427171 transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents: 1634
diff changeset
   523
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   524
  $ hg remove d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   525
  $ hg rename d1 d3
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   526
  moving d1/a to d3/a
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   527
  moving d1/ba to d3/ba
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   528
  moving d1/d11/a1 to d3/d11/a1
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   529
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   530
  A d3/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   531
    d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   532
  A d3/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   533
    d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   534
  A d3/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   535
    d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   536
  R d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   537
  R d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   538
  R d1/ba
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   539
  R d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   540
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   541
  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   542
  $ rm -rf d3
1822
64df4220b349 copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents: 1747
diff changeset
   543
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   544
transitive rename
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   545
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   546
  $ hg rename d1/b d1/bb
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   547
  $ hg rename d1/bb d1/bc
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   548
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   549
  A d1/bc
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   550
    d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   551
  R d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   552
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   553
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   554
  $ rm d1/bc
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   555
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   556
transitive rename --after
10466
d1f209bb9564 patch: separate reverse copy data (issue1959)
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 8518
diff changeset
   557
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   558
  $ hg rename d1/b d1/bb
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   559
  $ mv d1/bb d1/bc
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   560
  $ hg rename --after d1/bb d1/bc
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   561
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   562
  A d1/bc
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   563
    d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   564
  R d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   565
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   566
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   567
  $ rm d1/bc
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   568
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   569
  $ echo "# idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)"
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   570
  # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   571
  $ hg rename d1/b d1/bb
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   572
  $ echo "some stuff added to d1/bb" >> d1/bb
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   573
  $ hg rename d1/bb d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   574
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   575
  M d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   576
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   577
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   578
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   579
overwriting with renames (issue1959)
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   580
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   581
  $ hg rename d1/a d1/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   582
  $ hg rename d1/b d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   583
  $ hg status -C
23402
2963d5c9d90b rename: properly report removed and added file as modified (issue4458)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23401
diff changeset
   584
  M d1/a
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   585
    d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   586
  A d1/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   587
    d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   588
  R d1/b
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   589
  $ hg diff --git
23402
2963d5c9d90b rename: properly report removed and added file as modified (issue4458)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23401
diff changeset
   590
  diff --git a/d1/a b/d1/a
2963d5c9d90b rename: properly report removed and added file as modified (issue4458)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23401
diff changeset
   591
  --- a/d1/a
2963d5c9d90b rename: properly report removed and added file as modified (issue4458)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23401
diff changeset
   592
  +++ b/d1/a
2963d5c9d90b rename: properly report removed and added file as modified (issue4458)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23401
diff changeset
   593
  @@ -1,1 +1,1 @@
2963d5c9d90b rename: properly report removed and added file as modified (issue4458)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23401
diff changeset
   594
  -d1/a
2963d5c9d90b rename: properly report removed and added file as modified (issue4458)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23401
diff changeset
   595
  +d1/b
2963d5c9d90b rename: properly report removed and added file as modified (issue4458)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23401
diff changeset
   596
  diff --git a/d1/b b/d1/b
2963d5c9d90b rename: properly report removed and added file as modified (issue4458)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23401
diff changeset
   597
  deleted file mode 100644
2963d5c9d90b rename: properly report removed and added file as modified (issue4458)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23401
diff changeset
   598
  --- a/d1/b
2963d5c9d90b rename: properly report removed and added file as modified (issue4458)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23401
diff changeset
   599
  +++ /dev/null
2963d5c9d90b rename: properly report removed and added file as modified (issue4458)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23401
diff changeset
   600
  @@ -1,1 +0,0 @@
2963d5c9d90b rename: properly report removed and added file as modified (issue4458)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23401
diff changeset
   601
  -d1/b
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   602
  diff --git a/d1/a b/d1/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   603
  copy from d1/a
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   604
  copy to d1/c
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   605
  $ hg update -C
23401
fd1bab28a8cc manifest: fix a bug where working copy file 'add' mark was buggy
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 18506
diff changeset
   606
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
fd1bab28a8cc manifest: fix a bug where working copy file 'add' mark was buggy
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 18506
diff changeset
   607
  $ rm d1/c # The file was marked as added, so 'hg update' action  was 'forget'
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   608
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   609
check illegal path components
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   610
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   611
  $ hg rename d1/d11/a1 .hg/foo
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   612
  abort: path contains illegal component: .hg/foo
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   613
  [255]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   614
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   615
  $ hg rename d1/d11/a1 ../foo
18450
4f9a52858512 scmutil: localize and improve 'not under root' message
Mads Kiilerich <madski@unity3d.com>
parents: 17492
diff changeset
   616
  abort: ../foo not under root '$TESTTMP'
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   617
  [255]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   618
  $ hg status -C
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   619
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   620
  $ mv d1/d11/a1 .hg/foo
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   621
  $ hg rename --after d1/d11/a1 .hg/foo
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   622
  abort: path contains illegal component: .hg/foo
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   623
  [255]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   624
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   625
  ! d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   626
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   627
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   628
  $ rm .hg/foo
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   629
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   630
  $ hg rename d1/d11/a1 .hg
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   631
  abort: path contains illegal component: .hg/a1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   632
  [255]
24006
42fa7eeb858e largefiles: use the core file copy logic to validate the destination path
Matt Harbison <matt_harbison@yahoo.com>
parents: 23402
diff changeset
   633
  $ hg --config extensions.largefiles= rename d1/d11/a1 .hg
33212
fe0667cc521e tests: add fsmonitor specific output lines at enabling largefiles
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30151
diff changeset
   634
  The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   635
  abort: path contains illegal component: .hg/a1
24006
42fa7eeb858e largefiles: use the core file copy logic to validate the destination path
Matt Harbison <matt_harbison@yahoo.com>
parents: 23402
diff changeset
   636
  [255]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   637
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   638
  $ hg rename d1/d11/a1 ..
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   639
  abort: ../a1 not under root '$TESTTMP'
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   640
  [255]
24006
42fa7eeb858e largefiles: use the core file copy logic to validate the destination path
Matt Harbison <matt_harbison@yahoo.com>
parents: 23402
diff changeset
   641
  $ hg --config extensions.largefiles= rename d1/d11/a1 ..
33212
fe0667cc521e tests: add fsmonitor specific output lines at enabling largefiles
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30151
diff changeset
   642
  The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !)
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   643
  abort: ../a1 not under root '$TESTTMP'
24006
42fa7eeb858e largefiles: use the core file copy logic to validate the destination path
Matt Harbison <matt_harbison@yahoo.com>
parents: 23402
diff changeset
   644
  [255]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   645
  $ hg status -C
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   646
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   647
  $ mv d1/d11/a1 .hg
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   648
  $ hg rename --after d1/d11/a1 .hg
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   649
  abort: path contains illegal component: .hg/a1
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   650
  [255]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   651
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   652
  ! d1/d11/a1
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   653
  $ hg update -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   654
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   655
  $ rm .hg/a1
1976
df8416346bb7 Enable path validation for copy, rename, debugwalk and other canonpath users.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1933
diff changeset
   656
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   657
  $ (cd d1/d11; hg rename ../../d2/b ../../.hg/foo)
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 33798
diff changeset
   658
  abort: path contains illegal component: .hg/foo
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   659
  [255]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   660
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   661
  $ (cd d1/d11; hg rename ../../d2/b ../../../foo)
18450
4f9a52858512 scmutil: localize and improve 'not under root' message
Mads Kiilerich <madski@unity3d.com>
parents: 17492
diff changeset
   662
  abort: ../../../foo not under root '$TESTTMP'
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12156
diff changeset
   663
  [255]
12098
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   664
  $ hg status -C
12108d7f2ce1 tests: unify test-rename
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11551
diff changeset
   665
37088
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   666
check that stat information such as mtime is preserved on rename - it's unclear
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   667
whether the `touch` and `stat` commands are portable, so we mimic them using
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   668
python.  Not all platforms support precision of even one-second granularity, so
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   669
we allow a rather generous fudge factor here; 1234567890 is 2009, and the
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   670
primary thing we care about is that it's not the machine's current time;
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   671
hopefully it's really unlikely for a machine to have such a broken clock that
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   672
this test fails. :)
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   673
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   674
  $ mkdir mtime
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   675
Create the file (as empty), then update its mtime and atime to be 1234567890.
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   676
  >>> import os
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   677
  >>> filename = "mtime/f"
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   678
  >>> mtime = 1234567890
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   679
  >>> open(filename, "w").close()
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   680
  >>> os.utime(filename, (mtime, mtime))
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   681
  $ hg ci -qAm 'add mtime dir'
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   682
"hg cp" does not preserve the mtime, so it should be newer than the 2009
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   683
timestamp.
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   684
  $ hg cp -q mtime mtime_cp
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   685
  >>> from __future__ import print_function
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   686
  >>> import os
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   687
  >>> filename = "mtime_cp/f"
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   688
  >>> print(os.stat(filename).st_mtime < 1234567999)
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   689
  False
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   690
"hg mv" preserves the mtime, so it should be ~equal to the 2009 timestamp
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   691
(modulo some fudge factor due to not every system supporting 1s-level
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   692
precision).
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   693
  $ hg mv -q mtime mtime_mv
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   694
  >>> from __future__ import print_function
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   695
  >>> import os
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   696
  >>> filename = "mtime_mv/f"
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   697
  >>> print(os.stat(filename).st_mtime < 1234567999)
08890706366e copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Kyle Lippincott <spectral@google.com>
parents: 35393
diff changeset
   698
  True