~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/reconfigure.py

  • Committer: Vincent Ladeuil
  • Date: 2012-03-09 16:48:55 UTC
  • mto: (6437.23.24 2.5)
  • mto: This revision was merged to the branch mainline in revision 6499.
  • Revision ID: v.ladeuil+lp@free.fr-20120309164855-htdn25hp7x65mmir
Rely on sphinx for texinfo doc generation

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2009 Canonical Ltd
 
1
# Copyright (C) 2007-2010 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
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
 
"""Reconfigure a bzrdir into a new tree/branch/repository layout.
 
17
"""Reconfigure a controldir into a new tree/branch/repository layout.
18
18
 
19
19
Various types of reconfiguration operation are available either by
20
20
constructing a class or using a factory method on Reconfigure.
21
21
"""
22
22
 
 
23
from __future__ import absolute_import
 
24
 
23
25
 
24
26
from bzrlib import (
25
27
    branch,
26
 
    bzrdir,
 
28
    controldir,
27
29
    errors,
28
30
    trace,
29
31
    ui,
30
32
    urlutils,
31
33
    )
32
 
 
 
34
from bzrlib.i18n import gettext
33
35
 
34
36
# TODO: common base class for all reconfigure operations, making no
35
37
# assumptions about what kind of change will be done.
48
50
        try:
49
51
            branch.set_stacked_on_url(on_url)
50
52
            if not trace.is_quiet():
51
 
                ui.ui_factory.note(
52
 
                    "%s is now stacked on %s\n"
53
 
                    % (branch.base, branch.get_stacked_on_url()))
 
53
                ui.ui_factory.note(gettext(
 
54
                    "{0} is now stacked on {1}\n").format(
 
55
                      branch.base, branch.get_stacked_on_url()))
54
56
        finally:
55
57
            branch.unlock()
56
58
 
63
65
        try:
64
66
            branch.set_stacked_on_url(None)
65
67
            if not trace.is_quiet():
66
 
                ui.ui_factory.note(
67
 
                    "%s is now not stacked\n"
 
68
                ui.ui_factory.note(gettext(
 
69
                    "%s is now not stacked\n")
68
70
                    % (branch.base,))
69
71
        finally:
70
72
            branch.unlock()
82
84
            self.repository = None
83
85
            self.local_repository = None
84
86
        else:
85
 
            if (self.repository.bzrdir.root_transport.base ==
86
 
                self.bzrdir.root_transport.base):
 
87
            if (self.repository.user_url == self.bzrdir.user_url):
87
88
                self.local_repository = self.repository
88
89
            else:
89
90
                self.local_repository = None
90
91
        try:
91
92
            branch = self.bzrdir.open_branch()
92
 
            if branch.bzrdir.root_transport.base == bzrdir.root_transport.base:
 
93
            if branch.user_url == bzrdir.user_url:
93
94
                self.local_branch = branch
94
95
                self.referenced_branch = None
95
96
            else:
217
218
            if not want_reference:
218
219
                self._create_repository = True
219
220
        else:
220
 
            if want_reference and (self.repository.bzrdir.root_transport.base
221
 
                                   == self.bzrdir.root_transport.base):
 
221
            if want_reference and (
 
222
                self.repository.user_url == self.bzrdir.user_url):
222
223
                if not self.repository.is_shared():
223
224
                    self._destroy_repository = True
224
225
        if self.referenced_branch is None:
344
345
            if self._create_reference:
345
346
                reference_branch.repository.fetch(self.repository)
346
347
            elif self.local_branch is not None and not self._destroy_branch:
347
 
                up = self.local_branch.bzrdir.root_transport.clone('..')
348
 
                up_bzrdir = bzrdir.BzrDir.open_containing_from_transport(up)[0]
 
348
                up = self.local_branch.user_transport.clone('..')
 
349
                up_bzrdir = controldir.ControlDir.open_containing_from_transport(
 
350
                    up)[0]
349
351
                new_repo = up_bzrdir.find_repository()
350
352
                new_repo.fetch(self.repository)
351
353
        last_revision_info = None
367
369
        else:
368
370
            local_branch = self.local_branch
369
371
        if self._create_reference:
370
 
            format = branch.BranchReferenceFormat().initialize(self.bzrdir,
371
 
                reference_branch)
 
372
            self.bzrdir.set_branch_reference(reference_branch)
372
373
        if self._destroy_tree:
373
374
            self.bzrdir.destroy_workingtree()
374
375
        if self._create_tree: