summaryrefslogtreecommitdiffstats
path: root/README
blob: a9499503ad470f361e3cea13de025daa554b20f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Use case:

So you have a patch that you want to backport and it's fitting well modulo
offsets.  You want convenient, non-tedious way to get perfectly fitting one.


How to achieve it:

$ patch-fix-offsets -p1 wrongoffsets.patch > goodoffsets.patch
$ # alternatively in pipe with recountdiff for extra sanity


Alternatives:

1. apply patch and rediff (possibly changing the format of the patch!)
$ cp -pR ${PROJECT_DIR}{,.orig}
$ patch -p1 <wrongoffsets.patch
$ diff -urN ${PROJECT_DIR}{.orig,} > goodoffsets.patch
$ mv ${PROJECT_DIR}{.orig,}

TBD: wiggle, merge, ...


Tools included:

fix-offsets: can either change offsets using limited expressions (DSL,
             see fix-offsets -h) to specify the desired offset changes,
             or using its own (and currently limited and buggy) method
             directly against the target codebase (for latter use case
             please refer to patch-fix-offsets below);
             as a bonus, the through-away prefixes in paths within
             a patch are (optionally, by default) normalized as per git
             diff conventions

patch-fix-offsets:
             will try to apply, in a dry-run manner, the patch and based
             on the patch utility feedback (hunk succeeded with offset X)
             will produce an offset expression subsequently feeded into
             fix-offsets tool (sort of a wrapper to bypass custom logic
             in fix-offsets)


Notable related tools (with a bit different intentions, though):

wiggle: http://neil.brown.name/wiggle/
patchutils: https://fedorahosted.org/patchutils/wiki
(used by gdp: https://gitorious.org/gdp)
Quilt: http://savannah.nongnu.org/projects/quilt

Please let me know if there are others handy (surely are!) or if there is
something better to solve the use case with as least effort (either manual
or computational like having the whole alternative tree externalized
on the filesystem) as possible.

-- 
Jan
jpokorn yr edha tc om