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
|
#!/usr/bin/env bash
. ./lib
rm -rf temp1
darcs init temp1
cd temp1
touch foo bar
darcs add foo bar
for (( i=0 ; i < 5; i=i+1 )); do
echo $i >> file-$i;
darcs add file-$i
done
cd ..
rm -rf temp1
# add in subdir
darcs init temp1
cd temp1
mkdir dir
echo zig > dir/foo
darcs add dir dir/foo
darcs record -am add_foo
cd ..
rm -rf temp1
# addrm
darcs init temp1
cd temp1
touch foo
darcs add foo
darcs record -a -m add_foo -A x
darcs remove foo
darcs record -a -m del_foo -A x
cd ..
rm -rf temp1
# issue1162: add nonexistent slash
rm -rf temp1
darcs init temp1
cd temp1
not darcs add a/ 2> err
cat err
grep 'does not exist' err
cd ..
rm -rf temp1
# issue184: recording files in directories that haven't explicity been added
darcs init temp1
cd temp1
mkdir new
mkdir new/dir
touch new/dir/t.t
darcs add new/dir/t.t
darcs record -am test new/dir/t.t > log
not grep "don't want to record" log
cd ..
rm -rf temp1
# Make sure that parent directories are added for files
darcs init temp1
cd temp1
mkdir -p a.d/aa.d/aaa.d
mkdir -p b.d/bb.d
touch a.d/aa.d/aaa.d/baz
touch a.d/aa.d/aaa.d/bar
darcs add -v a.d/aa.d/aaa.d/bar a.d/aa.d/aaa.d/baz b.d/bb.d 2> log
not grep -F ".d" log
# Make sure that darcs doesn't complain about duplicate adds when adding parent dirs.
mkdir c.d
touch c.d/baz
darcs add -v c.d/baz c.d 2> log
not grep -F ".d" log
# Make sure that add output looks good when adding files in subdir
mkdir d.d
touch d.d/foo
darcs add -rv d.d | grep 'd.d/foo'
# 'adding a non-existent dir and file gives the expected message
not darcs add -v notadir/notafile 2>&1 | grep -i 'does not exist'
cd ..
rm -rf temp1
# test for darcs add behaviour on missing files.
darcs init temp1
cd temp1
rm -f foo
not darcs add foo >stdout 2>stderr
not grep foo stdout
grep foo stderr # error message about foo not existing
touch foo
darcs add foo >stdout 2>stderr
grep foo stdout # confirmation message of added file
not grep foo stderr
not darcs add foo 2>stderr
grep 'not added' stderr # error message about some files not being added
rm foo
not darcs add foo 2>stderr
grep 'not added' stderr # error message about some files not being added
cd ..
|