Jason appears to be busy (he's unassigned himself), so I'm taking this
one over.

All of these patches have conflicts with HEAD.  I think Florent's been
patient enough with this, so I'm going to try to resolve the conflicts
myself and push.

On Thu, Apr 22, 2010 at 14:28:49 +0000, Florent Becker wrote:
> Mon Feb 15 16:13:11 CET 2010  Florent Becker <[email protected]>
>   * Refactor Darcs.Commands.Pull
> 
> Fri Mar 19 14:31:33 CET 2010  Florent Becker <[email protected]>
>   * Resolve conflicts in Commands.Pull
>
> Thu Apr 22 13:34:03 CEST 2010  Florent Becker <[email protected]>
>   * export the right list of patches when not pulling anything

These were applied by Ganesh (thanks for helping things along).

> Tue Feb 16 15:59:32 CET 2010  Florent Becker <[email protected]>
>   * extract a few functions from Send
> 
> Mon Mar 22 17:51:59 CET 2010  Florent Becker <[email protected]>
>   * fix conflicts in Send
> 
> Tue Feb 16 16:17:14 CET 2010  Florent Becker <[email protected]>
>   * Add -o option to obliterate, to keep a backup of the patch
>   With that patch, you can mkdir _darcs/trash and add "obliterate
>   output-auto-name _darcs/trash" to your defaults file. This gives
>   you a rudimentary trash for obliterated patches.
> 
> Thu Apr 22 16:11:33 CEST 2010  Florent Becker <[email protected]>
>   * Add a fetch command

To make it easier for me to understand this patch, I viewed in a
graphical diff tool according to its expected context

  darcs get --lazy http://darcs.net --context 
refactor-darcs_commands_pull.dpatch review-patch39
  
  darcs apply -i refactor-darcs_commands_pull.dpatch review-patch39
  # cherry pick the patches Ganesh already applied
  
  darcs apply -i refactor-darcs_commands_pull.dpatch review-patch39
  # apply the rest of them
  
  darcs diff --diff-command="meld %1 %2" --last=4

extract a few functions from Send
---------------------------------
> -                         checkOrRepair, justThisRepo, optimizePristine
> +                         checkOrRepair, justThisRepo, optimizePristine,
> +                         getOutput

> +getOutput :: [DarcsFlag] -> FilePath -> Maybe AbsolutePathOrStd

Hunk move.

> +{-# LANGUAGE CPP, TypeOperators #-}

Was this really needed?

> -      pristine' <- applyToTree (invert $ mapRL_RL hopefully us') pristine
> -      unsig_bundle <- make_bundle (Unified:opts) pristine' common (mapFL_FL 
> hopefully to_be_sent)
> -      bundle <- signString opts unsig_bundle
> +      bundle <- prepareBundle opts common pristine (us':\/:to_be_sent)

> +prepareBundle :: forall p C(x y). RepoPatch p => [DarcsFlag] -> [PatchInfo]
> +                -> Tree IO -> ((RL (PatchInfoAnd p)) :\/: (FL (PatchInfoAnd 
> p))) C(x y)
> +                -> IO Doc
> +prepareBundle opts common pristine (us' :\/: to_be_sent) = do
> +  pristine' <- applyToTree (invert $ mapRL_RL hopefully us') pristine
> +  unsig_bundle <- make_bundle (Unified:opts) pristine' common (mapFL_FL 
> hopefully to_be_sent)
> +  signString opts unsig_bundle

Straightforward refactor.

> -patchDesc :: forall p C(x y) . PatchInfoAnd p C(x y) -> String
> -safeFileChar :: Char -> Char
> -patchFilename :: String -> String

Moved to Darcs.Patch.Bundle (which David rightly observed should really
be called Darcs.PatchBundle)

Add -o option to obliterate, to keep a backup of the patch
----------------------------------------------------------
>  obliterateCmd = genericObliterateCmd "obliterate"
> hunk ./src/Darcs/Commands/Unrecord.lhs 305
>                                    else matchingHead opts allpatches
>    with_selected_last_changes_reversed cmdname opts Nothing
>        (reverseRL patches) $
> -    \ (_ :> ps) ->
> -    case commute (effect ps :> pend) of
> +    \ (kept :> removed) ->
> +    case commute (effect removed :> pend) of

Minor rename from ps to removed (and keep track of kept ones too)

> +        when (isJust $ getOutput opts "") $
> +             savetoBundle opts kept removed

Fair enough.

> +savetoBundle :: RepoPatch p => [DarcsFlag]
> +             -> FL (PatchInfoAnd p) C(x y) -> FL (PatchInfoAnd p) C(z t)
> +             -> IO ()
> +savetoBundle opts kept removed@(x :>: _) = do
> +    bundle <- make_bundle opts undefined (mapFL info kept)
> +              (mapFL_FL hopefully removed)
> +    let filename = patchFilename $ patchDesc x
> +        Just outname = getOutput opts filename
> +    useAbsoluteOrStd writeDocBinFile putDoc outname $ bundle

Dump to file.  We need kept to have the context for the bundle.
I guess this is about as factored out with send as it will get.

Add a fetch command
-------------------
> +fetch = DarcsCommand {
> +         commandName = "fetch",
> +         commandHelp = fetch_help,
> +         commandDescription = fetch_description,
> +         commandExtraArgs = -1,
> +         commandExtraArgHelp = ["[REPOSITORY]..."],
> +         commandCommand = fetch_cmd,
> +         commandPrereq = amInRepository,
> +         commandGetArgPossibilities = getPreflist "repos",
> +         commandArgdefaults = defaultrepo,
> +         commandAdvancedOptions = [repoCombinator,

--union --intersection, etc (fine)

> +                                     nocompress, nolinks,
> +                                     ignoretimes,

Why do we need nocompress, nolinks and ignoretimes?

I ignored the rest of the options

> +fetch_cmd :: [DarcsFlag] -> [String] -> IO ()
> +fetch_cmd opts repos =
> +    withRepoLock opts $- \ repository ->
> +        fetchPatches opts' repos "fetch" repository 
> +                         >>= makeBundle opts' repository
> +    where
> +      opts' = merge_opts opts

Why would we want the merge_opts?  Presumably, mark-conflicts
doesn't really make sense here, does it?

(note this may change the options we accept)

> +makeBundle ::
> +    forall p C(r u t) . (RepoPatch p) => [DarcsFlag] -> Repository p C(r u 
> t) ->
> +    ([PatchInfo], Sealed ((RL (PatchInfoAnd p) :\/: FL (PatchInfoAnd p)) 
> C(r)))
> +    -> IO ()
> +makeBundle opts repository (common, Sealed (_ :\/: to_be_fetched)) =
> +    do
> +      bundle <- make_bundle opts undefined common $
> +                 mapFL_FL hopefully to_be_fetched
> +      let fname = case to_be_fetched of
> +                    (x:>:_)-> patchFilename $ patchDesc x
> +          o = fromMaybe stdOut (getOutput opts fname)
> +      useAbsoluteOrStd writeDocBinFile putDoc o $ bundle

Save a bundle to a file or print it on stdout.

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9

Attachment: signature.asc
Description: Digital signature

_______________________________________________
darcs-users mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/darcs-users

Reply via email to