~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/bundle/apply_bundle.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-06 18:59:24 UTC
  • mto: This revision was merged to the branch mainline in revision 4522.
  • Revision ID: john@arbash-meinel.com-20090706185924-qlhn1j607117lgdj
Start implementing an Annotator.add_special_text functionality.

The Python implementation supports it. Basically, it is meant to allow things
like WT and PreviewTree to insert the 'current' content into the graph, so that
we can get local modifications into the annotations.
There is also some work here to get support for texts that are already cached
in the annotator. So that we avoid extracting them, and can shortcut the
history.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2006 Canonical Ltd
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1
16
"""\
2
17
This contains functionality for installing bundles into repositories
3
18
"""
10
25
 
11
26
 
12
27
def install_bundle(repository, bundle_reader):
 
28
    custom_install = getattr(bundle_reader, 'install', None)
 
29
    if custom_install is not None:
 
30
        return custom_install(repository)
13
31
    pb = bzrlib.ui.ui_factory.nested_progress_bar()
14
32
    repository.lock_write()
15
33
    try:
26
44
        pb.finished()
27
45
 
28
46
 
29
 
def merge_bundle(reader, tree, check_clean, merge_type, 
30
 
                    reprocess, show_base):
 
47
def merge_bundle(reader, tree, check_clean, merge_type,
 
48
                    reprocess, show_base, change_reporter=None):
31
49
    """Merge a revision bundle into the current tree."""
32
50
    pb = bzrlib.ui.ui_factory.nested_progress_bar()
33
51
    try:
34
52
        pp = ProgressPhase("Merge phase", 6, pb)
35
53
        pp.next_phase()
36
54
        install_bundle(tree.branch.repository, reader)
37
 
        merger = Merger(tree.branch, this_tree=tree, pb=pb)
 
55
        merger = Merger(tree.branch, this_tree=tree, pb=pb,
 
56
                        change_reporter=change_reporter)
38
57
        merger.pp = pp
39
58
        merger.pp.next_phase()
40
59
        merger.check_basis(check_clean, require_commits=False)