997
997
# TODO: This probably handles non-Unix newlines poorly.
999
999
takes_args = ['file*']
1000
takes_options = ['revision', 'diff-options']
1000
takes_options = ['revision', 'diff-options', 'diff-prefix']
1001
1001
aliases = ['di', 'dif']
1003
1003
@display_command
1004
def run(self, revision=None, file_list=None, diff_options=None):
1004
def run(self, revision=None, file_list=None, diff_options=None,
1005
1006
from bzrlib.diff import diff_cmd_helper, show_diff_trees
1009
if not ':' in diff_prefix:
1010
raise BzrError("--diff-prefix expects two values separated by a colon")
1011
old_label,new_label=diff_prefix.split(":")
1007
1017
tree1, file_list = internal_tree_files(file_list)
1023
1033
raise BzrCommandError("Can't specify -r with two branches")
1024
1034
if (len(revision) == 1) or (revision[1].spec is None):
1025
1035
return diff_cmd_helper(tree1, file_list, diff_options,
1037
old_label=old_label, new_label=new_label)
1027
1038
elif len(revision) == 2:
1028
1039
return diff_cmd_helper(tree1, file_list, diff_options,
1029
revision[0], revision[1])
1040
revision[0], revision[1],
1041
old_label=old_label, new_label=new_label)
1031
1043
raise BzrCommandError('bzr diff --revision takes exactly one or two revision identifiers')
1033
1045
if tree2 is not None:
1034
1046
return show_diff_trees(tree1, tree2, sys.stdout,
1035
1047
specific_files=file_list,
1036
external_diff_options=diff_options)
1048
external_diff_options=diff_options,
1049
old_label=old_label, new_label=new_label)
1038
return diff_cmd_helper(tree1, file_list, diff_options)
1051
return diff_cmd_helper(tree1, file_list, diff_options,
1052
old_label=old_label, new_label=new_label)
1041
1055
class cmd_deleted(Command):