~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: John Arbash Meinel
  • Date: 2009-10-20 19:46:46 UTC
  • mfrom: (4759 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4771.
  • Revision ID: john@arbash-meinel.com-20091020194646-wnqpd15qs19y28z7
Merge bzr.dev 4759, bringing in static_tuple and streaming improvements.

Show diffs side-by-side

added added

removed removed

Lines of Context:
431
431
        for node in bt.iter_all_entries():
432
432
            # Node is made up of:
433
433
            # (index, key, value, [references])
434
 
            self.outf.write('%s\n' % (node[1:],))
 
434
            refs_as_tuples = tuple([tuple([tuple(ref) for ref in ref_list])
 
435
                                   for ref_list in node[3]])
 
436
            as_tuple = (tuple(node[1]), node[2], refs_as_tuples)
 
437
            self.outf.write('%s\n' % (as_tuple,))
435
438
 
436
439
 
437
440
class cmd_remove_tree(Command):
461
464
            raise errors.BzrCommandError("You cannot remove the working tree"
462
465
                                         " of a remote path")
463
466
        if not force:
464
 
            if (working.has_changes(working.basis_tree())
465
 
                or len(working.get_parent_ids()) > 1):
 
467
            if (working.has_changes()):
466
468
                raise errors.UncommittedChanges(working)
467
469
 
468
470
        working_path = working.bzrdir.root_transport.base
1109
1111
        else:
1110
1112
            revision_id = None
1111
1113
        if strict and tree is not None and revision_id is None:
1112
 
            if (tree.has_changes(tree.basis_tree())
1113
 
                or len(tree.get_parent_ids()) > 1):
 
1114
            if (tree.has_changes()):
1114
1115
                raise errors.UncommittedChanges(
1115
1116
                    tree, more='Use --no-strict to force the push.')
1116
1117
            if tree.last_revision() != tree.branch.last_revision():
1887
1888
    @display_command
1888
1889
    def run(self, revision=None, file_list=None, diff_options=None,
1889
1890
            prefix=None, old=None, new=None, using=None):
1890
 
        from bzrlib.diff import _get_trees_to_diff, show_diff_trees
 
1891
        from bzrlib.diff import get_trees_and_branches_to_diff, show_diff_trees
1891
1892
 
1892
1893
        if (prefix is None) or (prefix == '0'):
1893
1894
            # diff -p0 format
1907
1908
            raise errors.BzrCommandError('bzr diff --revision takes exactly'
1908
1909
                                         ' one or two revision specifiers')
1909
1910
 
1910
 
        old_tree, new_tree, specific_files, extra_trees = \
1911
 
                _get_trees_to_diff(file_list, revision, old, new,
1912
 
                apply_view=True)
 
1911
        (old_tree, new_tree,
 
1912
         old_branch, new_branch,
 
1913
         specific_files, extra_trees) = get_trees_and_branches_to_diff(
 
1914
            file_list, revision, old, new, apply_view=True)
1913
1915
        return show_diff_trees(old_tree, new_tree, sys.stdout,
1914
1916
                               specific_files=specific_files,
1915
1917
                               external_diff_options=diff_options,
3663
3665
 
3664
3666
        # die as quickly as possible if there are uncommitted changes
3665
3667
        if not force:
3666
 
            if tree.has_changes(basis_tree) or len(tree.get_parent_ids()) > 1:
 
3668
            if tree.has_changes():
3667
3669
                raise errors.UncommittedChanges(tree)
3668
3670
 
3669
3671
        view_info = _get_view_info_for_change_reporter(tree)
3720
3722
                                       merger.other_rev_id)
3721
3723
                    result.report(self.outf)
3722
3724
                    return 0
3723
 
            merger.check_basis(False)
 
3725
            if merger.this_basis is None:
 
3726
                raise errors.BzrCommandError(
 
3727
                    "This branch has no commits."
 
3728
                    " (perhaps you would prefer 'bzr pull')")
3724
3729
            if preview:
3725
3730
                return self._do_preview(merger, cleanups)
3726
3731
            elif interactive: