976
976
If files are listed, only the changes in those files are listed.
977
977
Otherwise, all changes for the tree are listed.
979
"bzr diff -p1" is equivalent to "bzr diff --prefix old/:new/", and
980
produces patches suitable for "patch -p1".
986
bzr diff --diff-prefix old/:new/
984
# TODO: Allow diff across branches.
985
988
# TODO: Option to use external diff command; could be GNU diff, wdiff,
986
989
# or a graphical diff.
988
991
# TODO: Python difflib is not exactly the same as unidiff; should
989
992
# either fix it up or prefer to use an external diff.
991
# TODO: If a directory is given, diff everything under that.
993
994
# TODO: Selected-file diff is inefficient and doesn't show you
996
997
# TODO: This probably handles non-Unix newlines poorly.
999
# TODO: When a prefix is given, it's also shown in the summary lines, e.g.
1000
# "modified file new/foo.c"; perhaps it would be better to omit it from
998
1003
takes_args = ['file*']
999
takes_options = ['revision', 'diff-options', 'diff-prefix']
1004
takes_options = ['revision', 'diff-options', 'prefix']
1000
1005
aliases = ['di', 'dif']
1002
1007
@display_command
1003
1008
def run(self, revision=None, file_list=None, diff_options=None,
1005
1010
from bzrlib.diff import diff_cmd_helper, show_diff_trees
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(":")
1012
if (prefix is None) or (prefix == '0'):
1020
if not ':' in prefix:
1021
raise BzrError("--diff-prefix expects two values separated by a colon")
1022
old_label, new_label = prefix.split(":")
1016
1025
tree1, file_list = internal_tree_files(file_list)