darcs

Patch 1552 avoid error messages with --list-options when out of a...

Title avoid error messages with --list-options when out of a...
Superseder Nosy List bf
Related Issues
Status needs-review Assigned To
Milestone

Created on 2017-04-03.08:37:51 by bf, last changed 2017-04-21.07:48:49 by bf.

Files
File name Status Uploaded Type Edit Remove
avoid-error-messages-with-__list_options-when-out-of-a-darcs-repo.dpatch bf, 2017-04-03.08:37:51 application/x-darcs-patch
patch-preview.txt bf, 2017-04-03.08:37:51 text/x-darcs-patch
unnamed bf, 2017-04-03.08:37:51 text/plain
See mailing list archives for discussion on individual patches.
Messages
msg19419 (view) Author: bf Date: 2017-04-03.08:37:51
1 patch for repository http://darcs.net/screened:

patch 37d2ff8acc0d7b21e88779afaa683321e355e39e
Author: Ben Franksen <ben.franksen@online.de>
Date:   Fri Mar 31 11:39:52 CEST 2017
  * avoid error messages with --list-options when out of a darcs repo
Attachments
msg19475 (view) Author: bf Date: 2017-04-20.18:29:52
screening this now
msg19481 (view) Author: ganesh Date: 2017-04-21.03:58:32
Are the changes to Darcs.Repository.Identify related to the --list-
options fix? They look like good things anyway, we have far too many 
catchalls in the darcs code and they tend to produce confusing error 
messages for users.
msg19484 (view) Author: bf Date: 2017-04-21.07:48:49
> Ganesh Sittampalam <ganesh@earth.li> added the comment:
> 
> Are the changes to Darcs.Repository.Identify related to the --list-
> options fix? 

At least in part, see below. The problem was, if you said e.g. 'darcs
whatsnew <TAB>' and you are not inside a repo, you'd get an error
message instead of no (empty) completion, messing up your command line.
This is because the commandPrereq stuff (mostly implemented in
Darcs.Repository.Identify) is now done before evaluating --list-options
option, which is necessary in order to get the repo dir, which in turn
is needed to provide the correct fixing of subpaths for the completions.

> They look like good things anyway, we have far too many 
> catchalls in the darcs code and they tend to produce confusing error 
> messages for users.

Yes. As usual, some factoring of the code was necesary for me to
understand what it does in the first place, so there might be some
changes I made that are not strictly necessary to achieve what I
intended. I hope the code is now easier to understand.

There remain things that are rather non-obvious. For instance,
internally the Repository code seems to assume that the repo location is
either ".", meaning we are acting on a local repo, or else is a remote
location ("URL"). Half-hearted attempts to structure this were made at
some point using the WorkRepo type. However, there are two problems with
it: (1) it isn't used systematically inside Darcs.Repository, but mostly
inside Darcs.UI, and (2) which alternative is used depends on the option
(--repo vs. --repodir), not on parsing the passed string, which is not
very reliable. I have made some progress to clean this particular mess
up but it's not yet ready for screened.
History
Date User Action Args
2017-04-03 08:37:51bfcreate
2017-04-20 18:29:52bfsetstatus: needs-screening -> needs-review
messages: + msg19475
2017-04-21 03:58:33ganeshsetmessages: + msg19481
2017-04-21 07:48:49bfsetmessages: + msg19484