~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

Merge HEAD.

Show diffs side-by-side

added added

removed removed

Lines of Context:
476
476
        # command.
477
477
        from bzrlib.transport import get_transport
478
478
        
479
 
        tree_from = WorkingTree.open_containing(u'.')[0]
480
 
        br_from = tree_from.branch
481
 
        stored_loc = tree_from.branch.get_push_location()
 
479
        br_from = Branch.open_containing('.')[0]
 
480
        stored_loc = br_from.get_push_location()
482
481
        if location is None:
483
482
            if stored_loc is None:
484
483
                raise BzrCommandError("No push location known or specified.")
642
641
 
643
642
    --basis is to speed up checking out from remote branches.  When specified, it
644
643
    uses the inventory and file contents from the basis branch in preference to the
645
 
    branch being checked out. [Not implemented yet.]
 
644
    branch being checked out.
646
645
    """
647
646
    takes_args = ['branch_location?', 'to_location?']
648
647
    takes_options = ['revision', # , 'basis']
902
901
    takes_options = [
903
902
                     Option('format', 
904
903
                            help='Create a specific format rather than the'
905
 
                                 ' current default format. Currently this '
906
 
                                 ' option only accepts "metadir"',
 
904
                                 ' current default format. Currently supports:'
 
905
                                 ' metadir, knit, and weave',
907
906
                            type=get_format_type),
908
907
                     ]
909
908
    def run(self, location=None, format=None):
997
996
    # TODO: This probably handles non-Unix newlines poorly.
998
997
    
999
998
    takes_args = ['file*']
1000
 
    takes_options = ['revision', 'diff-options']
 
999
    takes_options = ['revision', 'diff-options', 'diff-prefix']
1001
1000
    aliases = ['di', 'dif']
1002
1001
 
1003
1002
    @display_command
1004
 
    def run(self, revision=None, file_list=None, diff_options=None):
 
1003
    def run(self, revision=None, file_list=None, diff_options=None,
 
1004
       diff_prefix=None):
1005
1005
        from bzrlib.diff import diff_cmd_helper, show_diff_trees
 
1006
 
 
1007
        if diff_prefix:
 
1008
            if not ':' in diff_prefix:
 
1009
                 raise BzrError("--diff-prefix expects two values separated by a colon")            
 
1010
            old_label,new_label=diff_prefix.split(":")
 
1011
        else:
 
1012
            old_label='a/'
 
1013
            new_label='b/'
 
1014
        
1006
1015
        try:
1007
1016
            tree1, file_list = internal_tree_files(file_list)
1008
1017
            tree2 = None
1023
1032
                raise BzrCommandError("Can't specify -r with two branches")
1024
1033
            if (len(revision) == 1) or (revision[1].spec is None):
1025
1034
                return diff_cmd_helper(tree1, file_list, diff_options,
1026
 
                                       revision[0])
 
1035
                                       revision[0], 
 
1036
                                       old_label=old_label, new_label=new_label)
1027
1037
            elif len(revision) == 2:
1028
1038
                return diff_cmd_helper(tree1, file_list, diff_options,
1029
 
                                       revision[0], revision[1])
 
1039
                                       revision[0], revision[1],
 
1040
                                       old_label=old_label, new_label=new_label)
1030
1041
            else:
1031
1042
                raise BzrCommandError('bzr diff --revision takes exactly one or two revision identifiers')
1032
1043
        else:
1033
1044
            if tree2 is not None:
1034
1045
                return show_diff_trees(tree1, tree2, sys.stdout, 
1035
1046
                                       specific_files=file_list,
1036
 
                                       external_diff_options=diff_options)
 
1047
                                       external_diff_options=diff_options,
 
1048
                                       old_label=old_label, new_label=new_label)
1037
1049
            else:
1038
 
                return diff_cmd_helper(tree1, file_list, diff_options)
 
1050
                return diff_cmd_helper(tree1, file_list, diff_options,
 
1051
                                       old_label=old_label, new_label=new_label)
1039
1052
 
1040
1053
 
1041
1054
class cmd_deleted(Command):