/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/bundle/apply_bundle.py

  • Committer: Lawrence Mitchell
  • Date: 2011-11-08 10:54:09 UTC
  • mto: This revision was merged to the branch mainline in revision 6245.
  • Revision ID: wence@gmx.li-20111108105409-cgdqeek7vl7e8nbb
Only set check_clean if {clean} is asked for in template
      
The {clean} flag in templates requires an lstat of every file in the
repository.  If the filesystem is slow this can take a noticeable
amount of time.  So only switch check_clean to True if the template
actually asks for it, to avoid penalising those who don't want to
know.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
17
17
This contains functionality for installing bundles into repositories
18
18
"""
19
19
 
20
 
import bzrlib.ui
 
20
from bzrlib import ui
 
21
from bzrlib.i18n import gettext
 
22
from bzrlib.merge import Merger
21
23
from bzrlib.progress import ProgressPhase
22
 
from bzrlib.merge import Merger
23
 
from bzrlib.repository import install_revision
24
24
from bzrlib.trace import note
 
25
from bzrlib.vf_repository import install_revision
25
26
 
26
27
 
27
28
def install_bundle(repository, bundle_reader):
28
29
    custom_install = getattr(bundle_reader, 'install', None)
29
30
    if custom_install is not None:
30
31
        return custom_install(repository)
31
 
    pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
32
    pb = ui.ui_factory.nested_progress_bar()
32
33
    repository.lock_write()
33
34
    try:
34
35
        real_revisions = bundle_reader.real_revisions
35
36
        for i, revision in enumerate(reversed(real_revisions)):
36
 
            pb.update("Install revisions",i, len(real_revisions))
 
37
            pb.update(gettext("Install revisions"),i, len(real_revisions))
37
38
            if repository.has_revision(revision.revision_id):
38
39
                continue
39
40
            cset_tree = bundle_reader.revision_tree(repository,
47
48
def merge_bundle(reader, tree, check_clean, merge_type,
48
49
                    reprocess, show_base, change_reporter=None):
49
50
    """Merge a revision bundle into the current tree."""
50
 
    pb = bzrlib.ui.ui_factory.nested_progress_bar()
 
51
    pb = ui.ui_factory.nested_progress_bar()
51
52
    try:
52
53
        pp = ProgressPhase("Merge phase", 6, pb)
53
54
        pp.next_phase()
64
65
        merger.pp.next_phase()
65
66
        merger.find_base()
66
67
        if merger.base_rev_id == merger.other_rev_id:
67
 
            note("Nothing to do.")
 
68
            note(gettext("Nothing to do."))
68
69
            return 0
69
70
        merger.merge_type = merge_type
70
71
        merger.show_base = show_base