tests/test-copy.t
author Adrian Buehlmann <adrian@cadifra.com>
Thu, 02 Jun 2011 00:33:33 +0200
changeset 14518 a67e866f46f9
parent 14182 ec5886db9dc6
child 16350 4f795f5fbb0b
permissions -rw-r--r--
workingctx: eliminate remove function Inlining it into it's last remaining call place in cmdutil.copy. Note that cmdutil.copy is called with the wlock already held, so no additional locking is needed to call util.unlinkpath. We do not need to wrap the util.unlinkpath call into a try block, because at that point we already know whether abssrc exists or not -- thanks to the preceding util.copyfile call. Adding a new local 'srcexists' in cmdutil.copy for that purpose.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
     1
  $ hg init
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
     2
  $ echo a > a
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
     3
  $ hg add a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
     4
  $ hg commit -m "1"
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
     5
  $ hg status
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
     6
  $ 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
     7
  $ 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
     8
  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
     9
  [255]
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    10
  $ hg status
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    11
  A b
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    12
  $ hg sum
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    13
  parent: 0:c19d34741b0a tip
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    14
   1
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    15
  branch: default
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    16
  commit: 1 copied
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    17
  update: (current)
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    18
  $ hg --debug commit -m "2"
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    19
  b
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    20
   b: copy a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    21
  committed changeset 1:93580a2c28a50a56f63526fb305067e6fbf739c4
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    22
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    23
we should see two history entries
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    24
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    25
  $ hg history -v
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    26
  changeset:   1:93580a2c28a5
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    27
  tag:         tip
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    28
  user:        test
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    29
  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
    30
  files:       b
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    31
  description:
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    32
  2
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    33
  
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    34
  
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    35
  changeset:   0:c19d34741b0a
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    36
  user:        test
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    37
  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
    38
  files:       a
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    39
  description:
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    40
  1
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    41
  
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    42
  
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    43
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    44
we should see one log entry for a
363
ae96b7e1318d Add hg copy
mpm@selenic.com
parents:
diff changeset
    45
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    46
  $ hg log a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    47
  changeset:   0:c19d34741b0a
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    48
  user:        test
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    49
  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
    50
  summary:     1
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    51
  
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    52
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    53
this should show a revision linked to changeset 0
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    54
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 13962
diff changeset
    55
  $ hg debugindex a
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    56
     rev    offset  length   base linkrev nodeid       p1           p2
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    57
       0         0       3      0       0 b789fdd96dc2 000000000000 000000000000
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 b
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    60
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    61
  $ hg log b
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    62
  changeset:   1:93580a2c28a5
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    63
  tag:         tip
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    64
  user:        test
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11805
diff changeset
    65
  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
    66
  summary:     2
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
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    69
this should show a revision linked to changeset 1
1043
9344f5dd4488 Update tests
mpm@selenic.com
parents: 814
diff changeset
    70
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 13962
diff changeset
    71
  $ hg debugindex b
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    72
     rev    offset  length   base linkrev nodeid       p1           p2
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    73
       0         0      65      0       1 37d9b5d994ea 000000000000 000000000000
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    74
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    75
this should show the rename information in the metadata
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    76
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 13962
diff changeset
    77
  $ hg debugdata b 0 | head -3 | tail -2
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    78
  copy: a
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    79
  copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
1043
9344f5dd4488 Update tests
mpm@selenic.com
parents: 814
diff changeset
    80
11805
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    81
  $ $TESTDIR/md5sum.py .hg/store/data/b.i
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    82
  4999f120a3b88713bbefddd195cf5133  .hg/store/data/b.i
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    83
  $ hg cat b > bsum
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    84
  $ $TESTDIR/md5sum.py bsum
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    85
  60b725f10c9c85c70d97880dfe8191b3  bsum
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    86
  $ hg cat a > asum
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    87
  $ $TESTDIR/md5sum.py asum
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    88
  60b725f10c9c85c70d97880dfe8191b3  asum
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    89
  $ hg verify
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    90
  checking changesets
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    91
  checking manifests
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    92
  crosschecking files in changesets and manifests
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    93
  checking files
8ef250726cf0 tests: unify test-copy
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 11331
diff changeset
    94
  2 files, 2 changesets, 2 total revisions