blob: c0f30c250130258179d6c42c85490a4eb5a3c427 (
plain)
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
export DARCS_EMAIL="user@example.com"
export GIT_PAGER=cat
export PATH="$(pwd)/..:$PATH"
pypath="/$(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()[1:]')/"
_drrec()
{
darcs rec --ignore-times "$@"
}
_drrec_multiline()
{
echo -e "`LANG= LC_ALL= date +"%a %b %d %H:%M:%S %Z %Y"`
$DARCS_EMAIL
$@" | darcs rec --ignore-times -a --pipe .
}
_drrecamend()
{
echo y |darcs amend-rec --ignore-times -a
}
create_darcs()
{
rm -rf $1
mkdir -p $1
cd $1
darcs init $2
echo A > file
darcs add file
_drrec -a -m A
cd ..
rm -rf $1.tmp
darcs get $1 $1.tmp
cd $1
echo B > file
_drrec -a -m B
cd ../$1.tmp
echo C > file
_drrec -a -m C
cd ../$1
darcs pull -a ../$1.tmp
echo D > file
_drrec_multiline "first line
second line
third line"
darcs tag 1.0
echo e > file
_drrec -a -m e
echo f > file
_drrec --author="éáõû <$DARCS_EMAIL>" -a -m f
echo g > file
_drrec --author="" -a -m g
cp ../data/hungarian.gif .
darcs add hungarian.gif
_drrec -a -m "add a binary file"
rm file
echo test > file2
darcs add file2
_drrec -a -m "replace file with file2"
touch file3
darcs add file3
_drrec -a -m "add empty file"
rm file3
_drrec -a -m "remove file"
mkdir dir dir2
darcs add dir
darcs add dir2
_drrec -a -m "add empty dirs"
darcs mv dir dir-p
darcs mv dir2 dir2-p
_drrec -a -m "rename empty dirs"
echo a > a
echo b > b
darcs add a b
_drrec -a -m "add a b"
rm b
_drrec -a -m "remove and rename"
darcs mv a b
_drrecamend
echo c > c
darcs add c
# empty commit message
_drrec -a -m ""
cd ..
}
create_bzr()
{
rm -rf $1
mkdir -p $1
cd $1
bzr init $2
echo A > file
bzr add file
bzr commit -m A
cd ..
rm -rf $1.tmp
bzr branch $1 $1.tmp
cd $1
echo B > file
bzr commit -m B
cd ../$1.tmp
echo C > file
bzr commit -m C
cd ../$1
bzr merge ../$1.tmp
echo D > file
bzr resolve file
echo "first line
second line
third line" | bzr commit -F /dev/stdin
bzr tag 1.0
echo e > file
bzr commit -m e
#echo f > file
#bzr commit --author="éáõû <$DARCS_EMAIL>" -m f
#echo g > file
#_drrec --author="" -a -m g
cp ../data/hungarian.gif .
bzr add hungarian.gif
bzr commit -m "add a binary file"
rm file
echo test > file2
bzr add file2
bzr commit -m "replace file with file2"
touch file3
bzr add file3
bzr commit -m "add empty file"
rm file3
bzr commit -m "remove file"
cd ..
}
create_hg()
{
rm -rf $1
mkdir -p $1
cd $1
hg init $2
echo A > file
hg add file
hg commit -m A
cd ..
rm -rf $1.tmp
hg clone $1 $1.tmp
cd $1
echo B > file
hg commit -m B
cd ../$1.tmp
echo C > file
hg commit -m C
cd ../$1
hg pull ../$1.tmp
hg merge
echo D > file
hg resolve -m file
echo "first line
second line
third line" | hg commit -l /dev/stdin
hg tag 1.0
echo e > file
hg commit -m e
#echo f > file
#bzr commit --author="éáõû <$DARCS_EMAIL>" -m f
#echo g > file
#_drrec --author="" -a -m g
cp ../data/hungarian.gif .
hg add hungarian.gif
hg commit -m "add a binary file"
hg rm file
echo test > file2
hg add file2
hg commit -m "replace file with file2"
touch file3
hg add file3
hg commit -m "add empty file"
hg rm file3
hg commit -m "remove file"
mkdir subdir
echo test > subdir/file
hg add subdir/file
hg commit -m "add subdir file"
echo test2 > subdir/file
hg commit -m "commit with weird date" -d "Fri Apr 03 12:38:26 2009 +1300"
cd ..
}
create_git()
{
rm -rf $1
mkdir -p $1
cd $1
git init $2
echo A > file
git add file
git commit -a -m A
echo B > file
git commit -a -m B
git checkout -b tmp HEAD~1
echo C > file
git commit -a -m C
git checkout master
git merge tmp
echo D > file
echo "first line
second line
third line" | git commit -a -F -
git branch -d tmp
git tag 1.0
echo e > file
git commit -a -m e
echo f > file
git config i18n.commitencoding ISO-8859-2
git commit --author="éáõû <$DARCS_EMAIL>" -a -m f
cp ../data/hungarian.gif .
git add hungarian.gif
git commit -a -m "add a binary file"
rm file
echo test > file2
git add file2
git commit -a -m "replace file with file2"
touch file3
git add file3
git commit -a -m "add empty file"
rm file3
git commit -a -m "remove file"
# now add back 'file' with its old conents, so the mark gets
# reused
echo f > file
git add file
git commit -a -m "file: other -> f"
# this is a boring file for Darcs
touch foo.pyc
git add foo.pyc
git commit -a -m "boring file"
# replace an uppercase file to a lowercase one
echo SPAM > SPAM
git add SPAM
git commit -a -m SPAM
rm SPAM
echo spam > spam
git add spam
git commit -a -m "SPAM -> spam"
cd ..
}
diff_git()
{
rm -rf $1.git.nonbare
git clone -q $1.git $1.git.nonbare
diff --exclude _darcs --exclude .git --exclude '*-darcs-backup*' -Nur $1.git.nonbare $1
return $?
}
diff_importgit()
{
test -z "`(cd $1.darcs; darcs diff)`" &&
diff --exclude _darcs --exclude .git --exclude '*-darcs-backup*' -Nur $1 $1.darcs
return $?
}
diff_importhg()
{
test -z "`(cd $1.darcs; darcs diff)`" &&
diff --exclude _darcs --exclude .hg --exclude '*-darcs-backup*' --exclude 'hg-export.*' \
--exclude '.hgtags' --exclude '*.orig' -Nur $1 $1.darcs
return $?
}
diff_importdarcs()
{
test -z "`(cd $1.darcs; darcs diff)`" &&
diff --exclude _darcs --exclude '*-darcs-backup*' -Nur $1 $2
return $?
}
diff_importbzr()
{
test -z "`(cd $1.darcs; darcs diff)`" &&
diff --exclude _darcs --exclude .bzr --exclude '*-darcs-backup*' -Nur $1 $1.darcs
return $?
}
diff_bzr()
{
cd $1.bzr/trunk
bzr update
cd - >/dev/null
diff --exclude _darcs --exclude .bzr --exclude '*-darcs-backup*' -Nur $1.bzr/trunk $1
return $?
}
diff_hg()
{
hg -R $1.hg update
diff --exclude _darcs --exclude .hg --exclude '*-darcs-backup*' -Nur $1.hg $1
return $?
}
die()
{
echo "fatal: $@"
exit 1
}
upd_file_darcs()
{
cd $1
echo $3 > $2
_drrec -a -m "updated '$2' to '$3'"
cd ..
}
upd_file_git()
{
cd $1
echo $3 > $2
git commit -a -m "updated '$2' to '$3'"
cd ..
}
upd_file_bzr()
{
cd $1
echo $3 > $2
bzr commit -m "updated '$2' to '$3'"
cd ..
}
upd_file_hg()
{
cd $1
echo $3 > $2
hg commit -m "updated '$2' to '$3'"
cd ..
}
|