~jelmer/brz/zsh-completion

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2006-2010 Canonical Ltd
2
2
# Authors:  Robert Collins <robert.collins@canonical.com>
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
168
168
        tree_a.commit('change n in A')
169
169
 
170
170
        # Merging from A should introduce conflicts because 'n' was modified
171
 
        # and removed, so 'a' needs to be restored.
 
171
        # (in A) and removed (in B), so 'a' needs to be restored.
172
172
        num_conflicts = tree_b.merge_from_branch(tree_a.branch)
173
173
        self.assertEqual(3, num_conflicts)
174
174
        paths = [(path, ie.file_id)
505
505
 
506
506
class TestCommitProgress(TestCaseWithWorkingTree):
507
507
 
508
 
    def restoreDefaults(self):
509
 
        ui.ui_factory = self.old_ui_factory
 
508
    def setUp(self):
 
509
        super(TestCommitProgress, self).setUp()
 
510
        ui.ui_factory = CapturingUIFactory()
510
511
 
511
512
    def test_commit_progress_steps(self):
512
513
        # during commit we one progress update for every entry in the
525
526
        f.close()
526
527
        # set a progress bar that captures the calls so we can see what is
527
528
        # emitted
528
 
        self.old_ui_factory = ui.ui_factory
529
 
        self.addCleanup(self.restoreDefaults)
530
529
        factory = CapturingUIFactory()
531
530
        ui.ui_factory = factory
532
531
        # TODO RBC 20060421 it would be nice to merge the reporter output
548
547
        tree = self.make_branch_and_tree('.')
549
548
        # set a progress bar that captures the calls so we can see what is
550
549
        # emitted
551
 
        self.old_ui_factory = ui.ui_factory
552
 
        self.addCleanup(self.restoreDefaults)
553
550
        factory = CapturingUIFactory()
554
551
        ui.ui_factory = factory
555
552
        def a_hook(_, _2, _3, _4, _5, _6):
573
570
        tree = self.make_branch_and_tree('.')
574
571
        # set a progress bar that captures the calls so we can see what is
575
572
        # emitted
576
 
        self.old_ui_factory = ui.ui_factory
577
 
        self.addCleanup(self.restoreDefaults)
578
573
        factory = CapturingUIFactory()
579
574
        ui.ui_factory = factory
580
575
        def a_hook(_, _2, _3, _4, _5, _6, _7, _8):
621
616
                mutabletree.MutableTree))
622
617
            open(tree.abspath("newfile"), 'w').write("data")
623
618
            params.mutable_tree.add(["newfile"])
624
 
        def restoreDefaults():
625
 
            mutabletree.MutableTree.hooks['post_commit'] = []
626
 
        self.addCleanup(restoreDefaults)
627
619
        tree = self.make_branch_and_tree('.')
628
620
        mutabletree.MutableTree.hooks.install_named_hook(
629
621
            'post_commit',