darcs

Patch 1222 Make the options type used by a command into a type pa...

Title Make the options type used by a command into a type pa...
Superseder Nosy List ganesh
Related Issues
Status accepted Assigned To
Milestone 2.10.0

Created on 2014-11-14.06:35:57 by ganesh, last changed 2015-02-05.12:45:14 by darcswatch. Tracked on DarcsWatch.

Files
File name Status Uploaded Type Edit Remove
make-the-options-type-used-by-a-command-into-a-type-parameter_.dpatch ganesh, 2014-11-14.06:35:57 application/x-darcs-patch
make-the-options-type-used-by-a-command-into-a-type-parameter_.dpatch ganesh, 2014-11-18.07:29:23 application/x-darcs-patch
make-the-options-type-used-by-a-command-into-a-type-parameter_2.dpatch bfrk, 2014-11-15.22:15:31 application/x-darcs-patch
patch-preview.txt ganesh, 2014-11-14.06:35:57 text/x-darcs-patch
patch-preview.txt ganesh, 2014-11-18.07:29:23 text/x-darcs-patch
unnamed ganesh, 2014-11-14.06:35:57
unnamed ganesh, 2014-11-18.07:29:23
See mailing list archives for discussion on individual patches.
Messages
msg17796 (view) Author: ganesh Date: 2014-11-14.06:35:57
Not for screened yet, but this is one possible option for avoiding
possible problems with legacy [DarcsFlag] inspection until we have
cleaned it all out.

It breaks the utf8.sh due to issue2416.

1 patch for repository darcs-unstable@darcs.net:screened:

Fri Nov 14 06:18:20 GMT 2014  Ganesh Sittampalam <ganesh@earth.li>
  * Make the options type used by a command into a type parameter.
  
  The default for commands that haven't been migrated to the new
  options system is [DarcsFlag].
  
  The explicit parse step this change introduces provides a
  convenient point to normalise the [DarcsFlag] list for unmigrated
  commands, to avoid any problems caused by default values for
  options that are overridden by later choices appearing in the list.
Attachments
msg17798 (view) Author: bfrk Date: 2014-11-14.17:57:26
I think this is a pretty clever idea. Yes, we have to carry the type
parameter through everywhere, or use an existential to hide it, but I
guess that is the price to pay and it is not too high. So a clear +1
from me.

At first I was a bit confused about WrappedCommand vs. CommandControl.
The former wraps a DarcsCommand, the latter also distinguishes between
normal commands, hidden commands, and so on. They are both GADTs now. As
an alternative, have you considered pushing the existential wrapping
down into the alternatives:

data CommandControl
  = CommandData WrappedCommand
  | HiddenCommand WrappedCommand
  | GroupName String CommandControl

This means we have to wrap them in the super command implementations
(but that could be done with a small helper function) and would avoid
having to unwrap and re-wrap them for some operations in Commands.hs.

BTW, can we find a better name for CommandControl and its data constructors?
msg17811 (view) Author: bfrk Date: 2014-11-15.22:15:31
I have attached a follow-up patch that implements what I suggested. Not
sure this is a definite improvement but judge for yourself.
Attachments
msg17837 (view) Author: ganesh Date: 2014-11-17.22:19:01
This also breaks some send tests, not sure why I didn't see those 
failures the first time round.

Those send failures are fixed by patch1230, and the utf8 failures by 
Ben's patch1231.
msg17841 (view) Author: ganesh Date: 2014-11-18.07:29:23
Resolving conflicts with mainline screened.

I think this bundle should go in once we have resolved the
outstanding confusion over the --to-patch argument, which
causes test failures in rebase-unsuspend-to-patch.sh and
workingdir.sh

With the WrappedCommand update I think it's a trade-off
of where the unwrapping and re-wrapping goes, but on
balance I agree it's probably easier to understand with
the update.

2 patches for repository darcs-unstable@darcs.net:screened:

Fri Nov 14 06:18:20 GMT 2014  Ganesh Sittampalam <ganesh@earth.li>
  * Make the options type used by a command into a type parameter.
  
  The default for commands that haven't been migrated to the new
  options system is [DarcsFlag].
  
  The explicit parse step this change introduces provides a
  convenient point to normalise the [DarcsFlag] list for unmigrated
  commands, to avoid any problems caused by default values for
  options that are overridden by later choices appearing in the list.
  

