tests/test-mv-cp-st-diff
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
Sun, 16 Mar 2008 06:10:47 -0300
changeset 6286 90a4329a6b4a
parent 6282 709652cd7bff
child 6425 2d9328a2f81f
permissions -rwxr-xr-x
filectx.ancestor: use fctx._repopath to cache filelogs (issue1035) _repopath may be different from _path for workingfilectx when there are renames involved.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6278
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     1
#!/bin/sh
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     2
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     3
add()
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     4
{
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     5
    echo $2 >> $1
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     6
}
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     7
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     8
hg init t
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
     9
cd t
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    10
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    11
# set up a boring main branch
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    12
add a a
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    13
hg add a
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    14
hg ci -m0
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    15
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    16
add a m1
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    17
hg ci -m1
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    18
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    19
add a m2
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    20
hg ci -m2
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    21
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    22
show()
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    23
{
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    24
    echo "- $2: $1"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    25
    hg st -C $1
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    26
    echo
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    27
    hg diff --git $1
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    28
    echo
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    29
}
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    30
6282
709652cd7bff test-mv-cp-st-diff: avoid linkrev collisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6278
diff changeset
    31
count=0
6278
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    32
# make a new branch and get diff/status output
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    33
# $1 - first commit
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    34
# $2 - second commit
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    35
# $3 - working dir action
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    36
# $4 - test description
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    37
tb()
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    38
{
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    39
    hg co -q -C 0
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    40
6282
709652cd7bff test-mv-cp-st-diff: avoid linkrev collisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6278
diff changeset
    41
    add a $count
709652cd7bff test-mv-cp-st-diff: avoid linkrev collisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6278
diff changeset
    42
    count=`expr $count + 1`
709652cd7bff test-mv-cp-st-diff: avoid linkrev collisions
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6278
diff changeset
    43
    hg ci -m "t0"
6278
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    44
    $1
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    45
    hg ci -m "t1"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    46
    $2
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    47
    hg ci -m "t2"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    48
    $3
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    49
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    50
    echo "** $4 **"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    51
    echo "** $1 / $2 / $3"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    52
    show "" "working to parent"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    53
    show "--rev 0" "working to root"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    54
    show "--rev 2" "working to branch"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    55
    show "--rev 0 --rev ." "root to parent"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    56
    show "--rev . --rev 0" "parent to root"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    57
    show "--rev 2 --rev ." "branch to parent"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    58
    show "--rev . --rev 2" "parent to branch"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    59
    echo
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    60
}
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    61
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    62
tb "add a a1" "add a a2" "hg mv a b" "rename in working dir"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    63
tb "add a a1" "add a a2" "hg cp a b" "copy in working dir" 
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    64
tb "hg mv a b" "add b b1" "add b w" "single rename"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    65
tb "hg cp a b" "add b b1" "add a w" "single copy"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    66
tb "hg mv a b" "hg mv b c" "hg mv c d" "rename chain"
81e7112b07ae copies: add tests for status -C/diff --git
Matt Mackall <mpm@selenic.com>
parents:
diff changeset
    67
tb "hg cp a b" "hg cp b c" "hg cp c d" "copy chain"
6286
90a4329a6b4a filectx.ancestor: use fctx._repopath to cache filelogs (issue1035)
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 6282
diff changeset
    68
tb "add a a1" "hg mv a b" "hg mv b a" "circular rename"