[darcs-users] darcs patch: fix list command to select accepted patches only

Christian Kellermann Christian.Kellermann at nefkom.net
Sun Dec 14 10:15:14 UTC 2008


Hi,

Sun Dec 14 10:57:09 CET 2008  Christian Kellermann <Christian.Kellermann at nefkom.net>
  * fix list command to select accepted patches only

This patch corrects the previously sent patch that introduced an
interactive list command while selecting changes.  It now takes the
first or last lists from PatchChoices instead of just displaying
all patches from the tp_done list which was the old behaviour. This
would just list all patches that darcs has already asked for
regardless of the user's answer.

To ease the review this time, let me explain myself what this does:

    hunk ./src/Darcs/SelectChanges.hs 54
    -                       spanFL, reverseFL, (+<+), mapFL, mapRL,
    +                       spanFL, reverseFL, (+<+), mapFL,

Removes mapRL again form the import list as it is no longer used.

    hunk ./src/Darcs/SelectChanges.hs 487
    -            'l' -> do putStrLn $ "Already selected "++things++":"
    -                      mapM_ putDocLn $ mapRL (\a -> showPatch `unseal2` (seal2 $ tp_patch a)) tps_done
    +            'l' -> do let selected = case get_choices pc of
    +                                          (first_chs:>_:>last_chs) ->
    +                                             if whichch == Last || whichch == FirstReversed
    +                                                then last_chs else first_chs
    +                      putStrLn $ "---- Already selected "++things++" ----"
    +                      mapM_ putDocLn $ mapFL (\a ->
    +                        showPatch `unseal2` (seal2 $ tp_patch a)) selected

Get the results via get_choices, ignore the middle patches and use
last or first depending on the usage case. According to the docs
of PatchChoices in record, pull and friends the yes patches are in
the first list while with revert they are in the last list. The
same logic is already used in the force_yes function a couple of
lines below in the code.  The output is then actually quite simple,
with a mapFL replacing the older mapRL, since now we use this
datatype.

I hope this can go into the next release branch. If not I will
provide a rollback patch to remove the list command again, so we
don't ship something that is just wrong.

Thanks,

Christian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-darcs-patch
Size: 150376 bytes
Desc: A darcs patch for your repository!
Url : http://lists.osuosl.org/pipermail/darcs-users/attachments/20081214/0ba86954/attachment-0001.bin 


More information about the darcs-users mailing list