darcs

Issue 1470 Allow to amend-record patch by removing some hunks

Title Allow to amend-record patch by removing some hunks
Priority feature Status resolved
Milestone Resolved in 2.8.0
Superseder Nosy List darcs-devel, dastapov, dmitry.kurochkin, ertai, ganesh, jaredj, kowey, thorkilnaur, weissi
Assigned To weissi
Topics ProbablyEasy

Created on 2009-05-26.12:21:40 by dastapov, last changed 2012-01-19.22:23:30 by noreply.

Files
File name Uploaded Type Edit Remove
resolve-issue1470_-allow-to-amend_record-patch-by-removing-some-hunks.dpatch weissi, 2011-08-14.16:24:09 application/octet-stream
Messages
msg7844 (view) Author: dastapov Date: 2009-05-26.12:21:36
Hi,

Suppose that I have working copy with 1000 hunks in "darcs diff". I do
"darcs record" and record 500 of them. Then I realize that I forgot to add
another 5 hunks. I do "darcs amend" and include them as well.

Then I realize that I included 2 hunks by mistake. Now I'm out of luck,
because there is no easy way to remove those two hunks from the patch. I can
do "darcs unrecord", but it'll mean that I would have to select all those
~500 hunks once again.

Now, it would be nice to have "amend-record --remove" or something like
that, which would allow me to select hunks from already recorded patch and
make them active again.

I thinks that this makes a nice wishlist item for darcs-3 :)
Attachments
msg7847 (view) Author: ertai Date: 2009-05-27.08:23:03
Excerpts from Dmitry Astapov's message of Tue May 26 12:21:40 UTC 2009:
> 
> New submission from Dmitry Astapov <dastapov@gmail.com>:
> 
> Hi,
> 
> Suppose that I have working copy with 1000 hunks in "darcs diff". I do
> "darcs record" and record 500 of them. Then I realize that I forgot to add
> another 5 hunks. I do "darcs amend" and include them as well.
> 
> Then I realize that I included 2 hunks by mistake. Now I'm out of luck,
> because there is no easy way to remove those two hunks from the patch. I can
> do "darcs unrecord", but it'll mean that I would have to select all those
> ~500 hunks once again.
> 
> Now, it would be nice to have "amend-record --remove" or something like
> that, which would allow me to select hunks from already recorded patch and
> make them active again.

You can workaround this shortcoming, that's a bit manual though...

You have to manually undo the hunks you want to remove. You can do so by
looking at the recorded change using 'darcs change --last 1 -p' and
copy/pasting the removed part to make the current version again. Then
doing a 'darcs amend-record' would show you hunks to add that should
be coalesced with the original one leading to no change at all in the
resulting patch (sometimes coalescing is not smart enough though).
msg7850 (view) Author: dastapov Date: 2009-05-27.21:32:10
On Wed, May 27, 2009 at 11:23 AM, Nicolas Pouillard <bugs@darcs.net> wrote:

>
> You can workaround this shortcoming, that's a bit manual though...
>
> You have to manually undo the hunks you want to remove. You can do so by
> looking at the recorded change using 'darcs change --last 1 -p' and
> copy/pasting the removed part to make the current version again. Then
> doing a 'darcs amend-record' would show you hunks to add that should
> be coalesced with the original one leading to no change at all in the
> resulting patch (sometimes coalescing is not smart enough though).

Well, I could do even better, saving the patch to file and using emacs'
excellent ediff mode to selectively apply hunks from the patch. That is, if
I am working at my linux notebook.

However, if I am not armed with some nifty tools this manual mode workaround
is a royal PITA.

After all, it is possible to do version control through some carefull
copying of files between lots of directories, but nobody wants to do that,
everybody want tools. So I still think that darcs, being a powerful tool,
should have powerful amend-record, lest git users put us to shame ;)
Attachments
msg8031 (view) Author: kowey Date: 2009-08-06.14:37:21
Would darcs rollback followed by darcs unrecord (of the rolled back patch),
followed by amend record be a suitable workaround?
msg8033 (view) Author: dastapov Date: 2009-08-06.14:44:54
It seems to me that in the original scenario (when there are 500 recorded
hunks and 500 still unrecorded hunks) selective manual reverse of several
hunks followed by amend-record is better workaround: no need to wade through
1000 hunks once again.

Or am I missing something?

On Thu, Aug 6, 2009 at 5:37 PM, Eric Kow <bugs@darcs.net> wrote:

