~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
from bzrlib import (
21
21
    branch,
22
 
    bzrdir,
23
22
    conflicts,
 
23
    controldir,
24
24
    errors,
25
25
    mutabletree,
26
26
    osutils,
27
27
    revision as _mod_revision,
28
28
    tests,
 
29
    transport as _mod_transport,
29
30
    ui,
30
31
    )
31
32
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
264
265
        del master
265
266
        # check its corrupted.
266
267
        self.assertRaises(errors.UnknownFormatError,
267
 
                          bzrdir.BzrDir.open,
 
268
                          controldir.ControlDir.open,
268
269
                          'master')
269
270
        tree.commit('foo', rev_id='foo', local=True)
270
271
 
316
317
        wt.lock_write()
317
318
        self.build_tree(['a', 'b/', 'b/c', 'd'])
318
319
        wt.add(['a', 'b', 'b/c', 'd'], ['a-id', 'b-id', 'c-id', 'd-id'])
319
 
        this_dir = self.get_transport()
 
320
        this_dir = wt.bzrdir.root_transport
320
321
        this_dir.delete_tree('b')
321
322
        this_dir.delete('d')
322
323
        # now we have a tree with a through d in the inventory, but only
352
353
        wt.add(['a', 'b', 'b/c'], ['a-id', 'b-id', 'c-id'])
353
354
        wt.commit('first')
354
355
        wt.remove('b/c')
355
 
        this_dir = self.get_transport()
 
356
        this_dir = wt.bzrdir.root_transport
356
357
        this_dir.delete_tree('b')
357
358
        wt.lock_write()
358
359
        wt.commit('commit deleted rename')
552
553
        """Make sure a start commit hook can modify the tree that is
553
554
        committed."""
554
555
        def start_commit_hook_adds_file(tree):
555
 
            open(tree.abspath("newfile"), 'w').write("data")
 
556
            with open(tree.abspath("newfile"), 'w') as f: f.write("data")
556
557
            tree.add(["newfile"])
557
558
        def restoreDefaults():
558
559
            mutabletree.MutableTree.hooks['start_commit'] = []
573
574
                mutabletree.PostCommitHookParams))
574
575
            self.assertTrue(isinstance(params.mutable_tree,
575
576
                mutabletree.MutableTree))
576
 
            open(tree.abspath("newfile"), 'w').write("data")
 
577
            with open(tree.abspath("newfile"), 'w') as f: f.write("data")
577
578
            params.mutable_tree.add(["newfile"])
578
579
        tree = self.make_branch_and_tree('.')
579
580
        mutabletree.MutableTree.hooks.install_named_hook(