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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
#!/usr/bin/env bash
. lib
rm -rf temp1 temp2
darcs init temp1
cd temp1
touch t.t
darcs record -lam "initial add"
darcs log --context > my_context
DIR=`pwd`
abs_to_context="${DIR}/my_context"
cd ..
darcs clone temp1 --context="${abs_to_context}" temp2
darcs log --context --repo temp2 > repo2_context
diff -u "${abs_to_context}" repo2_context
# trailing slash in the target dir should not change the result
rm -rf temp2
darcs clone temp1 --context="${abs_to_context}" temp2/
darcs log --context --repo temp2 > repo2_context
diff -u "${abs_to_context}" repo2_context
# clone should fail if the target dir already exists
rm -rf temp2
mkdir temp2
not darcs clone temp1 temp2
not ls temp2/* temp2/.[^.]*
# same, with target dir containing a trailing slash
rm -rf temp2
mkdir temp2
not darcs clone temp1 temp2/
not ls temp2/* temp2/.[^.]*
# issue1865: cover interaction of clone --context with tags
rm -rf temp1 temp2
darcs init temp1
cd temp1
touch t.t
darcs record -lam "initial add"
darcs tag -m tt
echo x > x
darcs rec -lam "x"
darcs log --context > my_context
abs_to_context="$(pwd)/my_context"
cd ..
darcs clone temp1 --context="${abs_to_context}" temp2
darcs log --context --repo temp2 > repo2_context
diff -u "${abs_to_context}" repo2_context
# issue1041
rm -rf temp1 temp2
# should fail, since temp1 doesn't exist
not darcs clone temp1 temp2
# verify that temp2 wasn't created
not cd temp2
# issue2199 "darcs clone --tag" gets too much if tag is dirty
rm -rf temp1 temp2 temp3
darcs init temp1
cd temp1
echo 'wibble' > file
darcs rec -lam 'wibble'
echo 'wobble' > file
darcs rec -lam 'wobble'
cd ..
darcs clone temp1 temp2
cd temp2
darcs unpull --patch 'wobble' -a
darcs tag 'wibble'
cd ..
cd temp1
darcs pull ../temp2 -a
cd ..
darcs clone --tag wibble temp1 temp3
cd temp3
darcs log | not grep wobble
cd ..
# issue885: darcs clone --to-match
rm -rf temp1 temp2 temp3
darcs init temp1
cd temp1
echo first > a
darcs record -lam 'first'
firsthash=`darcs log --xml | grep 'hash=' | sed -e "s/.*hash='//" -e "s/'>//"`
echo second > b
darcs record -lam 'second'
cd ..
darcs clone --to-match "hash $firsthash" temp1 temp2
test $(darcs log --count --repodir temp2) -eq 1
darcs clone --to-hash $firsthash temp1 temp3
test $(darcs log --count --repodir temp3) -eq 1
# various tests for clone --tag
rm -rf temp1 temp2
darcs init temp1
cd temp1
echo A > foo
darcs record -lam AA
echo B > foo
darcs record -am BB
echo C > foo
darcs record -am CC
darcs tag -m 1.0
cp foo foo_version_1.0
echo D > foo
darcs record -am DD
echo E > foo
darcs record -am EE
echo F > foo
darcs record -am FF
cd ..
darcs clone --tag 1.0 --repo-name temp2 temp1
cmp temp2/foo temp1/foo_version_1.0
# clone --tag with commuted patches
rm -rf temp1 temp2 temp3
darcs init temp1
cd temp1
cat > file <<EOF
1
2
3
4
EOF
darcs rec -alm 'Add file'
cat > file <<EOF
2
3
4
EOF
darcs rec -alm 'Remove line 1'
cat > file <<EOF
2
4
EOF
darcs rec -alm 'Remove line 3'
cd ..
darcs init temp2
cd temp2
echo ynyy | darcs pull ../temp1
darcs tag -m Tag
darcs push -a ../temp1
cd ..
darcs clone --tag=Tag temp1 temp3
cd temp3
darcs check
cd ..
# clone --tag : check that pending looks ok
rm -rf temp1 temp2
darcs init temp1
cd temp1
mkdir d
darcs rec -lam 'add d'
darcs tag t
rmdir d
darcs rec -am 'rm d'
cd ..
darcs clone --tag t temp1 temp2
cd temp2
if [ -f _darcs/patches/pending ]; then
if grep -v '^[{}]$' _darcs/patches/pending >/dev/null; then
cat _darcs/patches/pending
exit 1
fi
fi
cd ..
# issue2230 - darcs clone --context checks the validity of the context
# file too late.
rm -rf temp1 temp2
darcs init temp1
touch fake_context.txt
not darcs clone --context fake_context.txt temp1 temp2
# The clone should fail, so we shouldn't have an temp2 repo
[[ ! -e temp2 ]]
|