/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_commit.py

  • Committer: Vincent Ladeuil
  • Date: 2012-01-18 14:09:19 UTC
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120118140919-rlvdrhpc0nq1lbwi
Change set/remove to require a lock for the branch config files.

This means that tests (or any plugin for that matter) do not requires an
explicit lock on the branch anymore to change a single option. This also
means the optimisation becomes "opt-in" and as such won't be as
spectacular as it may be and/or harder to get right (nothing fails
anymore).

This reduces the diff by ~300 lines.

Code/tests that were updating more than one config option is still taking
a lock to at least avoid some IOs and demonstrate the benefits through
the decreased number of hpss calls.

The duplication between BranchStack and BranchOnlyStack will be removed
once the same sharing is in place for local config files, at which point
the Stack class itself may be able to host the changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    ignores,
31
31
    msgeditor,
32
32
    )
33
 
from bzrlib.controldir import ControlDir
 
33
from bzrlib.bzrdir import BzrDir
34
34
from bzrlib.tests import (
35
35
    test_foreign,
36
36
    features,
117
117
    def prepare_simple_history(self):
118
118
        """Prepare and return a working tree with one commit of one file"""
119
119
        # Commit with modified file should say so
120
 
        wt = ControlDir.create_standalone_workingtree('.')
 
120
        wt = BzrDir.create_standalone_workingtree('.')
121
121
        self.build_tree(['hello.txt', 'extra.txt'])
122
122
        wt.add(['hello.txt'])
123
123
        wt.commit(message='added')
139
139
        self.requireFeature(features.UnicodeFilenameFeature)
140
140
        file_name = u'\N{euro sign}'
141
141
        self.run_bzr(['init'])
142
 
        with open(file_name, 'w') as f: f.write('hello world')
 
142
        open(file_name, 'w').write('hello world')
143
143
        self.run_bzr(['add'])
144
144
        out, err = self.run_bzr(['commit', '-m', file_name])
145
145
        reflags = re.MULTILINE|re.DOTALL|re.UNICODE
157
157
        try:
158
158
            osutils.get_terminal_encoding = lambda trace=None: 'ascii'
159
159
            file_name = u'foo\u1234'
160
 
            with open(file_name, 'w') as f: f.write('hello world')
 
160
            open(file_name, 'w').write('hello world')
161
161
            self.run_bzr(['add'])
162
162
            out, err = self.run_bzr(['commit', '-m', file_name])
163
163
            reflags = re.MULTILINE|re.DOTALL|re.UNICODE
225
225
    def test_verbose_commit_with_unknown(self):
226
226
        """Unknown files should not be listed by default in verbose output"""
227
227
        # Is that really the best policy?
228
 
        wt = ControlDir.create_standalone_workingtree('.')
 
228
        wt = BzrDir.create_standalone_workingtree('.')
229
229
        self.build_tree(['hello.txt', 'extra.txt'])
230
230
        wt.add(['hello.txt'])
231
231
        out,err = self.run_bzr('commit -m added')
628
628
            "Commit refused."],
629
629
            'commit -m add-b --fixes=123',
630
630
            working_dir='tree')
631
 
        tree.branch.get_config_stack().set("bugtracker", "lp")
 
631
        tree.branch.get_config().set_user_option("bugtracker", "lp")
632
632
        self.run_bzr('commit -m hello --fixes=234 tree/hello.txt')
633
633
        last_rev = tree.branch.repository.get_revision(tree.last_revision())
634
634
        self.assertEqual('https://launchpad.net/bugs/234 fixed',
757
757
        # "UnlockableTransport error trying to commit in checkout of readonly
758
758
        # branch"
759
759
        self.make_branch('master')
760
 
        master = ControlDir.open_from_transport(
 
760
        master = BzrDir.open_from_transport(
761
761
            self.get_readonly_transport('master')).open_branch()
762
762
        master.create_checkout('checkout')
763
763
        out, err = self.run_bzr(['commit', '--unchanged', '-mfoo', 'checkout'],
859
859
        Regression test for bug 185211.
860
860
        """
861
861
        tree = self.make_branch_and_tree('.')
862
 
        self.build_tree([u'abc\xa7/', u'abc\xa7/foo'])
 
862
        self.build_tree([u'abc\xc3/', u'abc\xc3/foo'])
863
863
 
864
 
        tree.add([u'abc\xa7/', u'abc\xa7/foo'])
 
864
        tree.add([u'abc\xc3/', u'abc\xc3/foo'])
865
865
        tree.commit('checkin')
866
866
 
867
 
        tree.rename_one(u'abc\xa7','abc')
 
867
        tree.rename_one(u'abc\xc3','abc')
868
868
 
869
869
        self.run_bzr('ci -m "non-ascii mv"')
870
870