/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: Jelmer Vernooij
  • Date: 2011-12-24 10:10:59 UTC
  • mfrom: (6405 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6407.
  • Revision ID: jelmer@samba.org-20111224101059-epghsc5y61hsgbl2
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1251
1251
        if location is None:
1252
1252
            stored_loc = br_from.get_push_location()
1253
1253
            if stored_loc is None:
1254
 
                raise errors.BzrCommandError(gettext(
1255
 
                    "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."))
1256
1264
            else:
1257
1265
                display_url = urlutils.unescape_for_display(stored_loc,
1258
1266
                        self.outf.encoding)
1435
1443
                    self.outf.encoding).rstrip("/"))
1436
1444
        else:
1437
1445
            dir = controldir.ControlDir.open_containing(location)[0]
1438
 
            for branch in dir.list_branches():
1439
 
                if branch.name is None:
1440
 
                    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 = "*"
1441
1466
                else:
1442
 
                    self.outf.write(" %s\n" % branch.name.encode(
1443
 
                        self.outf.encoding))
 
1467
                    prefix = " "
 
1468
                self.outf.write("%s %s\n" % (
 
1469
                    prefix, name.encode(self.outf.encoding)))
1444
1470
 
1445
1471
 
1446
1472
class cmd_checkout(Command):