[darcs-users] Colin Walters blogs on Arch changesets vs Darcs

Anthony Towns aj at azure.humbug.org.au
Sun Nov 21 08:23:53 UTC 2004


David Roundy wrote:
>On Fri, Nov 19, 2004 at 09:53:15PM -0500, Colin Walters wrote:
>>On Fri, 2004-11-19 at 19:16 -0500, Andrew Pimlott wrote:
>>>This could be done with darcs: Publish the "darcs changes --context" in
>>>the tarball,
>>From a look at the manual, it looks to me like that would involve
>>shipping your entire history around in every single tarball you release.
>>Do you truly think that is a practical solution?
> No, actually if you tag your release before making the tarball, the
> "context" you'd have to ship would consist of something like
> 
> [TAG 1.0.0
> David Roundy <droundy at abridgegame.org>**20041108111509]
> 
> However, in order to implement Andrew's idea, you'd also need to ship a
> list of which files are actually in the repository, since often tarballs
> include generated files that aren't under version control.

That seems pretty easy. You need two programs -- one that takes a 
repository that has a TAG associated with it and generates some manifest 
file, and another that takes that file and a tarball directory and 
creates a compatible (partial) _darcs/ tree.

Because users suck, you need to do some authentication too, so we want 
the manifest file to look like:

   [TAG DARCSHIVE-0.4
   aj at azure.humbug.org.au**20041121035651]
   **
   adf2acdc15c84a905189346934ecca1b 490 ./BUGS
   284ede192494b511a58bfeabd71e4c0f 589 ./darcs-scp
   80c439f2fc9119c6f5165da872da73de 473 ./darcs-ssh
   dd145a47eebf7c23e5c00e739e4cfc71 6622 ./darcshive
   854585c02722ee0b639b363acdf3be3b 409 ./darcshive.cgi
   1692159f74ff844afe729c6097c7dcd7 1724 ./README

so if BUGS isn't 490 bytes, or README's md5sum has changed we won't 
accidentally create an incompatible repository.

Generating a file like that is pretty easy:

-----
#!/bin/sh

if [ ! -e ./_darcs/inventory ]; then
   echo >&2 "Must be in the top level of your archive. Sorry."
   exit 1
fi

taginv=$(tail -n2 ./_darcs/inventory)
# can TAGs have long descriptions? I hope not :)
if [ "${taginv#[TAG }" = "$taginv" ]; then
   echo >&2 "Repository must be tagged. Sorry."
   exit 1
fi

echo "$taginv"
echo "**"
(cd ./_darcs/current &&
   find . -type f | while read f; do
     m=$(md5sum < $f | cut -d\  -f1)
     s=$(wc -c < $f)
     echo $m $s "$f"
   done
)
-----

Going the other is mostly straightforward too: it's a matter of:

   (a) "darcs init"
   (b) checking the files we've got match the manifest
   (c) "darcs add" the files in the manifest
   (d) "darcs record" the initial import
   (e) recreate the tag we want, depending on the single patch
       we've made

Unfortunately I need to recalculate the patch filename for the TAG 
patch, so this one has to be perl. (See attached)

It seems pretty simple, and seems to work. Maybe it'd be nice to make 
this work by just saying:

     darcs mkmanifest > MANIFEST

and

     tar xzvf myproject-2.00.tgz
     cd myproject-2.00
     less MANIFEST
     darcs init --from-manifest ./MANIFEST

If we're doing it in darcs, probably makes more sense to use SHA1 
checksums instead of md5 checksums -- I only used md5 because I was 
aiming to do it all from shell.

FWIW, etc.

Cheers,
aj
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: darcs-init-manifest.pl
Url: http://lists.osuosl.org/pipermail/darcs-users/attachments/20041121/5ee59544/attachment.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 155 bytes
Desc: OpenPGP digital signature
Url : http://lists.osuosl.org/pipermail/darcs-users/attachments/20041121/5ee59544/attachment.pgp 


More information about the darcs-users mailing list