Tue Nov 18 07:11:31 GMT 2014  Ganesh Sittampalam <ganesh@earth.li>
  * resolve conflicts
Attachments
msg17846 (view) Author: darcswatch Date: 2014-11-19.07:25:12
This patch bundle (with 2 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-f26484eb2efe1696e438863ebc389d3ea7f054f2
msg18004 (view) Author: bfrk Date: 2015-02-04.23:38:26
I am accepting this and the follow-up patches.
msg18005 (view) Author: bfrk Date: 2015-02-04.23:43:07
When I push this to reviewed I get conflicts!

How can that be??? Whatsnew (in reviewed) says no changes. Pull (here)
says nothing to pull.
msg18006 (view) Author: bfrk Date: 2015-02-04.23:57:50
If I darcs get the reviewed branch and pull locally I also get
conflicts. I think this is a bug and a serious one at that. My best
guess ATM is that darcs somehow forgot some dependencies, either when
recording or when I applied the patch bundle. Hmm, could it be that this
has something to do with the context minimizing that has recently been
added?
msg18007 (view) Author: ganesh Date: 2015-02-05.06:35:01
Which patches were you trying to pull? My first one does have conflicts which are 
resolved by a followup, so if you try to pull one without the other then the conflicts 
are expected. You'd see the same in screened if you unpull the resolution patch and run 
'darcs mark-conflicts'.

That said, given issue2432, a bug in darcs is a definite worry.
msg18008 (view) Author: bfrk Date: 2015-02-05.11:51:24
My fault and not a Darcs bug. I did not expect a patch from screened to
have conflicts. Now that I think a bit about what you said, it is
obvious that this is what must happen if one pulls a conflicting patch
and not the conflict resolution patch. My only excuse is that in my
daily work I have a long time ago made it a rule never to push
conflicting patches to a shared repo; I always resolve conflicts by
rebasing.

Sorry for the alarm.

To answer your question, this is the patch:

patch 6ef3e49796ef64ae23bde58bfc4ea6720e8fd14d
Author: Ganesh Sittampalam <ganesh@earth.li>
Date:   Fri Nov 14 07:18:20 CET 2014
  * Make the options type used by a command into a type parameter.

and indeed it has conflicts.

So, is there a way to find out which patch resolves this conflict so I
can push them together?
msg18011 (view) Author: darcswatch Date: 2015-02-05.12:45:14
This patch bundle (with 2 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-f26484eb2efe1696e438863ebc389d3ea7f054f2
History
Date User Action Args
2014-11-14 06:35:57ganeshcreate
2014-11-14 06:36:13ganeshsetstatus: needs-screening -> in-discussion
2014-11-14 17:57:26bfrksetmessages: + msg17798
2014-11-15 22:15:31bfrksetfiles: + make-the-options-type-used-by-a-command-into-a-type-parameter_2.dpatch
messages: + msg17811
2014-11-15 22:15:52darcswatchsetdarcswatchurl: http://darcswatch.nomeata.de/repo_http:__darcs.net_reviewed.html#bundle-f26484eb2efe1696e438863ebc389d3ea7f054f2
2014-11-17 22:19:01ganeshsetmessages: + msg17837
2014-11-18 06:50:09ganeshsetstatus: in-discussion -> review-in-progress
2014-11-18 07:29:24ganeshsetfiles: + patch-preview.txt, make-the-options-type-used-by-a-command-into-a-type-parameter_.dpatch, unnamed
messages: + msg17841
2014-11-19 07:14:26ganeshsetstatus: review-in-progress -> needs-review
2014-11-19 07:25:12darcswatchsetmessages: + msg17846
2015-02-04 23:38:26bfrksetstatus: needs-review -> accepted
messages: + msg18004
milestone: 2.10.0
2015-02-04 23:43:08bfrksetstatus: accepted -> needs-review
messages: + msg18005
2015-02-04 23:57:50bfrksetmessages: + msg18006
2015-02-05 06:35:01ganeshsetmessages: + msg18007
2015-02-05 11:51:25bfrksetmessages: + msg18008
2015-02-05 12:23:54bfrksetstatus: needs-review -> accepted
2015-02-05 12:45:14darcswatchsetmessages: + msg18011