16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
18
from bzrlib.tests import TestCaseInTempDir, TestCase
19
from bzrlib import repository
20
19
from bzrlib.osutils import has_symlinks
23
22
except ImportError:
26
from bzrlib.plugins.bzrtools import cmd_baz_import
27
from bzrlib.plugins.bzrtools.baz_import import (import_version,
25
from bzrlib.plugins.bzrtools.baz_import import (import_version, revision_id,
26
cmd_baz_import, make_archive)
27
from bzrlib.errors import NoSuchRevision
32
29
from StringIO import StringIO
34
31
from testresources import (TestResource, TestLoader, OptimisingTestSuite,
38
from bzrlib.errors import NoSuchRevision
39
34
from bzrlib.plugins.bzrtools.fai import namespace_previous
40
35
from bzrlib.branch import Branch
64
59
pybaz.set_my_id("Test User<test@example.org>")
66
61
self.make_empty_import()
69
63
self._empty_tag = 'demo@DONOTUSE/c--empty-tag--0'
70
self._empty_tag_bzr = revision_id(self._empty_tag + '--base-0', None)
64
self._empty_tag_bzr = revision_id(self._empty_tag + '--base-0')
71
65
pybaz.Revision('demo@DONOTUSE/c--import--0--base-0').make_continuation(
72
66
pybaz.Version(self._empty_tag))
74
68
self._empty_merged_tag = 'demo@DONOTUSE/c--empty-merged-tag--0'
75
self._empty_merged_tag_bzr_base = revision_id(self._empty_merged_tag
77
self._empty_merged_tag_bzr = revision_id(self._empty_merged_tag
69
self._empty_merged_tag_bzr_base = revision_id(self._empty_merged_tag
71
self._empty_merged_tag_bzr = revision_id(self._empty_merged_tag
79
73
pybaz.Revision('demo@DONOTUSE/c--import--0--base-0').make_continuation(
80
74
pybaz.Version(self._empty_merged_tag))
81
75
tree = pybaz.Revision(self._empty_merged_tag + '--base-0').get(
86
80
msg["summary"]="did a merge, yarh"
88
82
shutil.rmtree(os.path.join(self._tmpdir, 'tree'))
90
84
# tree, two commits, includes merge of other branch
91
85
self._empty_merged_tag_2 = 'demo@DONOTUSE/c--empty-tag-2--0'
92
86
self._empty_merged_tag_2_bzr_base = revision_id(
93
self._empty_merged_tag_2 + '--base-0', None)
87
self._empty_merged_tag_2 + '--base-0')
94
88
self._empty_merged_tag_2_bzr = revision_id(
95
self._empty_merged_tag_2 + '--patch-1', None)
89
self._empty_merged_tag_2 + '--patch-1')
96
90
pybaz.Revision('demo@DONOTUSE/c--import--0--base-0').make_continuation(
97
91
pybaz.Version(self._empty_merged_tag_2))
98
92
tree = pybaz.Revision(self._empty_merged_tag_2 + '--base-0').get (
105
99
shutil.rmtree(os.path.join(self._tmpdir, 'tree'))
107
101
self._bad_id_tag = 'demo@DONOTUSE/c--bad-id--0'
108
self._bad_id_tag_bzr_base = revision_id(self._bad_id_tag + '--base-0',
110
self._bad_id_tag_bzr = revision_id(self._bad_id_tag + '--patch-1',
102
self._bad_id_tag_bzr_base = revision_id(self._bad_id_tag + '--base-0')
103
self._bad_id_tag_bzr = revision_id(self._bad_id_tag + '--patch-1')
112
104
pybaz.Revision('demo@DONOTUSE/c--import--0--base-0').make_continuation(
113
105
pybaz.Version(self._bad_id_tag))
114
106
tree = pybaz.Revision(self._bad_id_tag + '--base-0').get(
115
107
os.path.join(self._tmpdir, 'tree'))
116
108
from bzrlib.plugins.bzrtools.baz_import import add_file
117
add_file(os.path.join(self._tmpdir,'tree/path'), 'text',
109
add_file(os.path.join(self._tmpdir,'tree/path'), 'text',
118
110
'this_id/needs%escaping')
119
111
msg = tree.log_message()
120
112
msg["summary"] = "commit something which needs escaping."
128
120
def make_import_symlink(self):
129
121
self._import_symlink = 'demo@DONOTUSE/c--import-symlink--0'
130
122
self._import_symlink_bzr = revision_id(
131
self._import_symlink + '--base-0', None)
123
self._import_symlink + '--base-0')
132
124
os.mkdir(os.path.join(self._tmpdir, 'tree'))
133
125
tree = pybaz.init_tree(os.path.join(self._tmpdir, 'tree'),
134
126
self._import_symlink)
135
link_path = os.path.join(self._tmpdir, 'tree', 'alink')
136
os.symlink('missing-file-name', link_path)
127
os.symlink('missing-file-name',
128
os.path.join(self._tmpdir, 'tree', 'alink'))
137
129
tree.add_tag('alink')
138
130
id_file = open(os.path.join(tree, '.arch-ids', 'alink.id'), 'w')
139
131
id_file.write('symlink_tag\n')
141
133
msg = tree.log_message()
142
134
msg["summary"] = "Import with a symlink"
143
135
tree.import_(msg)
145
f = file(link_path, 'w')
146
f.write('Not a symlink no more!')
148
msg = tree.log_message()
149
msg["summary"] = "Turn a symlink into a file"
151
136
shutil.rmtree(os.path.join(self._tmpdir, 'tree'))
153
138
def make_empty_import(self):
154
139
self._import = 'demo@DONOTUSE/c--import--0'
155
140
os.mkdir(os.path.join(self._tmpdir, 'tree'))
156
tree = pybaz.init_tree(os.path.join(self._tmpdir, 'tree'),
141
tree = pybaz.init_tree(os.path.join(self._tmpdir, 'tree'),
158
143
msg = tree.log_message()
159
144
msg["summary"] = "I am importing now"
160
145
tree.import_(msg)
161
146
shutil.rmtree(os.path.join(self._tmpdir, 'tree'))
163
def make_utf8_log(self):
164
self._utf8 = 'demo@DONOTUSE/c--utf8--0'
165
os.mkdir(os.path.join(self._tmpdir, 'tree'))
166
tree = pybaz.init_tree(os.path.join(self._tmpdir, 'tree'),
168
msg = tree.log_message()
169
msg["summary"] = u"I am importing now\u1234".encode('utf-8')
171
shutil.rmtree(os.path.join(self._tmpdir, 'tree'))
173
148
def make_missing_ancestor(self):
174
149
self._archivegoneroot = os.path.join(self._tmpdir, 'archivegone')
175
150
self._archive = make_archive('demo-gone@DONOTUSE',
176
151
str(self._archivegoneroot))
177
152
self._missing_import = 'demo-gone@DONOTUSE/c--import--0'
178
self._missing_import_bzr = revision_id(self._missing_import
153
self._missing_import_bzr = revision_id(self._missing_import
180
155
self._missing_ancestor = 'demo@DONOTUSE/c--gone--0'
181
self._missing_ancestor_bzr = revision_id(self._missing_ancestor
156
self._missing_ancestor_bzr = revision_id(self._missing_ancestor
183
158
os.mkdir(os.path.join(self._tmpdir, 'tree'))
184
tree = pybaz.init_tree(os.path.join(self._tmpdir, 'tree'),
159
tree = pybaz.init_tree(os.path.join(self._tmpdir, 'tree'),
185
160
self._missing_import)
186
161
msg = tree.log_message()
187
162
msg["summary"] = "I am importing now"
192
167
pybaz.Version(self._missing_ancestor))
194
169
# make an import for testing history-reuse logic.
195
172
# note the use of a namespace layout here.
196
self._missing_import_imported = os.path.join(self._tmpdir,
173
self._missing_import_imported = os.path.join(self._tmpdir,
197
174
'archivegone-bzr')
198
175
os.mkdir(os.path.join(self._tmpdir, 'archivegone-bzr'))
199
176
os.mkdir(os.path.join(self._tmpdir, 'archivegone-bzr', 'c'))
200
import_version(os.path.join(self._tmpdir, 'archivegone-bzr',
177
import_version(os.path.join(self._tmpdir, 'archivegone-bzr',
202
pybaz.Version(self._missing_import), None)
179
pybaz.Version(self._missing_import),
203
181
# and make it inaccessible
204
182
pybaz.Archive('demo-gone@DONOTUSE').unregister()
206
184
def make_inbranch_continuation(self):
207
185
self._inbranch_tag = 'demo@DONOTUSE/c--inbranch-tag--0'
208
186
self._inbranch_tag_base = self._inbranch_tag + '--base-0'
209
self._inbranch_tag_base_bzr = revision_id(self._inbranch_tag_base,
187
self._inbranch_tag_base_bzr = revision_id(self._inbranch_tag_base)
211
188
pybaz.Revision('demo@DONOTUSE/c--import--0--base-0').make_continuation(
212
189
pybaz.Version(self._inbranch_tag))
213
190
self._inbranch_tag_head = self._inbranch_tag + '--patch-1'
214
self._inbranch_tag_head_bzr = revision_id(self._inbranch_tag_head,
191
self._inbranch_tag_head_bzr = revision_id(self._inbranch_tag_head)
216
192
pybaz.Revision(self._inbranch_tag_base).make_continuation(
217
193
pybaz.Version(self._inbranch_tag))
233
209
TestCaseInTempDir.setUp(self)
234
210
ResourcedTestCase.setUpResources(self)
235
211
os.environ['HOME'] = self._baz._homedir
212
self.output = StringIO()
237
214
def tearDown(self):
238
215
ResourcedTestCase.tearDownResources(self)
239
216
TestCaseInTempDir.tearDown(self)
241
def test_import_utf8(self):
242
import_version('output', pybaz.Version(self._baz._utf8), None)
243
branch = Branch.open('output')
244
plain_revid = 'Arch-1:demo@DONOTUSE%c--utf8--0--base-0'
245
self.assertEqual([plain_revid], branch.revision_history())
246
self.assertEqual(u'I am importing now\ufffd\ufffd\ufffd',
247
branch.repository.get_revision(plain_revid).message)
248
import_version('output2', pybaz.Version(self._baz._utf8), 'utf-8')
249
branch2 = Branch.open('output2')
250
utf8_revid = 'Arch-1-utf-8:demo@DONOTUSE%c--utf8--0--base-0'
251
self.assertEqual([utf8_revid], branch2.revision_history())
252
self.assertEqual(u'I am importing now\u1234',
253
branch2.repository.get_revision(utf8_revid).message)
218
def collect(self, text):
219
self.output.write(text)
220
self.output.write("\n")
255
222
def test_import_empty(self):
256
import_version('output', pybaz.Version(self._baz._import), None)
223
import_version('output', pybaz.Version(self._baz._import),
257
225
# expected results:
258
# one commit, no files, revision identifier of
226
# one commit, no files, revision identifier of
259
227
# 'demo@DONOTUSE_c--import--0--base-0'
260
228
branch = Branch.open('output')
261
229
repo = branch.repository
279
247
"Arch-1:demo@DONOTUSE%c--import--0--base-0")
281
249
def test_empty_tagged(self):
282
import_version('output', pybaz.Version(self._baz._empty_tag), None)
250
import_version('output', pybaz.Version(self._baz._empty_tag),
283
252
# expected results:
284
# two commits, no files, revision identifiers of
253
# two commits, no files, revision identifiers of
285
254
# 'demo@DONOTUSE_c--import--0--base-0' and
286
255
# self._baz._empty_tag_bzr
287
256
branch = Branch.open('output')
300
270
# and we should get some expected values:
301
271
self.assertEqual(rev.committer, "Test User<test@example.org>")
302
self.assertEqual(rev.message,
272
self.assertEqual(rev.message,
303
273
"tag of demo@DONOTUSE/c--import--0--base-0")
304
274
self.assertEqual(rev.revision_id, self._baz._empty_tag_bzr)
306
276
def test_empty_merged_tagged(self):
307
277
import_version('output', pybaz.Version(self._baz._empty_merged_tag),
309
279
# expected results:
310
# two commits, no files, revision identifiers of
280
# two commits, no files, revision identifiers of
311
281
# 'demo@DONOTUSE_c--import--0--base-0' and
312
282
# self._baz._empty_merged_tag_bzr_base
313
283
# self._baz._empty_merged_tag_bzr
321
291
self._baz._empty_merged_tag_bzr])
323
293
import_version('output2', pybaz.Version(self._baz._empty_merged_tag),
325
295
branch2 = Branch.open('output2')
326
296
repo2 = branch2.repository
327
297
# and import what we should be merged up against for checking with.
328
import_version('output3', pybaz.Version(self._baz._empty_tag), None)
298
import_version('output3', pybaz.Version(self._baz._empty_tag),
329
300
branch3 = Branch.open('output3')
331
302
self.assertEqual(branch.revision_history(), branch2.revision_history())
332
self.assertNotEqual(branch.revision_history(),
303
self.assertNotEqual(branch.revision_history(),
333
304
branch3.revision_history())
334
305
# check revisions in the history.
335
306
rev = repo.get_revision(self._baz._empty_merged_tag_bzr_base)
338
309
self.assertEqual(rev, rev2)
339
310
# and we should get some expected values:
340
311
self.assertEqual(rev.committer, "Test User<test@example.org>")
341
self.assertEqual(rev.message,
312
self.assertEqual(rev.message,
342
313
"tag of demo@DONOTUSE/c--import--0--base-0")
343
314
self.assertEqual(rev.revision_id, self._baz._empty_merged_tag_bzr_base)
344
315
self.assertEqual(['Arch-1:demo@DONOTUSE%c--import--0--base-0'],
357
328
self._baz._empty_merged_tag_bzr_base)
358
329
self.assertEqual(rev.parent_ids[1], self._baz._empty_tag_bzr)
360
# this tree should have nothing missing from that tree.
331
# this tree should have nothing missing from that tree.
361
332
# FIXME there is no code for this right now.
362
333
# self.assertEqual(branch.missing_revisions(branch3), [])
364
335
def test_merge_branch_with_merges(self):
365
336
import_version('output', pybaz.Version(self._baz._empty_merged_tag_2),
367
338
# expected results:
368
# two commits, no files, revision identifiers of
339
# two commits, no files, revision identifiers of
369
340
# 'demo@DONOTUSE_c--import--0--base-0' and
370
341
# self._baz._empty_merged_tag_2_bzr_base
371
342
# self._baz._empty_merged_tag_2_bzr
379
350
self._baz._empty_merged_tag_2_bzr])
381
352
import_version('output2', pybaz.Version(self._baz._empty_merged_tag_2),
383
354
branch2 = Branch.open('output2')
384
355
repo2 = branch2.repository
385
356
# and import what we should be merged up against for checking with.
386
357
import_version('output3', pybaz.Version(self._baz._empty_merged_tag),
388
359
branch3 = Branch.open('output3')
390
361
self.assertEqual(branch.revision_history(), branch2.revision_history())
391
self.assertNotEqual(branch.revision_history(),
362
self.assertNotEqual(branch.revision_history(),
392
363
branch3.revision_history())
393
364
# check revisions in the history.
394
365
rev = repo.get_revision(self._baz._empty_merged_tag_2_bzr_base)
397
368
self.assertEqual(rev, rev2)
398
369
# and we should get some expected values:
399
370
self.assertEqual(rev.committer, "Test User<test@example.org>")
400
self.assertEqual(rev.message,
371
self.assertEqual(rev.message,
401
372
"tag of demo@DONOTUSE/c--import--0--base-0")
402
self.assertEqual(rev.revision_id,
373
self.assertEqual(rev.revision_id,
403
374
self._baz._empty_merged_tag_2_bzr_base)
405
376
# check next revisions in the history.
416
387
self.assertEqual(rev.parent_ids[1],
417
388
self._baz._empty_merged_tag_bzr)
419
# this tree should have nothing missing from that tree.
390
# this tree should have nothing missing from that tree.
420
391
# FIXME there is no code for this right now.
421
392
# self.assertEqual(branch.missing_revisions(branch3), [])
423
394
def test_import_symlink(self):
424
395
import_version('output', pybaz.Version(self._baz._import_symlink),
426
397
# expected results:
427
# two commits, no files, revision identifier of
398
# one commit, no files, revision identifier of
428
399
# 'demo@DONOTUSE_c--import--0--base-0'
429
400
branch = Branch.open('output')
430
401
self.assertEqual(branch.revision_history(),
451
422
self.assertEqual(entry.kind, 'symlink')
452
423
self.assertEqual(entry.symlink_target, 'missing-file-name')
454
# Test kind change for import
455
import_version('output3', pybaz.Version(self._baz._import_symlink),
458
425
def test_missing_ancestor(self):
459
426
import_version('output', pybaz.Version(self._baz._missing_ancestor),
461
428
# expected results:
462
# one commits, no files, revision identifiers of
429
# one commits, no files, revision identifiers of
463
430
# 'demo@DONOTUSE_c--gone--0--base-0' and
464
431
# a merge of demo-gone@DONOTUSE%c--import--0
465
432
branch = Branch.open('output')
478
445
# and we should get some expected values:
479
446
self.assertEqual(rev.committer, "Test User<test@example.org>")
480
self.assertEqual(rev.message,
447
self.assertEqual(rev.message,
481
448
"tag of demo-gone@DONOTUSE/c--import--0--base-0")
482
449
self.assertEqual(rev.revision_id, self._baz._missing_ancestor_bzr)
483
450
self.assertEqual(rev.parent_ids[0], self._baz._missing_import_bzr)
484
451
self.assertEqual(1, len(rev.parent_ids))
486
453
# must NOT be able to get the merged evision
487
self.assertRaises(NoSuchRevision, branch.repository.get_revision,
454
self.assertRaises(NoSuchRevision, branch.repository.get_revision,
488
455
self._baz._missing_import_bzr)
490
457
def test_missing_ancestor_reusing_history(self):
491
458
import_version('output', pybaz.Version(self._baz._missing_ancestor),
493
460
reuse_history_from=[self._baz._missing_import_imported])
494
461
# expected results:
495
# one commits, no files, revision identifiers of
496
# 'demo-gone@DONOTUSE%c--import--0--base-0' and
462
# one commits, no files, revision identifiers of
463
# 'demo-gone@DONOTUSE%c--import--0--base-0' and
497
464
# 'demo@DONOTUSE%c--gone--0--base-0'
498
465
branch = Branch.open('output')
499
466
self.assertEqual(branch.revision_history(),
516
483
# and we should get some expected values:
517
484
self.assertEqual(rev.committer, "Test User<test@example.org>")
518
self.assertEqual(rev.message,
485
self.assertEqual(rev.message,
519
486
"tag of demo-gone@DONOTUSE/c--import--0--base-0")
520
487
self.assertEqual(rev.revision_id, self._baz._missing_ancestor_bzr)
521
488
self.assertEqual(rev.parent_ids[0], self._baz._missing_import_bzr)
522
489
self.assertEqual(1, len(rev.parent_ids))
524
491
def test_bad_file_id(self):
525
import_version('output', pybaz.Version(self._baz._bad_id_tag), None)
492
import_version('output', pybaz.Version(self._baz._bad_id_tag),
526
494
# expected results:
527
# three commits, one files, revision identifiers of
495
# three commits, one files, revision identifiers of
528
496
# 'demo@DONOTUSE_c--import--0--base-0' ,
529
497
# 'demo@DONOTUSE/c--bad-id--0--base-0' ,
530
498
# ''demo@DONOTUSE/c--bad-id--0--patch-1'
539
507
self.assertEqual('path', inv.id2path('x_this_id%2fneeds%25escaping'))
541
509
def test_appending_revisions_already_present(self):
542
import_version('output', pybaz.Version(self._baz._bad_id_tag), None,
510
import_version('output', pybaz.Version(self._baz._bad_id_tag),
511
self.collect, max_count=2)
544
512
# expected results:
545
# three commits, one files, revision identifiers of
513
# three commits, one files, revision identifiers of
546
514
# 'demo@DONOTUSE_c--import--0--base-0' ,
547
515
# 'demo@DONOTUSE/c--bad-id--0--base-0' ,
548
516
# ''demo@DONOTUSE/c--bad-id--0--patch-1'
569
538
self.assertEqual('path', inv.id2path('x_this_id%2fneeds%25escaping'))
571
540
def test_appending_revisions_all_already_present(self):
572
import_version('output', pybaz.Version(self._baz._bad_id_tag), None)
541
import_version('output', pybaz.Version(self._baz._bad_id_tag),
573
543
# expected results:
574
# three commits, one files, revision identifiers of
544
# three commits, one files, revision identifiers of
575
545
# 'demo@DONOTUSE_c--import--0--base-0' ,
576
546
# 'demo@DONOTUSE/c--bad-id--0--base-0' ,
577
547
# ''demo@DONOTUSE/c--bad-id--0--patch-1'
599
570
self.assertEqual('path', inv.id2path('x_this_id%2fneeds%25escaping'))
601
572
def test_inbranch_conversion(self):
602
import_version('output', pybaz.Version(self._baz._inbranch_tag), None)
573
import_version('output', pybaz.Version(self._baz._inbranch_tag),
603
575
# expected results:
604
# three commits, no files, revision identifiers of
576
# three commits, no files, revision identifiers of
605
577
# 'demo@DONOTUSE_c--import--0--base-0' and
606
578
# self._baz._inbranch_tag_base_bzr
607
579
# self._baz._inbranch_tag_head_bzr
612
584
self._baz._inbranch_tag_base_bzr,
613
585
self._baz._inbranch_tag_head_bzr])
615
import_version('output2', pybaz.Version(self._baz._inbranch_tag), None)
587
import_version('output2', pybaz.Version(self._baz._inbranch_tag),
616
589
branch2 = Branch.open('output2')
618
591
self.assertEqual(branch.revision_history(), branch2.revision_history())
619
592
# check revisions in the history.
620
593
rev = branch.repository.get_revision(self._baz._inbranch_tag_base_bzr)
638
611
self.assertEqual(rev.parent_ids,
639
612
[self._baz._inbranch_tag_base_bzr])
641
def test_no_commits_same_as_missing(self):
644
branch = bzrlib.bzrdir.BzrDir.create_branch_convenience(path)
645
import_version(path, pybaz.Version(self._baz._import), None)
647
# one commit, revision identifier of
648
# 'demo@DONOTUSE_c--import--0--base-0'
649
self.assertEqual(branch.revision_history(),
650
['Arch-1:demo@DONOTUSE%c--import--0--base-0'])
653
615
class TestNamespacePrevious(TestCase):
734
696
shutil.rmtree(os.path.join(self._tmpdir, 'tree'))
736
698
def test_cmd_exists(self):
737
from bzrlib.plugins.bzrtools import cmd_baz_import
699
from bzrlib.plugins.bzrtools.baz_import import cmd_baz_import
739
701
def test_empty_archive(self):
740
702
command = cmd_baz_import()
741
703
command.run(os.path.join(self._tmpdir, 'output'), 'demo@DONOTUSE')
742
704
self.failUnless(os.path.exists(os.path.join(self._tmpdir,'output')))
743
705
walk_len = len(list(os.walk(os.path.join(self._tmpdir,'output'))))
744
self.assertEqual(7, walk_len)
706
self.assertEqual(6, walk_len)
746
708
def test_two_branches(self):
747
709
self.make_import('c--0')
749
711
command = cmd_baz_import()
750
712
command.run(os.path.join(self._tmpdir, 'output'), 'demo@DONOTUSE')
751
713
self.failUnless(os.path.exists(os.path.join(self._tmpdir,'output')))
752
self.failUnless(os.path.exists(os.path.join(self._tmpdir,'output',
714
self.failUnless(os.path.exists(os.path.join(self._tmpdir,'output',
754
self.failUnless(os.path.exists(os.path.join(self._tmpdir,'output',
716
self.failUnless(os.path.exists(os.path.join(self._tmpdir,'output',
755
717
'c1', '0.2','branch')))
756
default_format = repository.RepositoryFormat.get_default_format()
757
if getattr(default_format, 'rich_root_data', False):
761
718
walk_len = len(list(os.walk(os.path.join(self._tmpdir,'output'))))
762
self.assertEqual(num_files, walk_len)
719
self.assertEqual(17, walk_len)
764
721
def test_run_twice(self):
765
722
self.make_import('c--0')
766
723
command = cmd_baz_import()
767
724
command.run(os.path.join(self._tmpdir, 'output'), 'demo@DONOTUSE')
768
725
command.run(os.path.join(self._tmpdir, 'output'), 'demo@DONOTUSE')
770
727
def test_accepts_reuse_history(self):
771
728
self.make_import('c--0')
772
729
self.run_bzr('baz-import', os.path.join(self._tmpdir, 'output'),
773
730
'demo@DONOTUSE', '.', '.')
775
def test_does_not_need_reuse_history(self):
776
self.make_import('c--0')
777
self.run_bzr('baz-import', os.path.join(self._tmpdir, 'output'),
780
def test_does_not_need_reuse_history(self):
781
self.make_import('c--0')
782
self.run_bzr('baz-import', os.path.join(self._tmpdir, 'output'),
785
def test_encoding_flag(self):
786
self.make_import('c--0')
787
self.run_bzr('baz-import', os.path.join(self._tmpdir, 'output'),
789
self.assertEqual(['Arch-1:demo@DONOTUSE%c--0--base-0'],
790
Branch.open(os.path.join(self._tmpdir,
791
'output/c/+trunk')).revision_history())
792
self.run_bzr('baz-import', os.path.join(self._tmpdir, 'output2'),
793
'demo@DONOTUSE', '--encoding', 'utf-8')
794
self.assertEqual(['Arch-1-utf-8:demo@DONOTUSE%c--0--base-0'],
795
Branch.open(os.path.join(self._tmpdir,
796
'output2/c/+trunk')).revision_history())
797
self.run_bzr('baz-import-branch', os.path.join(self._tmpdir, 'output3'),
798
'demo@DONOTUSE/c--0')
799
self.assertEqual(['Arch-1:demo@DONOTUSE%c--0--base-0'],
800
Branch.open(os.path.join(self._tmpdir,
801
'output3')).revision_history())
802
self.run_bzr('baz-import-branch', os.path.join(self._tmpdir,
803
'output4'), 'demo@DONOTUSE/c--0', '--encoding', 'utf-8')
804
self.assertEqual(['Arch-1-utf-8:demo@DONOTUSE%c--0--base-0'],
805
Branch.open(os.path.join(self._tmpdir,
806
'output4')).revision_history())
732
def test_does_not_need_reuse_history(self):
733
self.make_import('c--0')
734
self.run_bzr('baz-import', os.path.join(self._tmpdir, 'output'),