[darcs-users] Re: [wish] interactive selection should cycle through W selections

Junio C Hamano junkio at cox.net
Sun Apr 3 18:51:08 UTC 2005


>>>>> "TZ" == Thomas Zander <zander at kde.org> writes:

TZ> Please note that the 'a' behavior becomes quite wierd if 'w' patches are 
TZ> re-asked;  a says 'ok' to all remaining patches.  That is currently; all 
TZ> patches that have not been asked about yet.
TZ> With your suggested change this is not so clear anymore, and you can argue 
TZ> that they should indeed be ok-ed.  A behavior that is far from intuitive.
TZ> This does not only go for 'a' but also for 'f' and 's'.

I did not think of the above issue at all.  Thanks for pointing
it out.

I suspect that this is because the mental model I formed after
seeing this prompt:

    Shall I record this patch? (1/3) [ynWsfqadjk], or ? for help: 

is slightly different from the mental model you have.

What I thought was happening, after seeing the prompt, was that
each hunk is internally assigned one tri-state (whose value can
be one of "Y: Yes use this", "N: No do not use this", "W: Wait,
I have not decided on this yet") variable, which is initialized
to "W", and at the end of the interaction the ones in 'Y' state
are recorded.

Since going through all patches one-by-one is tedious, there are
shortcuts like 's', 'f', and 'a'.  The help text for 'a' reads
"record all the remaining patches".  Under the mental model
formed by me above, what it means is that "the ones I have not
decided on", not "the ones I have not been asked about".  

To sum up, what my "'w' skips" request should do is something
like this pseudocode:

    initialize the tri-state for each patch to 'W'
    set current hunk to the first one
    while (there is at least one hunk in 'W' state) {
       ask question "Shall I record..." for the current hunk
       switch (answer) {
       case 'y', 'n':
           set the tri-state for the current hunk to answer.
           // fall thru
       case 'w':
           set the current hunk to the next one in 'W' state;;
       case 'j':
           set the current hunk to the next one;;
       case 'k':
           set the current hunk to the previous one;;
       case 's':
           set the tri-state for the hunks for the same file as the
           current hunk that are in 'W' state to 'N'
           set the current hunk to the next one in 'W' state; if
           there is no such hunk, break from the loop;;
       case 'f':
           set the tri-state for the hunks for the same file as the
           current hunk that are in 'W' state to 'Y'
           set the current hunk to the next one in 'W' state; if
           there is no such hunk, break from the loop;;
       case 'a':
           set the tri-state for the hunks that are in 'W' state to
          'Y' ;;
       case 'd':
           set the tri-state for the hunks that are in 'W' state to
          'N' ;;
       }
    }
    record the ones in 'Y' state.

(What is interesting above is that 'd' is not the recording
 command, although it looks like it acts as one).

I suspect that there is no such tri-state variable for each hunk
in your mental model.  Instead I suspect you have two booleans
per each hunk: chosen/rejected and seen/unseen.  I also suspect
that your intended implementation of 'a', 'f', and 's' would
look at the seen/unseen flag.  I agree my "'w' skips" request
muddies the situation under that model.





More information about the darcs-users mailing list