[darcs-devel] option fix for clone command and issue 2447

Ben Franksen ben.franksen at online.de
Sat Jun 13 18:03:30 UTC 2015


Hi Ganesh (and others)

you wrote this comment in the code of the clone command:

-- The 'clone' command takes --to-patch and --to-match as arguments,
-- but internally wants to handle them as if they were --patch and --match
-- TODO: remove this when we get rid of directly looking at [DarcsFlag]
-- for this command.

I am wondering about this. The same file contains this as documentation:

  , "You can also make a copy of an untagged state using the `--to-patch` 
or"
  , "`--to-match` options, which exclude patches *after* the first matching"
  , "patch.  Because these options treat the set of patches as an ordered"
  , "sequence, you may get different results after reordering with `darcs"
  , "optimize`, so tagging is preferred."

This suggests to me that --to-match etc *should* give us the documented 
behavior. I am wondering how the clone command can work as documented if it 
(internally) uses non-range matchers. The procedure used is 
Darcs.Repository.Match.getOnePatchset and I wonder: is this really doing 
what I think it does (i.e. the equivalent of --to-match etc )?

The question came up when I looked into issue2447. I tried to find an 
existing set of match options that better represents what the users expect. 
I found that

  matchOneContext = mconcat [toMatch, toPatch, toHash, tag, context]

fits nicely and is already used by the clone command, so wanted to see if I 
can steal its patch selection code. So I now wonder if I should use the same 
trick as with clone i.e. re-map the match flags and use 
Darcs.Repository.Match.getOnePatchset? I see that annotate is the (only) 
other command that uses this function. It would help if we knew that clone 
and annotate do not suffer from the equivalent of issue2447.

Assuming getOnePatchset does indeed choose the correct set of patches 
(everything up to and including the matching patch), I can try to re-write 
it to work correctly with range-matching options, so we can avoid the ugly 
re-mapping of match flags.

Cheers
Ben
-- 
"Make it so they have to reboot after every typo." ― Scott Adams




More information about the darcs-devel mailing list