tests/test-copy2.t
author Idan Kamara <idankk86@gmail.com>
Wed, 12 Oct 2011 22:01:13 +0200
changeset 15235 f7044da7a793
parent 14517 5a931246afc5
child 16487 4fe874697a4d
permissions -rw-r--r--
tests: add helper script for processing doctests read from stdin Writes stdin to a temp file and doctests it. In the future we might want to spare the temp file and directly call into doctest. Also, with some tweaking it seems possible to adjust the line numbers reported in an error report so they match the ones in the original file.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11940
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
     1
  $ hg init
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
     2
  $ echo foo > foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
     3
should fail - foo is not managed
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
     4
  $ hg mv foo bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
     5
  foo: not copying - file is not managed
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
     6
  abort: no files to copy
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 11940
diff changeset
     7
  [255]
11940
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
     8
  $ hg st -A
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
     9
  ? foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    10
  $ hg add foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    11
dry-run; print a warning that this is not a real copy; foo is added
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    12
  $ hg mv --dry-run foo bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    13
  foo has not been committed yet, so no copy data will be stored for bar.
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    14
  $ hg st -A
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    15
  A foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    16
should print a warning that this is not a real copy; bar is added
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    17
  $ hg mv foo bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    18
  foo has not been committed yet, so no copy data will be stored for bar.
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    19
  $ hg st -A
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    20
  A bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    21
should print a warning that this is not a real copy; foo is added
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    22
  $ hg cp bar foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    23
  bar has not been committed yet, so no copy data will be stored for foo.
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    24
  $ hg rm -f bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    25
  $ rm bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    26
  $ hg st -A
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    27
  A foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    28
  $ hg commit -m1
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    29
14517
5a931246afc5 test-copy2: add case for moving a missing file
Adrian Buehlmann <adrian@cadifra.com>
parents: 14182
diff changeset
    30
moving a missing file
5a931246afc5 test-copy2: add case for moving a missing file
Adrian Buehlmann <adrian@cadifra.com>
parents: 14182
diff changeset
    31
  $ rm foo
5a931246afc5 test-copy2: add case for moving a missing file
Adrian Buehlmann <adrian@cadifra.com>
parents: 14182
diff changeset
    32
  $ hg mv foo foo3
5a931246afc5 test-copy2: add case for moving a missing file
Adrian Buehlmann <adrian@cadifra.com>
parents: 14182
diff changeset
    33
  foo: deleted in working copy
5a931246afc5 test-copy2: add case for moving a missing file
Adrian Buehlmann <adrian@cadifra.com>
parents: 14182
diff changeset
    34
  foo3 does not exist!
5a931246afc5 test-copy2: add case for moving a missing file
Adrian Buehlmann <adrian@cadifra.com>
parents: 14182
diff changeset
    35
  $ hg up -qC .
5a931246afc5 test-copy2: add case for moving a missing file
Adrian Buehlmann <adrian@cadifra.com>
parents: 14182
diff changeset
    36
11940
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    37
copy --after to a nonexistant target filename
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    38
  $ hg cp -A foo dummy
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    39
  foo: not recording copy - dummy does not exist
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    40
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    41
dry-run; should show that foo is clean
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    42
  $ hg copy --dry-run foo bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    43
  $ hg st -A
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    44
  C foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    45
should show copy
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    46
  $ hg copy foo bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    47
  $ hg st -C
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    48
  A bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    49
    foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    50
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    51
shouldn't show copy
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    52
  $ hg commit -m2
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    53
  $ hg st -C
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    54
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    55
should match
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 12327
diff changeset
    56
  $ hg debugindex foo
11940
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    57
     rev    offset  length   base linkrev nodeid       p1           p2
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    58
       0         0       5      0       0 2ed2a3912a0b 000000000000 000000000000
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    59
  $ hg debugrename bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    60
  bar renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    61
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    62
  $ echo bleah > foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    63
  $ echo quux > bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    64
  $ hg commit -m3
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    65
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    66
should not be renamed
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    67
  $ hg debugrename bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    68
  bar not renamed
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    69
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    70
  $ hg copy -f foo bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    71
should show copy
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    72
  $ hg st -C
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    73
  M bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    74
    foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    75
  $ hg commit -m3
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    76
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    77
should show no parents for tip
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 12327
diff changeset
    78
  $ hg debugindex bar
11940
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    79
     rev    offset  length   base linkrev nodeid       p1           p2
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    80
       0         0      69      0       1 7711d36246cc 000000000000 000000000000
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    81
       1        69       6      1       2 bdf70a2b8d03 7711d36246cc 000000000000
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    82
       2        75      81      1       3 b2558327ea8d 000000000000 000000000000
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    83
should match
14182
ec5886db9dc6 tests: fix deprecated use of hg debugdata/debugindex
Sune Foldager <cryo@cyanite.org>
parents: 12327
diff changeset
    84
  $ hg debugindex foo
11940
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    85
     rev    offset  length   base linkrev nodeid       p1           p2
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    86
       0         0       5      0       0 2ed2a3912a0b 000000000000 000000000000
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    87
       1         5       7      1       2 dd12c926cf16 2ed2a3912a0b 000000000000
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    88
  $ hg debugrename bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    89
  bar renamed from foo:dd12c926cf165e3eb4cf87b084955cb617221c17
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    90
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    91
should show no copies
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    92
  $ hg st -C
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    93
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    94
copy --after on an added file
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    95
  $ cp bar baz
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    96
  $ hg add baz
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    97
  $ hg cp -A bar baz
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    98
  $ hg st -C
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    99
  A baz
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
   100
    bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
   101
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
   102
foo was clean:
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
   103
  $  hg st -AC foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
   104
  C foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
   105
but it's considered modified after a copy --after --force
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
   106
  $ hg copy -Af bar foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
   107
  $ hg st -AC foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
   108
  M foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
   109
    bar