~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/foreign.py

  • Committer: Samuel Bronson
  • Date: 2012-08-30 20:36:18 UTC
  • mto: (6015.57.3 2.4)
  • mto: This revision was merged to the branch mainline in revision 6558.
  • Revision ID: naesten@gmail.com-20120830203618-y2dzw91nqpvpgxvx
Update INSTALL for switch to Python 2.6 and up.

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
 
17
18
"""Foreign branch utilities."""
18
19
 
19
 
from __future__ import absolute_import
20
 
 
21
20
 
22
21
from bzrlib.branch import (
23
22
    Branch,
32
31
    registry,
33
32
    transform,
34
33
    )
35
 
from bzrlib.i18n import gettext
36
34
""")
37
35
 
38
36
class VcsMapping(object):
265
263
    branch unless the --no-rebase option is used, in which case 
266
264
    the two branches will be out of sync after the push. 
267
265
    """
 
266
    hidden = True
268
267
    takes_args = ['location?']
269
268
    takes_options = [
270
269
        'remember',
283
282
    def run(self, location=None, remember=False, directory=None,
284
283
            no_rebase=False, strict=None):
285
284
        from bzrlib import urlutils
286
 
        from bzrlib.controldir import ControlDir
 
285
        from bzrlib.bzrdir import BzrDir
287
286
        from bzrlib.errors import BzrCommandError, NoWorkingTree
288
287
        from bzrlib.workingtree import WorkingTree
289
288
 
303
302
        stored_loc = source_branch.get_push_location()
304
303
        if location is None:
305
304
            if stored_loc is None:
306
 
                raise BzrCommandError(gettext("No push location known or specified."))
 
305
                raise BzrCommandError("No push location known or specified.")
307
306
            else:
308
307
                display_url = urlutils.unescape_for_display(stored_loc,
309
308
                        self.outf.encoding)
310
 
                self.outf.write(
311
 
                       gettext("Using saved location: %s\n") % display_url)
 
309
                self.outf.write("Using saved location: %s\n" % display_url)
312
310
                location = stored_loc
313
311
 
314
 
        controldir = ControlDir.open(location)
315
 
        target_branch = controldir.open_branch()
 
312
        bzrdir = BzrDir.open(location)
 
313
        target_branch = bzrdir.open_branch()
316
314
        target_branch.lock_write()
317
315
        try:
318
316
            try:
319
317
                push_result = source_branch.push(target_branch, lossy=True)
320
318
            except errors.LossyPushToSameVCS:
321
 
                raise BzrCommandError(gettext("{0!r} and {1!r} are in the same VCS, lossy "
322
 
                    "push not necessary. Please use regular push.").format(
323
 
                    source_branch, target_branch))
 
319
                raise BzrCommandError("%r and %r are in the same VCS, lossy "
 
320
                    "push not necessary. Please use regular push." %
 
321
                    (source_branch, target_branch))
324
322
            # We successfully created the target, remember it
325
323
            if source_branch.get_push_location() is None or remember:
326
324
                source_branch.set_push_location(target_branch.base)