tests/test-copy.t
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Tue, 04 Jul 2017 23:13:46 +0900
changeset 33278 87bca10a06ed
parent 32267 c2380b448265
child 33425 886207fb18ab
permissions -rw-r--r--
transaction: avoid file stat ambiguity only for files in blacklist Advancing mtime by os.utime() fails for EPERM, if the target file is owned by another. bff5ccbe5ead and related changes made some code paths give advancing mtime up in such case, to fix issue5418. This causes file stat ambiguity (again), if it is owned by another. https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan To avoid file stat ambiguity in such case, especially for .hg/dirstate, ed66ec39933f made vfs.rename() copy the target file, and advance mtime of renamed one again, if EPERM (see issue5584 for detail). But straightforward "copy if EPERM" isn't reasonable for truncation of append-only files at rollbacking, because rollbacking might cost much for truncation of many filelogs, even though filelogs aren't filecache-ed. Therefore, this patch introduces blacklist "checkambigfiles", and avoids file stat ambiguity only for files specified in this blacklist. This patch consists of two parts below, which should be applied at once in order to avoid regression. - specify 'checkambig=True' at vfs.open(mode='a') in _playback() according to checkambigfiles - invoke _playback() with checkambigfiles - add transaction.__init__() checkambigfiles argument, for _abort() - make localrepo instantiate transaction with _cachedfiles - add rollback() checkambigfiles argument, for "hg rollback/recover" - make localrepo invoke rollback() with _cachedfiles After this patch, straightforward "copy if EPERM" will be reasonable at closing the file opened with checkambig=True, because this policy is applied only on files, which are listed in blacklist "checkambigfiles".
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26919
aa23e02f9415 test: enable generaldelta in 'test-copy.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25472
diff changeset
     1
# enable bundle2 in advance
aa23e02f9415 test: enable generaldelta in 'test-copy.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25472
diff changeset
     2
aa23e02f9415 test: enable generaldelta in 'test-copy.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25472
diff changeset
     3
  $ cat << EOF >> $HGRCPATH
aa23e02f9415 test: enable generaldelta in 'test-copy.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25472
diff changeset
     4
  > [format]
aa23e02f9415 test: enable generaldelta in 'test-copy.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25472
diff changeset
     5
  > usegeneraldelta=yes
aa23e02f9415 test: enable generaldelta in 'test-copy.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25472
diff changeset
     6
  > EOF
16856
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
     7
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
     8
  $ mkdir part1
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
     9
  $ cd part1
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
    10
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    11
  $ hg init
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    12
  $ echo a > a
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    13
  $ hg add a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    14
  $ hg commit -m "1"
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    15
  $ hg status
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    16
  $ hg copy a b
13962
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    17
  $ hg --config ui.portablefilenames=abort copy a con.xml
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    18
  abort: filename contains 'con', which is reserved on Windows: 'con.xml'
8b252e826c68 add: introduce a warning message for non-portable filenames (issue2756) (BC)
Adrian Buehlmann <adrian@cadifra.com>
parents: 12156
diff changeset
    19
  [255]
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    20
  $ hg status
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    21
  A b
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    22
  $ hg sum
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    23
  parent: 0:c19d34741b0a tip
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    24
   1
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    25
  branch: default
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    26
  commit: 1 copied
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    27
  update: (current)
25382
6084926366b9 summary: move the parents phase marker to commit line (issue4688)
Gilles Moris <gilles.moris@free.fr>
parents: 25111
diff changeset
    28
  phases: 1 draft
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    29
  $ hg --debug commit -m "2"
23749
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 23285
diff changeset
    30
  committing files:
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    31
  b
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    32
   b: copy a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
23749
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 23285
diff changeset
    33
  committing manifest
a387b0390082 localrepo: show headline notes in commitctx before showing filenames
Mads Kiilerich <madski@unity3d.com>
parents: 23285
diff changeset
    34
  committing changelog
