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
|
#!/usr/bin/env bash
. ./lib
rm -rf temp
mkdir temp
cd temp
darcs init
echo "X X X" > foo
echo $'A A,A\tA,A\vA' >> foo
echo "aä" >> foo
echo $'\02' >> foo
darcs rec -alm "Added"
# These should fail until replace handles tokens and
# token-chars with leteral spaces in them
not darcs replace ' X ' ' XX ' --token-chars '[ X]' foo
not darcs replace $'A A' 'aaa' --token-chars '[^,]' foo
not darcs replace $'A\tA' 'aaa' --token-chars '[^,]' foo
not darcs replace $'A\vA' 'aaa' --token-chars '[^,]' foo
# These should fail since darcs cannot handle non-ASCII token chars
# nor non-printable ones
not darcs replace 'X' 'ä' --token-chars '[Xä]' foo
not darcs replace 'ä' 'X' --token-chars '[ä]' foo
not darcs replace $'\02' 'X' --token-chars $'[X\02]' foo
not darcs replace 'X' $'\02' --token-chars $'[X\02]' foo
# Check that replace is not fooled by duplicate file names
# (i.e. not trying to performe the replace twice in the same file)
darcs replace X Y foo foo
darcs replace Y Z foo ../temp/foo
darcs replace Z Q foo foo --repodir=../temp/
darcs rec -am "xyzq"
# Try to "overwrite" a hunk with a replace.
#
# v1.0.8 accepts this without error or warning,
# but should perhaps require the --force option?
#
# current unstable sometimes(!) fails with bug: invalid pending
# which is surely a bug.
# this succeeds
echo "x" > foo
darcs rec -am xx
echo "y" > foo
darcs replace x y foo
# this fails
echo "hej" > foo
darcs rec -am hej
echo "hopp" > foo
darcs replace hej hopp foo
darcs whatsnew
echo "src" > foo
echo "dst" >> foo
darcs rec -am hop
darcs replace src dst foo || true
darcs replace --force src dst foo
darcs whatsnew
darcs whatsnew -ls
cd ..
rm -rf temp
# replace after pending add
mkdir temp1
cd temp1
darcs init
echo a b a b a b > A
darcs add A
darcs replace a c A > LOG
not grep Skipping LOG
cd ..
rm -fr temp1
# replace after pending mv
mkdir temp1
cd temp1
darcs init
echo a b a b a b > A
darcs add A
darcs record --all --name=p1
darcs mv A B
darcs replace a c B > LOG
not grep Skipping LOG
cd ..
rm -fr temp1
|