File: workingdir.sh

package info (click to toggle)
darcs 2.18.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,960 kB
  • sloc: haskell: 47,748; sh: 13,466; ansic: 447; perl: 134; makefile: 8
file content (93 lines) | stat: -rw-r--r-- 1,593 bytes parent folder | download
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
#!/usr/bin/env bash

. lib

# test for working dir woes

# the setup...
rm -rf temp1 temp2
mkdir temp1
cd temp1
darcs init
mkdir a
echo temp0 > a/x
darcs add a
darcs add a/x
darcs record -am "aa"
darcs mv a/x a/y
darcs record -am "x to y"
echo temp1 > b
darcs add b
darcs record -am "bb"
mkdir d
darcs add d
darcs record -am "dd"
darcs tag 1
echo 1-b2 > b
darcs record -am "b2"
cd ..

# try to move a file that we don't have the right to do
darcs get temp1 temp2 --to-patch aa
cd temp2
trap "test -d $PWD/a && chmod u+w $PWD/a" EXIT
chmod u-w a
darcs pull -a
test -e b
chmod u+w a
cd ..
rm -rf temp2

# [issue319] try to overwrite file(s) in our working dir
darcs get temp1 temp2 --to-patch aa
cd temp2
echo temp2 > b
echo temp2 > d
darcs pull -a -t 1
grep temp1 b
grep temp2 b.~0~
grep temp2 d.~0~
# now make sure we didn't overdo it
darcs pull -a
grep '1-b2' b
test -e b.~0~
test ! -e b.~1~
cd ..
rm -rf temp2

# [issue298] backup working dir files with conflicts
darcs get temp1 temp2 --tag 1
cd temp2
echo 2-b2 > b
echo y | darcs pull -a
grep "v v v" b
grep "2-b2"  b.~0~
not grep "v v v" b.~0~
cd ..
rm -rf temp2

# [issue440] a) try to overwrite a file in our working dir
darcs get temp1 temp2 --to-patch a
cd temp2
echo temp2 > a/y
echo old-bak > a/y.~0~
darcs pull -a
grep temp0 a/y
grep old-bak a/y.~0~
grep temp2   a/y.~1~
cd ..
rm -rf temp2

# [issue440] b) try to overwrite a directory in our working dir
darcs get temp1 temp2 --to-patch a
cd temp2
mkdir a/y
echo old-bak > a/y.~0~
darcs pull -a
grep temp0 a/y
grep old-bak a/y.~0~
test -d a/y.~1~
cd ..
rm -rf temp2

rm -rf temp1