tests/test-copy2.t
author Patrick Mezard <pmezard@gmail.com>
Mon, 31 Jan 2011 22:16:33 +0100
changeset 13327 dc11e30b48a3
parent 12327 92e30e135581
child 14182 ec5886db9dc6
permissions -rw-r--r--
mq: factor out push conditions checks Some extensions (e.g. hgsubversion) completely override push command. Because extensions load order is unspecified, if hgsubversion loads before mq, mq checks about not pushing applied patches will be bypassed. Short of finding a way to fix load order, extracting the checking logic will allow hgsubversion-like extensions to run the check themselves.
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
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    30
copy --after to a nonexistant target filename
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    31
  $ hg cp -A foo dummy
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    32
  foo: not recording copy - dummy does not exist
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    33
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    34
dry-run; should show that foo is clean
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    35
  $ hg copy --dry-run foo bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    36
  $ hg st -A
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    37
  C foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    38
should show copy
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    39
  $ hg copy foo bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    40
  $ hg st -C
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    41
  A bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    42
    foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    43
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    44
shouldn't show copy
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    45
  $ hg commit -m2
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    46
  $ hg st -C
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    47
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    48
should match
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    49
  $ hg debugindex .hg/store/data/foo.i
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    50
     rev    offset  length   base linkrev nodeid       p1           p2
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    51
       0         0       5      0       0 2ed2a3912a0b 000000000000 000000000000
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    52
  $ hg debugrename bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    53
  bar renamed from foo:2ed2a3912a0b24502043eae84ee4b279c18b90dd
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
  $ echo bleah > foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    56
  $ echo quux > bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    57
  $ hg commit -m3
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    58
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    59
should not be renamed
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    60
  $ hg debugrename bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    61
  bar not renamed
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    62
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    63
  $ hg copy -f foo bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    64
should show copy
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    65
  $ hg st -C
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    66
  M bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    67
    foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    68
  $ hg commit -m3
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
should show no parents for tip
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    71
  $ hg debugindex .hg/store/data/bar.i
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    72
     rev    offset  length   base linkrev nodeid       p1           p2
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    73
       0         0      69      0       1 7711d36246cc 000000000000 000000000000
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    74
       1        69       6      1       2 bdf70a2b8d03 7711d36246cc 000000000000
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    75
       2        75      81      1       3 b2558327ea8d 000000000000 000000000000
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    76
should match
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    77
  $ hg debugindex .hg/store/data/foo.i
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    78
     rev    offset  length   base linkrev nodeid       p1           p2
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    79
       0         0       5      0       0 2ed2a3912a0b 000000000000 000000000000
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    80
       1         5       7      1       2 dd12c926cf16 2ed2a3912a0b 000000000000
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    81
  $ hg debugrename bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    82
  bar renamed from foo:dd12c926cf165e3eb4cf87b084955cb617221c17
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    83
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    84
should show no copies
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    85
  $ hg st -C
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    86
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    87
copy --after on an added file
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    88
  $ cp bar baz
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    89
  $ hg add baz
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    90
  $ hg cp -A bar baz
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    91
  $ hg st -C
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    92
  A baz
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    93
    bar
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    94
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    95
foo was clean:
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    96
  $  hg st -AC foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    97
  C foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    98
but it's considered modified after a copy --after --force
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
    99
  $ hg copy -Af bar foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
   100
  $ hg st -AC foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
   101
  M foo
106311e7740f tests: unify test-copy2
Pradeepkumar Gayam <in3xes@gmail.com>
parents:
diff changeset
   102
    bar