external diff

Martin Pool mbp at sourcefrog.net
Fri May 27 04:34:48 BST 2005


I've just put in code to allow file diffs to be shown using an external
GNU diff.  Example:

  bzr diff --diff-options -C10

One thing this allows is passing options for various nice things in GNU
diff that are not done by Python diff, such as -y and -p. 
Another advantage is that GNU diff is more likely to be precisely
correct (in the opinion of patch) for edge cases like files without
trailing newliens.

This needs GNU diff for the --label options.

At the moment this only turns on when you give --diff-options.  I would
just use it always, but on many non-Linux platforms diff is either not
present or not very good.

~/.bzr/bzr.ini (say) can have

  # on systems where 'diff' is not gnu diff
  diff_command = "gdiff"

  # i never care about space changes
  diff_options = "--ignore-space-change"

  # always run external diff
  external_diff = True

There might be some mechanism for say calling a Python hook in case
people want to use different diffs depending on the file type or
something like that.

-- 
Martin




More information about the bazaar mailing list