[darcs-users] darcs patch: Refactor copyInventory to not use identi... (and 1 more)

David Roundy droundy at darcs.net
Tue Sep 16 22:35:43 UTC 2008


On Tue, Sep 16, 2008 at 02:12:16PM -0700, Dmitry Kurochkin wrote:
> Hi all!
>
> This is my attempt to  fixissue1039. The patches introduce a 'repo-id'
> parameter that is created during init and stored in format file. During
> get source repo id is copied to the local repo. During push/pull/send
> we compare repo ids and ask for confirmation if they do not match.
>
> There are two things I do not like about the patch:
>
> - older darcs versions are not able to get repositories with 'repo-id'.
>   Perhaps repo-id should be stored not in the format file.
>
> - tests do not pass. I suppose it hangs on prompt input.
>   How is this handled in other places?
>
> Reviews, comments welcomed :)

I'm going to wait for other comments before doing an in-depth review,
but I can at least suggest a solution to the first problem you
mention.  Repository.Format already has support for making format
changes that are readable, but not writeable, by older darcs.

> Tue Sep 16 22:12:19 MSD 2008  Dmitry Kurochkin <dmitry.kurochkin at gmail.com>
>   * Refactor copyInventory to not use identifyRepositoryFor.
>
> Wed Sep 17 00:21:37 MSD 2008  Dmitry Kurochkin <dmitry.kurochkin at gmail.com>
>   * Resolve issue1039: detect seemingly unrelated repositories.


> hunk ./src/Darcs/Repository/Format.lhs 82
> -create_repo_format :: [DarcsFlag] -> RepoFormat
> -create_repo_format fs = RF ([map rp2ps flags2inv] ++ maybe2)
> +create_repo_format :: [DarcsFlag] -> IO RepoFormat
> +create_repo_format fs = do s <- genRepoId
> +                           return $ RF ([map rp2ps flags2inv] ++ maybe2 ++ repoid s)
> hunk ./src/Darcs/Repository/Format.lhs 88
> +          repoid s = [[rp2ps (RepoId s)]]

Here we just need to set

repoid s = [[rp2ps (RepoId s), rp2ps Darcs2]]

except that we'll have to be careful to use Darcs2 only if we want a
darcs-2 repo, instead use darcs-1 if we want a darcs-1 repo.  Note
that this must be in addition to the existing Darcs1_0 or Darcs2,
which mustn't be replaced.

This states that if a darcs can read either (RepoId s) or Darcs2, then
it can read this repository, but it must only write to it if it can
understands both of these formats.

David


More information about the darcs-users mailing list