1#!/bin/sh -e
2##
3## Basic test of rebase apply
4##
5## Copyright (C) 2011-2014 Ganesh Sittampalam
6##
7## Permission is hereby granted, free of charge, to any person
8## obtaining a copy of this software and associated documentation
9## files (the "Software"), to deal in the Software without
10## restriction, including without limitation the rights to use, copy,
11## modify, merge, publish, distribute, sublicense, and/or sell copies
12## of the Software, and to permit persons to whom the Software is
13## furnished to do so, subject to the following conditions:
14##
15## The above copyright notice and this permission notice shall be
16## included in all copies or substantial portions of the Software.
17##
18## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19## EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20## MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21## NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
22## BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23## ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24## CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25## SOFTWARE.
26
27. lib
28
29rm -rf R1 R2 R3
30mkdir R1
31cd R1
32darcs init
33echo '1' > foo
34darcs rec -lam "add foo"
35cd ..
36
37darcs get R1 R2
38cd R2
39echo '2' > foo
40darcs rec -am "2"
41darcs send -a -o 2.dpatch ../R1
42cd ..
43
44darcs get R1 R3
45cd R3
46echo '3' > foo
47darcs rec -am "3"
48
49echo '4' > foo
50darcs rec -am "4"
51
52# TODO: figure out behaviour of --all and test it
53# (should it answer 'yes' to both pulling and suspending?
54echo yyy | darcs rebase apply -a ../R2/2.dpatch
55
56darcs changes --count 2>&1 | grep "Rebase in progress: 2 suspended patches"
57echo yny | darcs rebase unsuspend 2>log
58grep conflicts log
59cat > expected <<EOF
60v v v v v v v
611
62=============
632
64*************
653
66^ ^ ^ ^ ^ ^ ^
67EOF
68diff -u expected foo
69
70echo 23 > foo
71echo yyy | darcs amend --patch '3'
72
73echo yy | darcs rebase unsuspend 2>log
74grep conflicts log
75cat > expected <<EOF
76v v v v v v v
773
78=============
7923
80*************
814
82^ ^ ^ ^ ^ ^ ^
83EOF
84diff -u expected foo
85
86echo 24 > foo
87echo yyy | darcs amend --patch '4'
88
89cd ..
90
91
92