32267
c2380b448265 caches: move the 'updating the branch cache' message in 'updatecaches'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 30151
diff changeset
    35
  updating the branch cache
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    36
  committed changeset 1:93580a2c28a50a56f63526fb305067e6fbf739c4
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    37
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    38
we should see two history entries
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    39
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    40
  $ hg history -v
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    41
  changeset:   1:93580a2c28a5
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    42
  tag:         tip
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    43
  user:        test
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    44
  date:        Thu Jan 01 00:00:00 1970 +0000
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    45
  files:       b
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    46
  description:
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    47
  2
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    48
  
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    49
  
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    50
  changeset:   0:c19d34741b0a
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    51
  user:        test
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    52
  date:        Thu Jan 01 00:00:00 1970 +0000
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    53
  files:       a
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    54
  description:
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    55
  1
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    56
  
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    57
  
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    58
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    59
we should see one log entry for a
363
ae96b7e1318d Add hg copy
mpm@selenic.com
parents:
diff changeset
    60
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    61
  $ hg log a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    62
  changeset:   0:c19d34741b0a
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    63
  user:        test
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    64
  date:        Thu Jan 01 00:00:00 1970 +0000
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    65
  summary:     1
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    66
  
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    67
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    68
this should show a revision linked to changeset 0
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    69
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 13962
diff changeset
    70
  $ hg debugindex a
17132
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 16913
diff changeset
    71
     rev    offset  length  ..... linkrev nodeid       p1           p2 (re)
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 16913
diff changeset
    72
       0         0       3  .....       0 b789fdd96dc2 000000000000 000000000000 (re)
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    73
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    74
we should see one log entry for b
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    75
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    76
  $ hg log b
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    77
  changeset:   1:93580a2c28a5
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    78
  tag:         tip
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    79
  user:        test
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    80
  date:        Thu Jan 01 00:00:00 1970 +0000
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    81
  summary:     2
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    82
  
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    83
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    84
this should show a revision linked to changeset 1
1043
9344f5dd4488 Update tests
mpm@selenic.com
parents: 814
diff changeset
    85
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 13962
diff changeset
    86
  $ hg debugindex b
17132
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 16913
diff changeset
    87
     rev    offset  length  ..... linkrev nodeid       p1           p2 (re)
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 16913
diff changeset
    88
       0         0      65  .....       1 37d9b5d994ea 000000000000 000000000000 (re)
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    89
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    90
this should show the rename information in the metadata
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    91
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 13962
diff changeset
    92
  $ hg debugdata b 0 | head -3 | tail -2
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    93
  copy: a
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    94
  copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
1043
9344f5dd4488 Update tests
mpm@selenic.com
parents: 814
diff changeset
    95
25472
4d2b9b304ad0 tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents: 25382
diff changeset
    96
  $ md5sum.py .hg/store/data/b.i
26919
aa23e02f9415 test: enable generaldelta in 'test-copy.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 25472
diff changeset
    97
  44913824c8f5890ae218f9829535922e  .hg/store/data/b.i
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    98
  $ hg cat b > bsum
25472
4d2b9b304ad0 tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents: 25382
diff changeset
    99
  $ md5sum.py bsum
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
   100
  60b725f10c9c85c70d97880dfe8191b3  bsum
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
   101
  $ hg cat a > asum
25472
4d2b9b304ad0 tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents: 25382
diff changeset
   102
  $ md5sum.py asum
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
   103
  60b725f10c9c85c70d97880dfe8191b3  asum
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
   104
  $ hg verify
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
   105
  checking changesets
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
   106
  checking manifests
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
   107
  crosschecking files in changesets and manifests
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
   108
  checking files
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
   109
  2 files, 2 changesets, 2 total revisions
16856
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   110
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   111
  $ cd ..
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   112
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   113
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   114
  $ mkdir part2
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   115
  $ cd part2
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   116
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   117
  $ hg init
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   118
  $ echo foo > foo
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   119
should fail - foo is not managed
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   120
  $ hg mv foo bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   121
  foo: not copying - file is not managed
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   122
  abort: no files to copy
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   123
  [255]
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   124
  $ hg st -A
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   125
  ? foo
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   126
  $ hg add foo
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   127
dry-run; print a warning that this is not a real copy; foo is added
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   128
  $ hg mv --dry-run foo bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   129
  foo has not been committed yet, so no copy data will be stored for bar.
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   130
  $ hg st -A
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   131
  A foo
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   132
should print a warning that this is not a real copy; bar is added
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   133
  $ hg mv foo bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   134
  foo has not been committed yet, so no copy data will be stored for bar.
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   135
  $ hg st -A
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   136
  A bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   137
