130
130
def test_sprout_with_tags(self):
131
131
c1 = self.remote_real.do_commit(
132
132
message='message',
133
committer='committer <committer@example.com>',
134
author='author <author@example.com>')
133
committer=b'committer <committer@example.com>',
134
author=b'author <author@example.com>')
135
135
c2 = self.remote_real.do_commit(
136
message='another commit',
137
committer='committer <committer@example.com>',
138
author='author <author@example.com>',
139
ref='refs/tags/another')
136
message=b'another commit',
137
committer=b'committer <committer@example.com>',
138
author=b'author <author@example.com>',
139
ref=b'refs/tags/another')
140
140
self.remote_real.refs['refs/tags/blah'] = self.remote_real.head()
142
142
remote = ControlDir.open(self.remote_url)
154
154
def test_sprout_with_annotated_tag(self):
155
155
c1 = self.remote_real.do_commit(
157
committer='committer <committer@example.com>',
158
author='author <author@example.com>')
157
committer=b'committer <committer@example.com>',
158
author=b'author <author@example.com>')
159
159
c2 = self.remote_real.do_commit(
160
message='another commit',
161
committer='committer <committer@example.com>',
162
author='author <author@example.com>',
163
ref='refs/heads/another')
160
message=b'another commit',
161
committer=b'committer <committer@example.com>',
162
author=b'author <author@example.com>',
163
ref=b'refs/heads/another')
164
164
porcelain.tag_create(
165
165
self.remote_real,
167
author='author <author@example.com>',
167
author=b'author <author@example.com>',
169
169
tag_time=int(time.time()),
172
message="Annotated tag")
172
message=b"Annotated tag")
174
174
remote = ControlDir.open(self.remote_url)
175
175
self.make_controldir('local', format=self._to_format)
224
224
self.assertIs(None, result.new_revno)
226
result.report(StringIO())
226
result.report(BytesIO())
228
228
self.assertEqual(
229
{'refs/heads/newbranch': self.remote_real.refs['refs/heads/newbranch'],
229
{b'refs/heads/newbranch': self.remote_real.refs[b'refs/heads/newbranch'],
231
231
self.remote_real.get_refs())
233
233
def test_push(self):
234
234
c1 = self.remote_real.do_commit(
236
committer='committer <committer@example.com>',
237
author='author <author@example.com>')
236
committer=b'committer <committer@example.com>',
237
author=b'author <author@example.com>')
239
239
remote = ControlDir.open(self.remote_url)
240
240
self.make_controldir('local', format=self._from_format)
254
254
self.assertEqual(0, result.old_revno)
255
255
self.assertEqual(2, result.new_revno)
257
result.report(StringIO())
257
result.report(BytesIO())
259
259
self.assertEqual(
260
{'refs/heads/master': self.remote_real.head(),
261
'HEAD': self.remote_real.head(),
262
'refs/heads/newbranch': self.remote_real.refs['refs/heads/newbranch'],
263
'refs/tags/sometag': self.remote_real.refs['refs/heads/newbranch'],
260
{b'refs/heads/master': self.remote_real.head(),
261
b'HEAD': self.remote_real.head(),
262
b'refs/heads/newbranch': self.remote_real.refs[b'refs/heads/newbranch'],
263
b'refs/tags/sometag': self.remote_real.refs[b'refs/heads/newbranch'],
265
265
self.remote_real.get_refs())
267
267
def test_push_diverged(self):
268
268
c1 = self.remote_real.do_commit(
270
committer='committer <committer@example.com>',
271
author='author <author@example.com>',
272
ref='refs/heads/newbranch')
270
committer=b'committer <committer@example.com>',
271
author=b'author <author@example.com>',
272
ref=b'refs/heads/newbranch')
274
274
remote = ControlDir.open(self.remote_url)
275
275
wt = self.make_branch_and_tree('local', format=self._from_format)
318
318
def test_remove_branch(self):
319
319
c1 = self.remote_real.do_commit(
321
committer='committer <committer@example.com>',
322
author='author <author@example.com>')
321
committer=b'committer <committer@example.com>',
322
author=b'author <author@example.com>')
323
323
c2 = self.remote_real.do_commit(
324
message='another commit',
325
committer='committer <committer@example.com>',
326
author='author <author@example.com>',
327
ref='refs/heads/blah')
324
message=b'another commit',
325
committer=b'committer <committer@example.com>',
326
author=b'author <author@example.com>',
327
ref=b'refs/heads/blah')
329
329
remote = ControlDir.open(self.remote_url)
330
330
remote.destroy_branch(name='blah')
331
331
self.assertEqual(
332
332
self.remote_real.get_refs(),
333
{'refs/heads/master': self.remote_real.head(),
334
'HEAD': self.remote_real.head(),
333
{b'refs/heads/master': self.remote_real.head(),
334
b'HEAD': self.remote_real.head(),
337
337
def test_list_branches(self):
338
338
c1 = self.remote_real.do_commit(
340
committer='committer <committer@example.com>',
341
author='author <author@example.com>')
340
committer=b'committer <committer@example.com>',
341
author=b'author <author@example.com>')
342
342
c2 = self.remote_real.do_commit(
343
message='another commit',
344
committer='committer <committer@example.com>',
345
author='author <author@example.com>',
346
ref='refs/heads/blah')
343
message=b'another commit',
344
committer=b'committer <committer@example.com>',
345
author=b'author <author@example.com>',
346
ref=b'refs/heads/blah')
348
348
remote = ControlDir.open(self.remote_url)
349
349
self.assertEqual(
353
353
def test_get_branches(self):
354
354
c1 = self.remote_real.do_commit(
356
committer='committer <committer@example.com>',
357
author='author <author@example.com>')
356
committer=b'committer <committer@example.com>',
357
author=b'author <author@example.com>')
358
358
c2 = self.remote_real.do_commit(
359
message='another commit',
360
committer='committer <committer@example.com>',
361
author='author <author@example.com>',
362
ref='refs/heads/blah')
359
message=b'another commit',
360
committer=b'committer <committer@example.com>',
361
author=b'author <author@example.com>',
362
ref=b'refs/heads/blah')
364
364
remote = ControlDir.open(self.remote_url)
365
365
self.assertEqual(
369
369
def test_remove_tag(self):
370
370
c1 = self.remote_real.do_commit(
372
committer='committer <committer@example.com>',
373
author='author <author@example.com>')
372
committer=b'committer <committer@example.com>',
373
author=b'author <author@example.com>')
374
374
c2 = self.remote_real.do_commit(
375
message='another commit',
376
committer='committer <committer@example.com>',
377
author='author <author@example.com>',
378
ref='refs/tags/blah')
375
message=b'another commit',
376
committer=b'committer <committer@example.com>',
377
author=b'author <author@example.com>',
378
ref=b'refs/tags/blah')
380
380
remote = ControlDir.open(self.remote_url)
381
381
remote_branch = remote.open_branch()
383
383
self.assertRaises(NoSuchTag, remote_branch.tags.delete_tag, 'blah')
384
384
self.assertEqual(
385
385
self.remote_real.get_refs(),
386
{'refs/heads/master': self.remote_real.head(),
387
'HEAD': self.remote_real.head(),
386
{b'refs/heads/master': self.remote_real.head(),
387
b'HEAD': self.remote_real.head(),
390
390
def test_set_tag(self):
391
391
c1 = self.remote_real.do_commit(
393
committer='committer <committer@example.com>',
394
author='author <author@example.com>')
393
committer=b'committer <committer@example.com>',
394
author=b'author <author@example.com>')
395
395
c2 = self.remote_real.do_commit(
396
message='another commit',
397
committer='committer <committer@example.com>',
398
author='author <author@example.com>')
396
message=b'another commit',
397
committer=b'committer <committer@example.com>',
398
author=b'author <author@example.com>')
400
400
remote = ControlDir.open(self.remote_url)
401
401
remote.open_branch().tags.set_tag(
402
'blah', default_mapping.revision_id_foreign_to_bzr(c1))
402
b'blah', default_mapping.revision_id_foreign_to_bzr(c1))
403
403
self.assertEqual(
404
404
self.remote_real.get_refs(),
405
{'refs/heads/master': self.remote_real.head(),
406
'refs/tags/blah': c1,
407
'HEAD': self.remote_real.head(),
405
{b'refs/heads/master': self.remote_real.head(),
406
b'refs/tags/blah': c1,
407
b'HEAD': self.remote_real.head(),
410
410
def test_annotated_tag(self):
411
411
c1 = self.remote_real.do_commit(
413
committer='committer <committer@example.com>',
414
author='author <author@example.com>')
413
committer=b'committer <committer@example.com>',
414
author=b'author <author@example.com>')
415
415
c2 = self.remote_real.do_commit(
416
message='another commit',
417
committer='committer <committer@example.com>',
418
author='author <author@example.com>')
416
message=b'another commit',
417
committer=b'committer <committer@example.com>',
418
author=b'author <author@example.com>')
420
420
porcelain.tag_create(
421
421
self.remote_real,
423
author='author <author@example.com>',
423
author=b'author <author@example.com>',
425
425
tag_time=int(time.time()),
428
message="Annotated tag")
428
message=b"Annotated tag")
430
430
remote = ControlDir.open(self.remote_url)
431
431
remote_branch = remote.open_branch()
432
432
self.assertEqual({
433
'blah': default_mapping.revision_id_foreign_to_bzr(c2)},
433
b'blah': default_mapping.revision_id_foreign_to_bzr(c2)},
434
434
remote_branch.tags.get_tag_dict())
436
436
def tetst_get_branch_reference(self):
437
437
c1 = self.remote_real.do_commit(
439
committer='committer <committer@example.com>',
440
author='author <author@example.com>')
439
committer=b'committer <committer@example.com>',
440
author=b'author <author@example.com>')
441
441
c2 = self.remote_real.do_commit(
442
message='another commit',
443
committer='committer <committer@example.com>',
444
author='author <author@example.com>')
442
message=b'another commit',
443
committer=b'committer <committer@example.com>',
444
author=b'author <author@example.com>')
446
446
remote = ControlDir.open(self.remote_url)
447
self.assertEqual('refs/heads/master', remote.get_branch_reference(''))
447
self.assertEqual(b'refs/heads/master', remote.get_branch_reference(''))
448
448
self.assertEqual(None, remote.get_branch_reference('master'))