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

  • Committer: Jelmer Vernooij
  • Date: 2017-06-05 23:35:09 UTC
  • mfrom: (6658 work)
  • mto: (6653.3.3 bzrwt)
  • mto: This revision was merged to the branch mainline in revision 6667.
  • Revision ID: jelmer@jelmer.uk-20170605233509-30wo916k6meuggqf
MergeĀ lp:brz

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
from .sixish import (
82
82
    BytesIO,
83
83
    text_type,
 
84
    viewitems,
 
85
    viewvalues,
84
86
)
85
87
from .trace import mutter, note, warning, is_quiet, get_verbosity_level
86
88
 
201
203
        reference = control_dir.get_branch_reference()
202
204
    except errors.NotBranchError:
203
205
        # There is no active branch, just return the colocated branches.
204
 
        for name, branch in control_dir.get_branches().iteritems():
 
206
        for name, branch in viewitems(control_dir.get_branches()):
205
207
            yield name, branch
206
208
        return
207
209
    if reference is not None:
212
214
    if ref_branch is None or ref_branch.name:
213
215
        if ref_branch is not None:
214
216
            control_dir = ref_branch.bzrdir
215
 
        for name, branch in control_dir.get_branches().iteritems():
 
217
        for name, branch in viewitems(control_dir.get_branches()):
216
218
            yield name, branch
217
219
    else:
218
220
        repo = ref_branch.bzrdir.find_repository()
845
847
        self.cleanup_now()
846
848
        if len(ignored) > 0:
847
849
            if verbose:
848
 
                for glob in sorted(ignored.keys()):
 
850
                for glob in sorted(ignored):
849
851
                    for path in ignored[glob]:
850
852
                        self.outf.write(
851
853
                         gettext("ignored {0} matching \"{1}\"\n").format(
1583
1585
                names[name] = active
1584
1586
            # Only mention the current branch explicitly if it's not
1585
1587
            # one of the colocated branches
1586
 
            if not any(names.values()) and active_branch is not None:
 
1588
            if not any(viewvalues(names)) and active_branch is not None:
1587
1589
                self.outf.write("* %s\n" % gettext("(default)"))
1588
 
            for name in sorted(names.keys()):
 
1590
            for name in sorted(names):
1589
1591
                active = names[name]
1590
1592
                if active:
1591
1593
                    prefix = "*"
3963
3965
    def print_aliases(self):
3964
3966
        """Print out the defined aliases in a similar format to bash."""
3965
3967
        aliases = _mod_config.GlobalConfig().get_aliases()
3966
 
        for key, value in sorted(aliases.iteritems()):
 
3968
        for key, value in sorted(viewitems(aliases)):
3967
3969
            self.outf.write('brz alias %s="%s"\n' % (key, value))
3968
3970
 
3969
3971
    @display_command
6004
6006
        from .tag import tag_sort_methods
6005
6007
        branch, relpath = Branch.open_containing(directory)
6006
6008
 
6007
 
        tags = branch.tags.get_tag_dict().items()
 
6009
        tags = list(viewitems(branch.tags.get_tag_dict()))
6008
6010
        if not tags:
6009
6011
            return
6010
6012
 
6648
6650
        if tree is None:
6649
6651
            tree = branch.basis_tree()
6650
6652
        if path is None:
6651
 
            info = branch._get_all_reference_info().iteritems()
 
6653
            info = viewitems(branch._get_all_reference_info())
6652
6654
            self._display_reference_info(tree, branch, info)
6653
6655
        else:
6654
6656
            file_id = tree.path2id(path)
6711
6713
        do_import(source, tree)
6712
6714
 
6713
6715
 
 
6716
class cmd_fetch_ghosts(Command):
 
6717
    __doc__ = """Attempt to retrieve ghosts from another branch.
 
6718
 
 
6719
    If the other branch is not supplied, the last-pulled branch is used.
 
6720
    """
 
6721
 
 
6722
    hidden = True
 
6723
    aliases = ['fetch-missing']
 
6724
    takes_args = ['branch?']
 
6725
    takes_options = [Option('no-fix', help="Skip additional synchonization.")]
 
6726
 
 
6727
    def run(self, branch=None, no_fix=False):
 
6728
        from .fetch_ghosts import GhostFetcher
 
6729
        installed, failed = GhostFetcher.from_cmdline(branch).run()
 
6730
        if len(installed) > 0:
 
6731
            self.outf.write("Installed:\n")
 
6732
            for rev in installed:
 
6733
                self.outf.write(rev + "\n")
 
6734
        if len(failed) > 0:
 
6735
            self.outf.write("Still missing:\n")
 
6736
            for rev in failed:
 
6737
                self.outf.write(rev + "\n")
 
6738
        if not no_fix and len(installed) > 0:
 
6739
            cmd_reconcile().run(".")
 
6740
 
 
6741
 
6714
6742
def _register_lazy_builtins():
6715
6743
    # register lazy builtins from other modules; called at startup and should
6716
6744
    # be only called once.