~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-10 03:06:24 UTC
  • mfrom: (4961.2.22 progress)
  • Revision ID: pqm@pqm.ubuntu.com-20100210030624-wnjdp7yy7zb8vu7u
(mbp) Remove passing-around of ProgressBars

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
import warnings
17
18
 
18
19
from bzrlib import (
19
20
    branch as _mod_branch,
237
238
        self.interesting_files = None
238
239
        self.show_base = False
239
240
        self.reprocess = False
240
 
        if pb is None:
241
 
            pb = progress.DummyProgress()
242
 
        self._pb = pb
 
241
        if pb is not None:
 
242
            warnings.warn("pb parameter to Merger() is deprecated and ignored")
243
243
        self.pp = None
244
244
        self.recurse = recurse
245
245
        self.change_reporter = change_reporter
598
598
                  'other_tree': self.other_tree,
599
599
                  'interesting_ids': self.interesting_ids,
600
600
                  'interesting_files': self.interesting_files,
601
 
                  'pp': self.pp, 'this_branch': self.this_branch,
 
601
                  'this_branch': self.this_branch,
602
602
                  'do_merge': False}
603
603
        if self.merge_type.requires_base:
604
604
            kwargs['base_tree'] = self.base_tree
622
622
        if self._is_criss_cross and getattr(self.merge_type,
623
623
                                            'supports_lca_trees', False):
624
624
            kwargs['lca_trees'] = self._lca_trees
625
 
        return self.merge_type(pb=self._pb,
 
625
        return self.merge_type(pb=None,
626
626
                               change_reporter=self.change_reporter,
627
627
                               **kwargs)
628
628
 
706
706
 
707
707
    def __init__(self, working_tree, this_tree, base_tree, other_tree,
708
708
                 interesting_ids=None, reprocess=False, show_base=False,
709
 
                 pb=progress.DummyProgress(), pp=None, change_reporter=None,
 
709
                 pb=None, pp=None, change_reporter=None,
710
710
                 interesting_files=None, do_merge=True,
711
711
                 cherrypick=False, lca_trees=None, this_branch=None):
712
712
        """Initialize the merger object and perform the merge.
722
722
        :param: reprocess If True, perform conflict-reduction processing.
723
723
        :param show_base: If True, show the base revision in text conflicts.
724
724
            (incompatible with reprocess)
725
 
        :param pb: A Progress bar
 
725
        :param pb: ignored
726
726
        :param pp: A ProgressPhase object
727
727
        :param change_reporter: An object that should report changes made
728
728
        :param interesting_files: The tree-relative paths of files that should
755
755
        # making sure we haven't missed any corner cases.
756
756
        # if lca_trees is None:
757
757
        #     self._lca_trees = [self.base_tree]
758
 
        self.pb = pb
759
 
        self.pp = pp
760
758
        self.change_reporter = change_reporter
761
759
        self.cherrypick = cherrypick
762
 
        if self.pp is None:
763
 
            self.pp = progress.ProgressPhase("Merge phase", 3, self.pb)
764
760
        if do_merge:
765
761
            self.do_merge()
 
762
        if pp is not None:
 
763
            warnings.warn("pp argument to Merge3Merger is deprecated")
 
764
        if pb is not None:
 
765
            warnings.warn("pb argument to Merge3Merger is deprecated")
766
766
 
767
767
    def do_merge(self):
768
768
        self.this_tree.lock_tree_write()
769
769
        self.base_tree.lock_read()
770
770
        self.other_tree.lock_read()
771
771
        try:
772
 
            self.tt = transform.TreeTransform(self.this_tree, self.pb)
 
772
            self.tt = transform.TreeTransform(self.this_tree, None)
773
773
            try:
774
 
                self.pp.next_phase()
775
774
                self._compute_transform()
776
 
                self.pp.next_phase()
777
775
                results = self.tt.apply(no_conflicts=True)
778
776
                self.write_modified(results)
779
777
                try:
786
784
            self.other_tree.unlock()
787
785
            self.base_tree.unlock()
788
786
            self.this_tree.unlock()
789
 
            self.pb.clear()
790
787
 
791
788
    def make_preview_transform(self):
792
789
        self.base_tree.lock_read()
793
790
        self.other_tree.lock_read()
794
791
        self.tt = transform.TransformPreview(self.this_tree)
795
792
        try:
796
 
            self.pp.next_phase()
797
793
            self._compute_transform()
798
 
            self.pp.next_phase()
799
794
        finally:
800
795
            self.other_tree.unlock()
801
796
            self.base_tree.unlock()
802
 
            self.pb.clear()
803
797
        return self.tt
804
798
 
805
799
    def _compute_transform(self):
827
821
        finally:
828
822
            child_pb.finished()
829
823
        self.fix_root()
830
 
        self.pp.next_phase()
831
824
        child_pb = ui.ui_factory.nested_progress_bar()
832
825
        try:
833
826
            fs_conflicts = transform.resolve_conflicts(self.tt, child_pb,
1726
1719
                other_rev_id=None,
1727
1720
                interesting_files=None,
1728
1721
                this_tree=None,
1729
 
                pb=progress.DummyProgress(),
 
1722
                pb=None,
1730
1723
                change_reporter=None):
1731
1724
    """Primary interface for merging.
1732
1725