Follow upstream changes -- rest
[git-darcs-import.git] / tests / query_manifest.sh
blobac821f598e6ed5e3dba32f51ceeb5bd75d953cdc
1 #!/usr/bin/env bash
2 set -ev
4 check_manifest () {
5 IFS=' '
6 : > files.tmp
7 echo . > dirs.tmp
8 echo . > files-dirs.tmp
9 for x in $1 ; do
10 echo "./$x" >> files.tmp
11 echo "./$x" >> files-dirs.tmp
12 done
13 for x in $2 ; do
14 echo "./$x" >> dirs.tmp
15 echo "./$x" >> files-dirs.tmp
16 done
17 darcs query manifest $3 --files --no-directories | sort > darcs-files.tmp
18 darcs query manifest $3 --no-files --directories | sort > darcs-dirs.tmp
19 darcs query manifest $3 --files --directories | sort > darcs-files-dirs.tmp
20 for x in files dirs files-dirs ; do
21 sort -o sorted-$x.tmp $x.tmp
22 diff sorted-$x.tmp darcs-$x.tmp
23 done
24 IFS=''
27 rm -rf temp
28 mkdir temp
29 cd temp
30 darcs init
32 check_manifest "" "" "--no-pending"
33 check_manifest "" "" "--pending"
34 touch a b
35 darcs add a
36 check_manifest "" "" "--no-pending"
37 check_manifest "a" "" "--pending"
38 darcs add b
39 mkdir c
40 check_manifest "" "" "--no-pending"
41 check_manifest "a b" "" "--pending"
42 darcs add c
43 touch c/1 c/2
44 check_manifest "" "" "--no-pending"
45 check_manifest "a b" "c" "--pending"
46 darcs add c/1 c/2
47 check_manifest "" "" "--no-pending"
48 check_manifest "a b c/1 c/2" "c" "--pending"
49 mkdir d
50 touch d/3 d/4
51 darcs add d/3 d/4
52 check_manifest "" "" "--no-pending"
53 check_manifest "a b c/1 c/2 d/3 d/4" "c d" "--pending"
54 darcs record -A test --all --patch-name "patch 1" --skip-long-comment
55 check_manifest "a b c/1 c/2 d/3 d/4" "c d" "--no-pending"
56 check_manifest "a b c/1 c/2 d/3 d/4" "c d" "--pending"
58 darcs mv d e
59 check_manifest "a b c/1 c/2 d/3 d/4" "c d" "--no-pending"
60 check_manifest "a b c/1 c/2 e/3 e/4" "c e" "--pending"
61 rm c/1
62 check_manifest "a b c/1 c/2 d/3 d/4" "c d" "--no-pending"
63 check_manifest "a b c/1 c/2 e/3 e/4" "c e" "--pending"
64 darcs remove c/1
65 check_manifest "a b c/1 c/2 d/3 d/4" "c d" "--no-pending"
66 check_manifest "a b c/2 e/3 e/4" "c e" "--pending"
67 darcs mv c/2 c/1
68 check_manifest "a b c/1 c/2 d/3 d/4" "c d" "--no-pending"
69 check_manifest "a b c/1 e/3 e/4" "c e" "--pending"
70 darcs record -A test --all --patch-name "patch 2" --skip-long-comment
71 check_manifest "a b c/1 e/3 e/4" "c e" "--no-pending"
72 check_manifest "a b c/1 e/3 e/4" "c e" "--pending"
74 darcs remove c/1
75 check_manifest "a b c/1 e/3 e/4" "c e" "--no-pending"
76 check_manifest "a b e/3 e/4" "c e" "--pending"
77 darcs remove c
78 check_manifest "a b c/1 e/3 e/4" "c e" "--no-pending"
79 check_manifest "a b e/3 e/4" "e" "--pending"
80 darcs record -A test --all --patch-name "patch 3" --skip-long-comment
81 check_manifest "a b e/3 e/4" "e" "--no-pending"
82 check_manifest "a b e/3 e/4" "e" "--pending"
84 darcs mv b b2
85 darcs mv b2 b3
86 check_manifest "a b e/3 e/4" "e" "--no-pending"
87 check_manifest "a b3 e/3 e/4" "e" "--pending"
88 darcs record -A test --all --patch-name "patch 3" --skip-long-comment
89 check_manifest "a b3 e/3 e/4" "e" "--no-pending"
90 check_manifest "a b3 e/3 e/4" "e" "--pending"
92 cd ..
93 rm -rf temp