>
> Eric Kow <kowey@darcs.net> added the comment:
>
> Would darcs rollback followed by darcs unrecord (of the rolled back patch),
> followed by amend record be a suitable workaround?
>
> ----------
> priority:  -> feature
>
>
Attachments
msg8034 (view) Author: kowey Date: 2009-08-06.15:06:43
On Thu, Aug 06, 2009 at 17:43:56 +0300, Dmitry Astapov wrote:
> It seems to me that in the original scenario (when there are 500 recorded
> hunks and 500 still unrecorded hunks) selective manual reverse of several
> hunks followed by amend-record is better workaround: no need to wade through
> 1000 hunks once again.
> 
> Or am I missing something?

I was initially thinking that rollback would give you desired
amend-record --remove UI with its interactive primitive patch selector

But what I failed to consider was that it was also have the undesirable
effect of dumping inverse hunks into your working dir, which means not
being able to record them in the future (unless you made a point of
saving them, which brings you back to the selective manual reverse
square 1, albeit with less wading).

Actually, the requested flag (which we could name amend-record
--rollback to echo the rollback command) sounds fairly easy to
implement.
msg14663 (view) Author: weissi Date: 2011-08-14.16:24:56
here is a proposal with which you can do

darcs amend --rollback

to get rid of some hunks inside a patch.
msg15015 (view) Author: noreply Date: 2012-01-13.23:39:26
The following patch sent by Johannes Weiss <weiss@tux4u.de> updated issue issue1470 with
status=has-patch

* resolve issue1470: Allow to amend-record patch by removing some hunks 
Ignore-this: 14ceecaf01af92bc54f86ca6cadf4548
msg15041 (view) Author: noreply Date: 2012-01-19.22:23:28
The following patch sent by Johannes Weiss <weiss@tux4u.de> updated issue issue1470 with
status=resolved;resolvedin=2.8.0 HEAD

* resolve issue1470: Allow to amend-record patch by removing some hunks 
Ignore-this: 14ceecaf01af92bc54f86ca6cadf4548
History
Date User Action Args
2009-05-26 12:21:40dastapovcreate
2009-05-27 08:23:06ertaisetstatus: unread -> unknown
nosy: + darcs-devel, ertai
messages: + msg7847
2009-05-27 21:32:14dastapovsetfiles: + unnamed
nosy: kowey, darcs-devel, simon, thorkilnaur, ertai, dmitry.kurochkin, dastapov
messages: + msg7850
2009-07-28 21:05:21ganeshsetnosy: + ganesh
2009-08-06 14:37:23koweysetpriority: feature
nosy: kowey, darcs-devel, ganesh, simon, thorkilnaur, ertai, dmitry.kurochkin, dastapov
messages: + msg8031
2009-08-06 14:44:56dastapovsetfiles: + unnamed
nosy: kowey, darcs-devel, ganesh, simon, thorkilnaur, ertai, dmitry.kurochkin, dastapov
messages: + msg8033
2009-08-06 15:06:46koweysetnosy: kowey, darcs-devel, ganesh, simon, thorkilnaur, ertai, dmitry.kurochkin, dastapov
messages: + msg8034
2009-08-06 15:07:36koweysettopic: + ProbablyEasy
nosy: + jaredj
2009-08-19 10:37:39koweysetstatus: unknown -> needs-implementation
nosy: kowey, darcs-devel, ganesh, simon, thorkilnaur, jaredj, ertai, dmitry.kurochkin, dastapov
2009-08-25 17:45:19adminsetnosy: - simon
2009-08-27 14:27:54adminsetnosy: kowey, darcs-devel, ganesh, thorkilnaur, jaredj, ertai, dmitry.kurochkin, dastapov
2009-10-23 22:40:22adminsetnosy: + nicolas.pouillard, - ertai
2009-10-24 00:05:19adminsetnosy: + ertai, - nicolas.pouillard
2010-03-25 11:10:08dastapovsetfiles: - unnamed
2010-03-25 11:10:16dastapovsetfiles: - unnamed
2010-03-25 11:10:22dastapovsetfiles: - unnamed
2011-08-13 16:33:56koweysetassignedto: weissi
nosy: + weissi
2011-08-14 16:24:10weissisetstatus: needs-implementation -> has-patch
files: + resolve-issue1470_-allow-to-amend_record-patch-by-removing-some-hunks.dpatch
2011-08-14 16:24:57weissisetmessages: + msg14663
2012-01-13 23:39:27noreplysetmessages: + msg15015
2012-01-19 22:23:30noreplysetstatus: has-patch -> resolved
messages: + msg15041
resolvedin: 2.8.0