/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/builtins.py

  • Committer: Martin Packman
  • Date: 2012-01-05 10:44:12 UTC
  • mfrom: (6424 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6427.
  • Revision ID: martin.packman@canonical.com-20120105104412-z03fi9m43h946fvs
Merge bzr.dev to resolve conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""builtin bzr commands"""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
import os
20
22
 
21
23
import bzrlib.bzrdir
1249
1251
        if location is None:
1250
1252
            stored_loc = br_from.get_push_location()
1251
1253
            if stored_loc is None:
1252
 
                raise errors.BzrCommandError(gettext(
1253
 
                    "No push location known or specified."))
 
1254
                parent_loc = br_from.get_parent()
 
1255
                if parent_loc:
 
1256
                    raise errors.BzrCommandError(gettext(
 
1257
                        "No push location known or specified. To push to the "
 
1258
                        "parent branch (at %s), use 'bzr push :parent'." %
 
1259
                        urlutils.unescape_for_display(parent_loc,
 
1260
                            self.outf.encoding)))
 
1261
                else:
 
1262
                    raise errors.BzrCommandError(gettext(
 
1263
                        "No push location known or specified."))
1254
1264
            else:
1255
1265
                display_url = urlutils.unescape_for_display(stored_loc,
1256
1266
                        self.outf.encoding)
1433
1443
                    self.outf.encoding).rstrip("/"))
1434
1444
        else:
1435
1445
            dir = controldir.ControlDir.open_containing(location)[0]
1436
 
            for branch in dir.list_branches():
1437
 
                if branch.name is None:
1438
 
                    self.outf.write(gettext(" (default)\n"))
 
1446
            try:
 
1447
                active_branch = dir.open_branch(name=None)
 
1448
            except errors.NotBranchError:
 
1449
                active_branch = None
 
1450
            branches = dir.get_branches()
 
1451
            names = {}
 
1452
            for name, branch in branches.iteritems():
 
1453
                if name is None:
 
1454
                    continue
 
1455
                active = (active_branch is not None and
 
1456
                          active_branch.base == branch.base)
 
1457
                names[name] = active
 
1458
            # Only mention the current branch explicitly if it's not
 
1459
            # one of the colocated branches
 
1460
            if not any(names.values()) and active_branch is not None:
 
1461
                self.outf.write("* %s\n" % gettext("(default)"))
 
1462
            for name in sorted(names.keys()):
 
1463
                active = names[name]
 
1464
                if active:
 
1465
                    prefix = "*"
1439
1466
                else:
1440
 
                    self.outf.write(" %s\n" % branch.name.encode(
1441
 
                        self.outf.encoding))
 
1467
                    prefix = " "
 
1468
                self.outf.write("%s %s\n" % (
 
1469
                    prefix, name.encode(self.outf.encoding)))
1442
1470
 
1443
1471
 
1444
1472
class cmd_checkout(Command):
2058
2086
            location = '.'
2059
2087
 
2060
2088
        to_transport = transport.get_transport(location)
2061
 
        to_transport.ensure_base()
2062
2089
 
2063
 
        newdir = format.initialize_on_transport(to_transport)
2064
 
        repo = newdir.create_repository(shared=True)
2065
 
        repo.set_make_working_trees(not no_trees)
 
2090
        (repo, newdir, require_stacking, repository_policy) = (
 
2091
            format.initialize_on_transport_ex(to_transport,
 
2092
            create_prefix=True, make_working_trees=not no_trees,
 
2093
            shared_repo=True, force_new_repo=True,
 
2094
            use_existing_dir=True,
 
2095
            repo_format_name=format.repository_format.get_format_string()))
2066
2096
        if not is_quiet():
2067
2097
            from bzrlib.info import show_bzrdir_info
2068
 
            show_bzrdir_info(repo.bzrdir, verbose=0, outfile=self.outf)
 
2098
            show_bzrdir_info(newdir, verbose=0, outfile=self.outf)
2069
2099
 
2070
2100
 
2071
2101
class cmd_diff(Command):
4693
4723
 
4694
4724
    @display_command
4695
4725
    def run(self, context=None):
4696
 
        import shellcomplete
 
4726
        from bzrlib import shellcomplete
4697
4727
        shellcomplete.shellcomplete(context)
4698
4728
 
4699
4729
 
5579
5609
                self.outf.writelines(directive.to_lines())
5580
5610
        else:
5581
5611
            message = directive.to_email(mail_to, branch, sign)
5582
 
            s = SMTPConnection(branch.get_config())
 
5612
            s = SMTPConnection(branch.get_config_stack())
5583
5613
            s.send_email(message)
5584
5614
 
5585
5615