File: issue1879-same-patchinfo-uncommon.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 (45 lines) | stat: -rw-r--r-- 1,277 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
#!/usr/bin/env bash
## Test for issue1879 - we should at least notice that when a patch claims
## to have the same identity (patchinfo) as one of ours, then it should not
## depend on anything we don't have.
##
## Public domain - 2010 Eric Kow

. lib                           # Load some portability helpers.
rm -rf R S                      # Another script may have left a mess.
darcs init      --repo R        # Create our test repos.
darcs init      --repo S

cd R
touch x1
darcs add x1
darcs record -am 'x1'
darcs changes --context > ctx
echo hello > f
echo world > x1
darcs add f
darcs record -am 'hello world'
darcs send -a --context ctx -o foo.dpatch ../S
cd ..

cd S
touch x2
darcs add x2
darcs record -am 'x2'
darcs changes --context > ctx
# create an evil wrong patch
sed -e '/Context:/,$d' -e 's/x1/x2/g' ../R/foo.dpatch > foo.dpatch
cat ctx >> foo.dpatch
darcs apply foo.dpatch
cd ..

cd R
# The issue calls for darcs to detect this and fail, which it does,
# though not in a regular way but by calling 'error'. Since the 'not'
# function now regards that as test failure we cannot use it here.
# This is only a temporary work-around: Darcs should never call error
# unless it is really a bug in darcs.
if darcs pull -a ../S 2>&1 | tee log; then
  exit 1
fi
cd ..