want per-file regexp for enclosing function in diff
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
In Progress
|
Medium
|
Martin Pool |
Bug Description
Filed retrospectively from <https:/
Let me summarize:
1. It's not always easy to find the "current branch" to be able to get its config.
2. having "-F regex" specified only globally is not flexible enough, as different branches (e.g. one with the C code, another with the Python code) may need different regexps.
2.1 Actually, even one regexp per branch is not enough, as one branch may have both python and C files.
3. Allowing the user to specify arbitrary diff options that affect all generated diffs is too dangerous - "diff -w" will break merge bundles (and "diff -c" breaks bzr shelve and everything that parses diffs).
3.1 But "diff -p" seems to be safe everywhere.
So, I took another approach. It's more strict and more flexible at the same time. More flexible as in the 2.1 above (regexp can be specified per file or a group of files) and more strict as in the 3.1 above (only diff -p - really, diff -F - is allowed).
Related branches
- Andrew Bennetts: Needs Fixing
- Jelmer Vernooij (community): Abstain
- Sergei Golubchik: Pending requested
-
Diff: 24 lines (+12/-2)1 file modifiedbzrlib/diff.py (+12/-2)
- John A Meinel: Approve
-
Diff: 98 lines (+78/-2) (has conflicts)2 files modifiedbzrlib/diff.py (+12/-2)
bzrlib/tests/test_diff.py (+66/-0)
Still to do on this:
* Ideally, rewrite it so that the function prefixes work with internal diff. Otherwise if this is turned on in a rules file, it's likely to break anyone who checks out that tree on Windows or some other platform without gnu diff, and there might be other side effects.
* Document the new rule setting in the rules help
* Also document it in the user guide
* Spiv mentions the issue of its effect on diffs used in bundle generation, shelves, etc. I think it'll be harmless there, and perhaps even useful to see them inline. It shouldn't break anything, but we should probably at least test it.