[darcs-devel] [issue126] I wish I could split a hunk in two when
recording it.
Marnix Klooster
marnix.klooster at gmail.com
Sat Feb 4 00:10:03 PST 2006
Jason Dagit wrote:
>
> On Feb 3, 2006, at 6:07 PM, Zooko wrote:
>
>>
>> New submission from Zooko <zooko at zooko.com>:
>>
>> I've often wished for this. Also my co-worker Rob just wished for it.
>
>
> Could you give an example? The idea of "splitting a hunk" makes no
> sense to me.
Same wish here. Simple example: Start with file a.c:
f() {
printf("I'm f()\n");
}
Now I add a new function just before this one, and I also modify the
first line(s) of the next function. This gives a diff like this:
$ darcs diff
diff -rN old-split-hunk/a.c new-split-hunk/a.c
1,2c1,6
< f() {
< printf("I'm f()\n");
---
> g() {
> printf("I'm g()\n");
> }
>
> f(int x) {
> printf("I'm f(%d)\n", x);
It is very well possible that I'd want to record the addition of g() and
the change of f() separately, but this is not possible.
Workaround: open the file in an editor with multiple undo, remove those
changes that you don't want to be in your first recorded patch, save to
disk but leave the editor open, "darcs record" your first patch in a
separate window, "undo" in your editor to go back to the original
version of the file, "darcs record" your second patch. Variations are
possible of course. No, this is not nice, but it helped me several
times. It becomes even worse if you have multiple files with combined
hunks that you want to split at the same time.
Groetjes,
<><
Marnix
More information about the darcs-devel
mailing list