/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to tests/test_commit.py

  • Committer: Vincent Ladeuil
  • Date: 2009-05-28 15:14:14 UTC
  • mto: This revision was merged to the branch mainline in revision 640.
  • Revision ID: v.ladeuil+lp@free.fr-20090528151414-q5rlh8kaicx2hgqo
Implement commit message saving without modifying bzrlib.

* tests/test_commit.py:
(TestSavedCommitMessages.setUp): Install the post_uncommit hook
for all relevant tests.
(TestUncommitHook.setUp): Use explicit rev-ids to ease debugging.

* commit.py: 
Fix imports. Integrate SavedCommitMessagesManager so that we don't
need to modify bzrlib anymore.
(CommitDialog.__init__, CommitDialog._fill_in_files,
CommitDialog._construct_global_message, CommitDialog._do_cancel,
CommitDialog._do_commit): Stop testing can_save_commit_messages,
SavedCommitMessagesManager is always available now.
(SavedCommitMessagesManager): Borrowed from Anne Mohsen's patch.
(save_commit_messages): Implement the post_uncommit hook.

* __init__.py:
Install a lazy hook.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import gtk
22
22
 
23
23
from bzrlib import (
 
24
    branch,
 
25
    revision,
24
26
    tests,
25
 
    revision,
26
27
    uncommit,
27
28
    )
28
29
from bzrlib.util import bencode
1094
1095
 
1095
1096
class TestSavedCommitMessages(tests.TestCaseWithTransport):
1096
1097
 
 
1098
    def setUp(self):
 
1099
        super(TestSavedCommitMessages, self).setUp()
 
1100
        # Install our hook
 
1101
        branch.Branch.hooks.install_named_hook(
 
1102
            'post_uncommit', commit.save_commit_messages, None)
 
1103
 
1097
1104
    def _get_file_info_dict(self, rank):
1098
1105
        file_info = [dict(path='a', file_id='a-id', message='a msg %d' % rank),
1099
1106
                     dict(path='b', file_id='b-id', message='b msg %d' % rank)]
1119
1126
        self.build_tree(['tree/a', 'tree/b'])
1120
1127
        self.tree.add(['a'], ['a-id'])
1121
1128
        self.tree.add(['b'], ['b-id'])
1122
 
        rev1 = self.tree.commit('one', revprops=self._get_file_info_revprops(1))
1123
 
        rev2 = self.tree.commit('two', revprops=self._get_file_info_revprops(2))
1124
 
        rev3 = self.tree.commit('three',
 
1129
        rev1 = self.tree.commit('one', rev_id='one-id',
 
1130
                                revprops=self._get_file_info_revprops(1))
 
1131
        rev2 = self.tree.commit('two', rev_id='two-id',
 
1132
                                revprops=self._get_file_info_revprops(2))
 
1133
        rev3 = self.tree.commit('three', rev_id='three-id',
1125
1134
                                revprops=self._get_file_info_revprops(3))
1126
1135
 
1127
1136
    def test_uncommit_one_by_one(self):