~ubuntu-branches/debian/wheezy/bzr-fastimport/wheezy

« back to all changes in this revision

Viewing changes to exporters/darcs/t/lib.sh

  • Committer: Package Import Robot
  • Author(s): Jelmer Vernooij
  • Date: 2012-02-29 13:42:26 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20120229134226-dlt6vlyy36vqqw3k
Tags: 0.13.0-1
* New upstream release.
* Bump standards version to 3.9.3 (no changes).
* Add tests for autopkgtest.

Show diffs side-by-side

added added

removed removed

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