File: test-mv-cp-st-diff

package info (click to toggle)
mercurial 1.6.4-1%2Bdeb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 17,928 kB
  • ctags: 6,062
  • sloc: python: 44,238; sh: 20,985; tcl: 3,578; ansic: 2,557; lisp: 1,412; makefile: 176; xml: 15
file content (95 lines) | stat: -rwxr-xr-x 1,710 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/sh

add()
{
    echo $2 >> $1
}

hg init t
cd t

# set up a boring main branch
add a a
hg add a
mkdir x
add x/x x
hg add x/x
hg ci -m0

add a m1
hg ci -m1

add a m2
add x/y y1
hg add x/y
hg ci -m2
cd ..

show()
{
    echo "- $2: $1"
    hg st -C $1
    echo
    hg diff --git $1
    echo
}

count=0
# make a new branch and get diff/status output
# $1 - first commit
# $2 - second commit
# $3 - working dir action
# $4 - test description
tb()
{
    hg clone t t2 ; cd t2
    hg co -q -C 0

    add a $count
    count=`expr $count + 1`
    hg ci -m "t0"
    $1
    hg ci -m "t1"
    $2
    hg ci -m "t2"
    $3

    echo "** $4 **"
    echo "** $1 / $2 / $3"
    show "" "working to parent"
    show "--rev 0" "working to root"
    show "--rev 2" "working to branch"
    show "--rev 0 --rev ." "root to parent"
    show "--rev . --rev 0" "parent to root"
    show "--rev 2 --rev ." "branch to parent"
    show "--rev . --rev 2" "parent to branch"
    echo
    cd ..
    rm -rf t2
}


tb "add a a1" "add a a2" "hg mv a b" "rename in working dir"
tb "add a a1" "add a a2" "hg cp a b" "copy in working dir" 
tb "hg mv a b" "add b b1" "add b w" "single rename"
tb "hg cp a b" "add b b1" "add a w" "single copy"
tb "hg mv a b" "hg mv b c" "hg mv c d" "rename chain"
tb "hg cp a b" "hg cp b c" "hg cp c d" "copy chain"
tb "add a a1" "hg mv a b" "hg mv b a" "circular rename"

tb "hg mv x y" "add y/x x1" "add y/x x2" "directory move"

# Cannot implement unrelated branch with tb
echo '% testing copies with unrelated branch'
hg init unrelated
cd unrelated
add a a
hg ci -Am adda
hg mv a b
hg ci -m movea
hg up -C null
add a a
hg ci -Am addunrelateda
echo '% unrelated branch diff'
hg diff --git -r 2 -r 1
cd ..