358
358
# --no-strict overrides --strict
359
359
self.run_bzr('commit', '--strict', '-m', 'add b', '--no-strict',
360
360
working_dir='tree')
362
def test_fixes_bug_output(self):
363
"""commit --fixes=lp:23452 succeeds without output."""
364
tree = self.make_branch_and_tree('tree')
365
self.build_tree(['tree/hello.txt'])
366
tree.add('hello.txt')
367
output, err = self.run_bzr(
368
'commit', '-m', 'hello', '--fixes=lp:23452', 'tree/hello.txt')
369
self.assertEqual('', output)
370
self.assertEqual('added hello.txt\nCommitted revision 1.\n', err)
372
def test_fixes_bug_sets_property(self):
373
"""commit --fixes=lp:234 sets the lp:234 revprop to 'fixed'."""
374
tree = self.make_branch_and_tree('tree')
375
self.build_tree(['tree/hello.txt'])
376
tree.add('hello.txt')
378
'commit', '-m', 'hello', '--fixes=lp:234', 'tree/hello.txt')
380
# Get the revision properties, ignoring the branch-nick property, which
381
# we don't care about for this test.
382
last_rev = tree.branch.repository.get_revision(tree.last_revision())
383
properties = dict(last_rev.properties)
384
del properties['branch-nick']
386
self.assertEqual({'bugs': 'https://launchpad.net/bugs/234 fixed'},
389
def test_fixes_multiple_bugs_sets_properties(self):
390
"""--fixes can be used more than once to show that bugs are fixed."""
391
tree = self.make_branch_and_tree('tree')
392
self.build_tree(['tree/hello.txt'])
393
tree.add('hello.txt')
395
'commit', '-m', 'hello', '--fixes=lp:123', '--fixes=lp:235',
398
# Get the revision properties, ignoring the branch-nick property, which
399
# we don't care about for this test.
400
last_rev = tree.branch.repository.get_revision(tree.last_revision())
401
properties = dict(last_rev.properties)
402
del properties['branch-nick']
405
{'bugs': 'https://launchpad.net/bugs/123 fixed\n'
406
'https://launchpad.net/bugs/235 fixed'},
409
def test_fixes_bug_with_alternate_trackers(self):
410
"""--fixes can be used on a properly configured branch to mark bug
411
fixes on multiple trackers.
413
tree = self.make_branch_and_tree('tree')
414
tree.branch.get_config().set_user_option(
415
'trac_twisted_url', 'http://twistedmatrix.com/trac')
416
self.build_tree(['tree/hello.txt'])
417
tree.add('hello.txt')
419
'commit', '-m', 'hello', '--fixes=lp:123',
420
'--fixes=twisted:235', 'tree/')
422
# Get the revision properties, ignoring the branch-nick property, which
423
# we don't care about for this test.
424
last_rev = tree.branch.repository.get_revision(tree.last_revision())
425
properties = dict(last_rev.properties)
426
del properties['branch-nick']
429
{'bugs': 'https://launchpad.net/bugs/123 fixed\n'
430
'http://twistedmatrix.com/trac/ticket/235 fixed'},
433
def test_fixes_unknown_bug_prefix(self):
434
tree = self.make_branch_and_tree('tree')
435
self.build_tree(['tree/hello.txt'])
436
tree.add('hello.txt')
438
["Unrecognized bug %s. Commit refused." % 'xxx:123'],
439
'commit', '-m', 'add b', '--fixes=xxx:123',
442
def test_fixes_invalid_bug_number(self):
443
tree = self.make_branch_and_tree('tree')
444
self.build_tree(['tree/hello.txt'])
445
tree.add('hello.txt')
447
["Invalid bug identifier for %s. Commit refused." % 'lp:orange'],
448
'commit', '-m', 'add b', '--fixes=lp:orange',
451
def test_fixes_invalid_argument(self):
452
"""Raise an appropriate error when the fixes argument isn't tag:id."""
453
tree = self.make_branch_and_tree('tree')
454
self.build_tree(['tree/hello.txt'])
455
tree.add('hello.txt')
457
[r"Invalid bug orange. Must be in the form of 'tag:id'\. "
458
r"Commit refused\."],
459
'commit', '-m', 'add b', '--fixes=orange',