should print a warning that this is not a real copy; foo is added
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   138
  $ hg cp bar foo
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   139
  bar has not been committed yet, so no copy data will be stored for foo.
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   140
  $ hg rm -f bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   141
  $ rm bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   142
  $ hg st -A
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   143
  A foo
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   144
  $ hg commit -m1
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   145
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   146
moving a missing file
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   147
  $ rm foo
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   148
  $ hg mv foo foo3
24364
135b23868f45 commands: replace "working copy" with "working directory" in help/messages
Yuya Nishihara <yuya@tcha.org>
parents: 23958
diff changeset
   149
  foo: deleted in working directory
16856
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   150
  foo3 does not exist!
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   151
  $ hg up -qC .
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   152
17492
973c2b0b403c spelling: nonexistent
timeless@mozdev.org
parents: 17132
diff changeset
   153
copy --after to a nonexistent target filename
16856
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   154
  $ hg cp -A foo dummy
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   155
  foo: not recording copy - dummy does not exist
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   156
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   157
dry-run; should show that foo is clean
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   158
  $ hg copy --dry-run foo bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   159
  $ hg st -A
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   160
  C foo
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   161
should show copy
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   162
  $ hg copy foo bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   163
  $ hg st -C
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   164
  A bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   165
    foo
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   166
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   167
shouldn't show copy
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   168
  $ hg commit -m2
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   169
  $ hg st -C
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   170
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   171
should match
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   172
  $ hg debugindex foo
17132
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 16913
diff changeset
   173
     rev    offset  length  ..... linkrev nodeid       p1           p2 (re)
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 16913
diff changeset
   174
       0         0       5  .....       0 2ed2a3912a0b 000000000000 000000000000 (re)
16856
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   175
  $ hg debugrename bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   176
  bar renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   177
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   178
  $ echo bleah > foo
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   179
  $ echo quux > bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   180
  $ hg commit -m3
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   181
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   182
should not be renamed
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   183
  $ hg debugrename bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   184
  bar not renamed
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   185
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   186
  $ hg copy -f foo bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   187
should show copy
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   188
  $ hg st -C
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   189
  M bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   190
    foo
23958
df463ca0adef largefiles: revert to lfilesrepo.status() being an unfiltered method
Matt Harbison <matt_harbison@yahoo.com>
parents: 23749
diff changeset
   191
df463ca0adef largefiles: revert to lfilesrepo.status() being an unfiltered method
Matt Harbison <matt_harbison@yahoo.com>
parents: 23749
diff changeset
   192
XXX: filtering lfilesrepo.status() in 3.3-rc causes the copy source to not be
df463ca0adef largefiles: revert to lfilesrepo.status() being an unfiltered method
Matt Harbison <matt_harbison@yahoo.com>
parents: 23749
diff changeset
   193
displayed.
df463ca0adef largefiles: revert to lfilesrepo.status() being an unfiltered method
Matt Harbison <matt_harbison@yahoo.com>
parents: 23749
diff changeset
   194
  $ hg st -C --config extensions.largefiles=
df463ca0adef largefiles: revert to lfilesrepo.status() being an unfiltered method
Matt Harbison <matt_harbison@yahoo.com>
parents: 23749
diff changeset
   195
  M bar
df463ca0adef largefiles: revert to lfilesrepo.status() being an unfiltered method
Matt Harbison <matt_harbison@yahoo.com>
parents: 23749
diff changeset
   196
    foo
df463ca0adef largefiles: revert to lfilesrepo.status() being an unfiltered method
Matt Harbison <matt_harbison@yahoo.com>
parents: 23749
diff changeset
   197
16856
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   198
  $ hg commit -m3
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   199
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   200
should show no parents for tip
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   201
  $ hg debugindex bar
17132
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 16913
diff changeset
   202
     rev    offset  length  ..... linkrev nodeid       p1           p2 (re)
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 16913
diff changeset
   203
       0         0      69  .....       1 7711d36246cc 000000000000 000000000000 (re)
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 16913
diff changeset
   204
       1        69       6  .....       2 bdf70a2b8d03 7711d36246cc 000000000000 (re)
23285
6cc1f388ac80 revlog: store fulltext when compressed delta is bigger than it
Siddharth Agarwal <sid0@fb.com>
parents: 17492
diff changeset
   205
       2        75      71  .....       3 b2558327ea8d 000000000000 000000000000 (re)
16856
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   206
should match
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   207
  $ hg debugindex foo
