58
55
DocTestMatches("""\
60
aborting commit write group: PointlessCommit(No changes to commit)
61
57
bzr: ERROR: No changes to commit.\
62
58
Please 'bzr add' the files you want to commit,\
63
59
or use --unchanged to force an empty commit.
139
135
def test_unicode_commit_message_is_filename(self):
140
136
"""Unicode commit message same as a filename (Bug #563646).
142
self.requireFeature(UnicodeFilenameFeature)
138
self.requireFeature(features.UnicodeFilenameFeature)
143
139
file_name = u'\N{euro sign}'
144
140
self.run_bzr(['init'])
145
141
open(file_name, 'w').write('hello world')
333
329
tree = self.make_branch_and_tree('.')
334
330
self.build_tree_contents([('foo.c', 'int main() {}')])
335
331
tree.add('foo.c')
336
self.run_bzr('commit -m ""', retcode=3)
332
self.run_bzr('commit -m ""')
338
334
def test_other_branch_commit(self):
339
335
# this branch is to ensure consistent behaviour, whether we're run
600
596
'commit -m add-b --fixes=xxx:123',
601
597
working_dir='tree')
599
def test_fixes_bug_with_default_tracker(self):
600
"""commit --fixes=234 uses the default bug tracker."""
601
tree = self.make_branch_and_tree('tree')
602
self.build_tree(['tree/hello.txt'])
603
tree.add('hello.txt')
605
["bzr: ERROR: No tracker specified for bug 123. Use the form "
606
"'tracker:id' or specify a default bug tracker using the "
607
"`bugtracker` option.\n"
608
"See \"bzr help bugs\" for more information on this feature. "
610
'commit -m add-b --fixes=123',
612
tree.branch.get_config().set_user_option("bugtracker", "lp")
613
self.run_bzr('commit -m hello --fixes=234 tree/hello.txt')
614
last_rev = tree.branch.repository.get_revision(tree.last_revision())
615
self.assertEqual('https://launchpad.net/bugs/234 fixed',
616
last_rev.properties['bugs'])
603
618
def test_fixes_invalid_bug_number(self):
604
619
tree = self.make_branch_and_tree('tree')
605
620
self.build_tree(['tree/hello.txt'])
617
632
self.build_tree(['tree/hello.txt'])
618
633
tree.add('hello.txt')
619
634
self.run_bzr_error(
620
[r"Invalid bug orange. Must be in the form of 'tracker:id'\. "
621
r"See \"bzr help bugs\" for more information on this feature.\n"
622
r"Commit refused\."],
623
'commit -m add-b --fixes=orange',
635
[r"Invalid bug orange:apples:bananas. Must be in the form of "
636
r"'tracker:id'\. See \"bzr help bugs\" for more information on "
637
r"this feature.\nCommit refused\."],
638
'commit -m add-b --fixes=orange:apples:bananas',
624
639
working_dir='tree')
626
641
def test_no_author(self):
742
757
tree.add('hello.txt')
760
def test_edit_empty_message(self):
761
tree = self.make_branch_and_tree('tree')
763
self.build_tree(['tree/hello.txt'])
764
tree.add('hello.txt')
765
out, err = self.run_bzr("commit tree/hello.txt", retcode=3,
767
self.assertContainsRe(err,
768
"bzr: ERROR: Empty commit message specified")
745
770
def test_commit_hook_template_accepted(self):
746
771
tree = self.setup_commit_with_template()
747
772
out, err = self.run_bzr("commit tree/hello.txt", stdin="y\n")
751
776
def test_commit_hook_template_rejected(self):
752
777
tree = self.setup_commit_with_template()
753
778
expected = tree.last_revision()
754
out, err = self.run_bzr_error(["empty commit message"],
779
out, err = self.run_bzr_error(["Empty commit message specified."
780
" Please specify a commit message with either"
781
" --message or --file or leave a blank message"
782
" with --message \"\"."],
755
783
"commit tree/hello.txt", stdin="n\n")
756
784
self.assertEqual(expected, tree.last_revision())
786
def test_set_commit_message(self):
787
msgeditor.hooks.install_named_hook("set_commit_message",
788
lambda commit_obj, msg: "save me some typing\n", None)
789
tree = self.make_branch_and_tree('tree')
790
self.build_tree(['tree/hello.txt'])
791
tree.add('hello.txt')
792
out, err = self.run_bzr("commit tree/hello.txt")
793
last_rev = tree.branch.repository.get_revision(tree.last_revision())
794
self.assertEqual('save me some typing\n', last_rev.message)
758
796
def test_commit_without_username(self):
759
797
"""Ensure commit error if username is not set.