Debian Codegraph @

tests/test-contrib.t

raw
1 Set vars:
2
3 $ CONTRIBDIR="$TESTDIR/../contrib"
4
5 Test simplemerge command:
6
7 $ cp "$CONTRIBDIR/simplemerge" .
8 $ echo base > base
9 $ echo local > local
10 $ cat base >> local
11 $ cp local orig
12 $ cat base > other
13 $ echo other >> other
14
15 changing local directly
16
17 $ "$PYTHON" simplemerge local base other && echo "merge succeeded"
18 merge succeeded
19 $ cat local
20 local
21 base
22 other
23 $ cp orig local
24
25 printing to stdout
26
27 $ "$PYTHON" simplemerge -p local base other
28 local
29 base
30 other
31
32 local:
33
34 $ cat local
35 local
36 base
37
38 conflicts
39
40 $ cp base conflict-local
41 $ cp other conflict-other
42 $ echo not other >> conflict-local
43 $ echo end >> conflict-local
44 $ echo end >> conflict-other
45
46 $ "$PYTHON" simplemerge -p conflict-local base conflict-other
47 base
48 <<<<<<< conflict-local
49 not other
50 =======
51 other
52 >>>>>>> conflict-other
53 end
54 [1]
55
56 1 label
57
58 $ "$PYTHON" simplemerge -p -L foo conflict-local base conflict-other
59 base
60 <<<<<<< foo
61 not other
62 =======
63 other
64 >>>>>>> conflict-other
65 end
66 [1]
67
68 2 labels
69
70 $ "$PYTHON" simplemerge -p -L foo -L bar conflict-local base conflict-other
71 base
72 <<<<<<< foo
73 not other
74 =======
75 other
76 >>>>>>> bar
77 end
78 [1]
79
80 3 labels
81
82 $ "$PYTHON" simplemerge -p -L foo -L bar -L base conflict-local base conflict-other
83 base
84 <<<<<<< foo
85 not other
86 end
87 ||||||| base
88 =======
89 other
90 end
91 >>>>>>> bar
92 [1]
93
94 too many labels
95
96 $ "$PYTHON" simplemerge -p -L foo -L bar -L baz -L buz conflict-local base conflict-other
97 abort: can only specify three labels.
98 [255]
99
100 binary file
101
102 $ "$PYTHON" -c "f = open('binary-local', 'w'); f.write('\x00'); f.close()"
103 $ cat orig >> binary-local
104 $ "$PYTHON" simplemerge -p binary-local base other
105 warning: binary-local looks like a binary file.
106 [1]
107
108 binary file --text
109
110 $ "$PYTHON" simplemerge -a -p binary-local base other 2>&1
111 warning: binary-local looks like a binary file.
112 \x00local (esc)
113 base
114 other
115
116 help
117
118 $ "$PYTHON" simplemerge --help
119 simplemerge [OPTS] LOCAL BASE OTHER
120
121 Simple three-way file merge utility with a minimal feature set.
122
123 Apply to LOCAL the changes necessary to go from BASE to OTHER.
124
125 By default, LOCAL is overwritten with the results of this operation.
126
127 options:
128 -L --label labels to use on conflict markers
129 -a --text treat all files as text
130 -p --print print results instead of overwriting LOCAL
131 --no-minimal no effect (DEPRECATED)
132 -h --help display help and exit
133 -q --quiet suppress output
134
135 wrong number of arguments
136
137 $ "$PYTHON" simplemerge
138 simplemerge: wrong number of arguments
139 simplemerge [OPTS] LOCAL BASE OTHER
140
141 Simple three-way file merge utility with a minimal feature set.
142
143 Apply to LOCAL the changes necessary to go from BASE to OTHER.
144
145 By default, LOCAL is overwritten with the results of this operation.
146
147 options:
148 -L --label labels to use on conflict markers
149 -a --text treat all files as text
150 -p --print print results instead of overwriting LOCAL
151 --no-minimal no effect (DEPRECATED)
152 -h --help display help and exit
153 -q --quiet suppress output
154 [1]
155
156 bad option
157
158 $ "$PYTHON" simplemerge --foo -p local base other
159 simplemerge: option --foo not recognized
160 simplemerge [OPTS] LOCAL BASE OTHER
161
162 Simple three-way file merge utility with a minimal feature set.
163
164 Apply to LOCAL the changes necessary to go from BASE to OTHER.
165
166 By default, LOCAL is overwritten with the results of this operation.
167
168 options:
169 -L --label labels to use on conflict markers
170 -a --text treat all files as text
171 -p --print print results instead of overwriting LOCAL
172 --no-minimal no effect (DEPRECATED)
173 -h --help display help and exit
174 -q --quiet suppress output
175 [1]