17132
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 16913
diff changeset
   208
     rev    offset  length  ..... linkrev nodeid       p1           p2 (re)
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 16913
diff changeset
   209
       0         0       5  .....       0 2ed2a3912a0b 000000000000 000000000000 (re)
b87acfda5268 tests: reduce spurious failures when run with generaldelta
Bryan O'Sullivan <bryano@fb.com>
parents: 16913
diff changeset
   210
       1         5       7  .....       2 dd12c926cf16 2ed2a3912a0b 000000000000 (re)
16856
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   211
  $ hg debugrename bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   212
  bar renamed from foo:dd12c926cf165e3eb4cf87b084955cb617221c17
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   213
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   214
should show no copies
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   215
  $ hg st -C
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   216
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   217
copy --after on an added file
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   218
  $ cp bar baz
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   219
  $ hg add baz
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   220
  $ hg cp -A bar baz
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   221
  $ hg st -C
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   222
  A baz
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   223
    bar
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   224
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   225
foo was clean:
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   226
  $ hg st -AC foo
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   227
  C foo
29958
37a36c05dcc3 copy: document current behavior of 'hg cp --after'
Augie Fackler <augie@google.com>
parents: 26919
diff changeset
   228
Trying to copy on top of an existing file fails,
37a36c05dcc3 copy: document current behavior of 'hg cp --after'
Augie Fackler <augie@google.com>
parents: 26919
diff changeset
   229
  $ hg copy -A bar foo
30151
381293e1135e copy: distinguish "file exists" cases and add a hint (BC)
Augie Fackler <augie@google.com>
parents: 29958
diff changeset
   230
  foo: not overwriting - file already committed
381293e1135e copy: distinguish "file exists" cases and add a hint (BC)
Augie Fackler <augie@google.com>
parents: 29958
diff changeset
   231
  (hg copy --after --force to replace the file by recording a copy)
381293e1135e copy: distinguish "file exists" cases and add a hint (BC)
Augie Fackler <augie@google.com>
parents: 29958
diff changeset
   232
same error without the --after, so the user doesn't have to go through
381293e1135e copy: distinguish "file exists" cases and add a hint (BC)
Augie Fackler <augie@google.com>
parents: 29958
diff changeset
   233
two hints:
381293e1135e copy: distinguish "file exists" cases and add a hint (BC)
Augie Fackler <augie@google.com>
parents: 29958
diff changeset
   234
  $ hg copy bar foo
381293e1135e copy: distinguish "file exists" cases and add a hint (BC)
Augie Fackler <augie@google.com>
parents: 29958
diff changeset
   235
  foo: not overwriting - file already committed
381293e1135e copy: distinguish "file exists" cases and add a hint (BC)
Augie Fackler <augie@google.com>
parents: 29958
diff changeset
   236
  (hg copy --force to replace the file by recording a copy)
16856
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   237
but it's considered modified after a copy --after --force
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   238
  $ hg copy -Af bar foo
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   239
  $ hg st -AC foo
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   240
  M foo
241a32942c7a tests: roll test-copy2.t into test-copy.t
Adrian Buehlmann <adrian@cadifra.com>
parents: 16350
diff changeset
   241
    bar
30151
381293e1135e copy: distinguish "file exists" cases and add a hint (BC)
Augie Fackler <augie@google.com>
parents: 29958
diff changeset
   242
The hint for a file that exists but is not in file history doesn't
381293e1135e copy: distinguish "file exists" cases and add a hint (BC)
Augie Fackler <augie@google.com>
parents: 29958
diff changeset
   243
mention --force:
381293e1135e copy: distinguish "file exists" cases and add a hint (BC)
Augie Fackler <augie@google.com>
parents: 29958
diff changeset
   244
  $ touch xyzzy
381293e1135e copy: distinguish "file exists" cases and add a hint (BC)
Augie Fackler <augie@google.com>
parents: 29958
diff changeset
   245
  $ hg cp bar xyzzy
381293e1135e copy: distinguish "file exists" cases and add a hint (BC)
Augie Fackler <augie@google.com>
parents: 29958
diff changeset
   246
  xyzzy: not overwriting - file exists
381293e1135e copy: distinguish "file exists" cases and add a hint (BC)
Augie Fackler <augie@google.com>
parents: 29958
diff changeset
   247
  (hg copy --after to record the copy)
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16856
diff changeset
   248
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16856
diff changeset
   249
  $ cd ..