darcs

Patch 738 resolve issue1166 --unified flag for record, amend-record, revert and unrevert

Title resolve issue1166 --unified flag for record, amend-record, revert and unrevert
Superseder Nosy List gh
Related Issues
Status accepted Assigned To gh
Milestone

Created on 2012-03-08.23:02:42 by gh, last changed 2012-04-22.19:04:33 by darcswatch. Tracked on DarcsWatch.

Files
File name Status Uploaded Type Edit Remove
redundant-exit-line-in-whatsnew.dpatch gh, 2012-03-08.23:02:41 text/x-darcs-patch
unnamed gh, 2012-03-08.23:02:41
See mailing list archives for discussion on individual patches.
Messages
msg15225 (view) Author: gh Date: 2012-03-08.23:02:41
This implements the --unified flag for record, amend-record, revert and unrevert.
This enables to see a little more context when choosing hunks.
I have not tested it with hunk edit.
It should be possible to adapt it to darcs changes.
Test suit OK (without unit tests), user interface feedback is welcome.

3 patches for repository http://darcs.net:

Thu Mar  8 16:03:13 ART 2012  Guillaume Hoffmann <guillaumh@gmail.com>
  * redundant exit line in Whatsnew

Thu Mar  8 19:39:30 ART 2012  Guillaume Hoffmann <guillaumh@gmail.com>
  * change help of --unified to refer to changes in place of patches

Thu Mar  8 19:54:03 ART 2012  Guillaume Hoffmann <guillaumh@gmail.com>
  * resolve issue1166 --unified flag for record, amend-record, revert and unrevert
Attachments
msg15242 (view) Author: gh Date: 2012-03-09.20:43:42
The current bundle exhibits weird behaviour for darcs record --unified
(also revert) when a first hunk is a line add. Say I have a recorded
file  that is: "1\n2\n3\n" and the changes are:

hunk ./a 1
+O
hunk ./a 4
-3
+33

darcs rec -u shows:

hunk ./a 1
+O
 1
 2
 3

hunk ./a 4
 1
 2
 3
-3
+33

Seems that it has the correct line number of the second hunk, but it
tries to do an unified diff agains a pristine state that doesn't have
that new first line, hence the appearance of the "3" line while it
shouldn't.

Somehow, whatsnew --unified gets it right.
msg15255 (view) Author: darcswatch Date: 2012-03-09.23:04:30
This patch bundle (with 3 patches) was just applied to the repository http://darcs.net/screened.
This message was brought to you by DarcsWatch
http://darcswatch.nomeata.de/repo_http:__darcs.net_screened.html#bundle-1961e95e5d3e941889d6d74661d0fe9e7928802a
msg15337 (view) Author: gh Date: 2012-03-15.18:43:08
I'm pushing the "redundant exit line in Whatsnew" patch since it is a
(trivial) dependency for Owen's patch750 that refactors the module
Darcs.Command.Whatnew, and has nothing to do with the 2 other patches of
this bundle.

Also changing the title of this patch bundle otherwise it will get
unnoticed.
msg15406 (view) Author: mndrix Date: 2012-03-28.02:14:49
Based on msg15242, it looks like this patch needs follow up.  Changing the 
status to reflect that.
msg15444 (view) Author: gh Date: 2012-03-31.03:59:12
Both Record and Whatsnew call the function
Darcs.Repository.State.unrecordedChanges to know what changes to
display, and ultimately call Darcs.PrintPatch.printFriendly (or
contextualPrintPatch but the code is the same) to print the changes with
context.

The only difference I see is that for the case of Record, printFriendly
is called with just one primitive patch and the pristine, while with
Whatsnew, contextualPrintPatch is called with the whole patch
corresponding to the unrecorded changes, and the pristine.  That may
explain why hunk selection with record --unified loses track of the
right line numbers when displaying hunks.
msg15531 (view) Author: gh Date: 2012-04-04.19:34:35
The problem is that with record --unified (contrary to whatsnew
--unified), the function Darcs.Patch.Viewing.coolContextHunk does not
know, when displaying a hunk with context inside of a file f, what are
the previous hunks that modify f.

Hence, some hunk, displayed against the pristine state, has some line
number that is irrelevant to the state of the pristine, but that is
relevant to the state of the pristine *knowing* the previous hunks of
the file.
msg15590 (view) Author: mndrix Date: 2012-04-20.21:28:06
When pushing out these patches, also push "fix name shadowing warning in 
Darcs.SelectChanges" (originally part of patch788).
msg15600 (view) Author: gh Date: 2012-04-22.18:44:36
These patches require further work but I'm self-pushing them now to
avoid having them stuck in the pipeline for too much time, since I
believe they are a correct first step.  I'm opening an issue ticket for
future work.  I gave a try at fixing rec --unified last week but I got
into trouble with type witnesses, and probably some code
cleanup/restructuration will be needed in between.

mndrix> the "fix name shadowing" patch seems related to another patch of
mine ("dirty fix for compile error", itself depending upon "Tidy up
wspfr" by Andreas).
msg15603 (view) Author: darcswatch Date: 2012-04-22.19:04:33
This patch bundle (with 3 patches) was just applied to the repository http://darcs.net/reviewed.
This message was brought to you by DarcsWatch
http://darcswatch.nomeata.de/repo_http:__darcs.net_reviewed.html#bundle-1961e95e5d3e941889d6d74661d0fe9e7928802a
History
Date User Action Args
2012-03-08 23:02:42ghcreate
2012-03-08 23:04:18darcswatchsetdarcswatchurl: http://darcswatch.nomeata.de/repo_http:__darcs.net_reviewed.html#bundle-1961e95e5d3e941889d6d74661d0fe9e7928802a
2012-03-09 20:43:43ghsetmessages: + msg15242
2012-03-09 23:04:30darcswatchsetstatus: needs-screening -> needs-review
messages: + msg15255
2012-03-15 18:43:08ghsetmessages: + msg15337
title: redundant exit line in Whatsnew (and 2 more) -> resolve issue1166 --unified flag for record, amend-record, revert and unrevert
2012-03-28 02:14:49mndrixsetstatus: needs-review -> followup-requested
assignedto: gh
messages: + msg15406
2012-03-31 03:59:14ghsetmessages: + msg15444
2012-04-04 19:34:35ghsetmessages: + msg15531
2012-04-20 21:28:06mndrixsetmessages: + msg15590
2012-04-22 18:44:37ghsetstatus: followup-requested -> accepted
messages: + msg15600
2012-04-22 19:04:33darcswatchsetmessages: + msg15603