~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/foreign.py

  • Committer: Martin Packman
  • Date: 2012-01-05 10:37:58 UTC
  • mto: This revision was merged to the branch mainline in revision 6427.
  • Revision ID: martin.packman@canonical.com-20120105103758-wzftnmsip5iv9n2g
Revert addition of get_message_encoding function

Show diffs side-by-side

added added

removed removed

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