{"thread":{"id":"551","subject":"Git-aware Darcs: a tutorial","startedAt":"2005-05-09T16:29:22Z","lastAt":"2005-05-09T19:41:39Z","messageCount":3,"participants":["Juliusz Chroboczek","H. Peter Anvin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"2891","messageId":"7i4qdc8isd.fsf@lanthane.pps.jussieu.fr","threadId":"551","inReplyTo":null,"subject":"Git-aware Darcs: a tutorial","fromName":"Juliusz Chroboczek","fromEmail":"juliusz.chroboczek@pps.jussieu.fr","sentAt":"2005-05-09T16:29:22Z","receivedAt":"2005-05-09T16:29:22Z","isPatch":false,"sender":{"key":"juliusz.chroboczek@pps.jussieu.fr","avatar":null},"body":"0. What is Darcs-git\n\nDarcs-git is a branch of Darcs that can work with Git repositories.\n\nDarcs-git is deliberately Darcs, not Git.  All commands either work in\nthe same way on Git repositories as on Darcs repositories, or they\nfail.  If you're a Darcs user, you'll like darcs-git.  If you're a Git\nuser, you'll probably find it infuriating.\n\nOn the other hand, Darcs-git uses stock Git repositories; a Darcs\ncommand either works as-is on a Git repository, or fails.\n\n\n1. What you can expect\n\nThe following should work reasonably well on Git repositories:\n\n  darcs changes\n  darcs whatsnew\n  darcs pull\n  darcs send\n  darcs record\n\nThe following commands work, but have serious performance problems:\n\n  darcs diff\n  darcs changes with a file argument\n\nThe following commands should in principle work but haven't been tested:\n\n  darcs add\n  darcs remove\n  darcs dist\n  darcs trackdown\n\nThe following commands don't work because I'm lazy::\n\n  darcs push\n  darcs unrecord\n  darcs unpull\n  darcs amend-record\n  darcs annotate\n  darcs rollback\n\nThe following commands only work on native Darcs repositories, either\nbecause they don't make sense on Git repositories, or because there\nare perfectly good native Git tools to perform their function:\n\n  darcs initialize\n  darcs get/put\n  darcs check\n  darcs repair\n  darcs optimize\n  darcs mv\n  darcs replace\n  darcs resolve\n  darcs tag\n  darcs setpref\n\nRemote Git repositories are not supported.\n\n\n2. A tutorial\n\n(0) Build darcs-git\n\n  $ darcs get --partial http://www.pps.jussieu.fr/~jch/software/repos/darcs-git\n  $ cd darcs-git\n  $ make darcs\n  $ make Context.hs\n  $ make darcs\n  $ cp darcs ~/bin/\n\n(1) Get a copy of the Linux Git repository:\n\n  $ cd /usr/local/src\n  $ mkdir linux-2.6\n  $ cd linux-2.6\n  $ rsync -r rsync://rsync.kernel.org/pub/linux/kernel/people/torvalds/linux-2.6.git .git\n  $ curl http://rsync.kernel.org/pub/linux/kernel/people/torvalds/linux-2.6.git/HEAD > .git/HEAD\n\nWe still need to bring the cache and working directory into a state\nthat Darcs will be happy with.  While this could in principle be done\nwith Darcs itself, it will be faster to do it with Git:\n\n  $ read-tree `cat .git/HEAD`\n  $ checkout-cache -a\n  $ update-cache --refresh\n\n(2) Check what the friendly Linux hackers have been up to:\n\n  $ darcs changes | more\n  $ darcs changes -s | more\n\n(3) Create a local clone of the Linux repository:\n\n  $ cd ..\n  $ mkdir linux-2.6-local\n  $ mkdir linux-2.6-local/.git\n  $ ln -s `pwd`/linux-2.6/.git/objects linux-2.6-local/.git\n  $ cp linux-2.6/.git/HEAD linux-2.6-local/.git\n  $ cd linux-2.6-local\n  $ read-tree `cat .git/HEAD`\n  $ checkout-cache -a\n  $ update-cache --refresh\n\n(4) Commit some work\n\nFirst, check that Darcs is happy with the new repository.\n\n  $ darcs whatsnew\n\nThis should take a few seconds at most; if it takes minutes instead,\ntry running ``update-cache --refresh''.\n\nOkay, let's add myself to the list of Linux maintainers.\n\n  $ echo 'P:    Juliusz Chroboczek' >> MAINTAINERS\n\nLet's see if Darcs agrees.\n\n  $ darcs whatsnew -s\n  $ darcs whatsnew\n\nEverything looks fine, let's record (commit) this patch.\n\n  $ darcs record -a\n  $ darcs changes | more\n  $ darcs changes -s | more\n\n(5) Send it upstream\n\nIf Linus were using Darcs, we could just send him a Darcs patch, which\nis a patch-like data structure that contains just enough context\ninformation to allow Darcs to perform a history-sensitive merge:\n\n  $ darcs send ../linux-2.6\n\nHowever, until Linus switches to Darcs, we're stuck with old-fashioned\npatches.\n\n  $ darcs diff -u --patch='.' | mail bill@microsoft.com\n\nUnfortunately, until I've spent some time optimising ``darcs diff'',\nthe above won't terminate on a repository the size of Linux'.\n\n\n3. Caveats\n\nThere is little input validation.  In particular, if you enter an\ne-mail address that doesn't end in ``>'', Darcs will write a commit\nthat neither Git nor Darcs itself will be able to parse.\n\nDarcs never updates the Git cache.  If you perform many commits using\nDarcs, you'll need to manually run ``update-cache --refresh''.\n\nDarcs treats Git merges by reverse-engineering a Darcs merge (thanks\nto David Roundy for outlining how that can be done).  In practice,\nthis means that Darcs will collapse as soon as it sees a nontrivial\nGit merge.\n"},{"id":"2898","messageId":"427FA400.2060408@zytor.com","threadId":"551","inReplyTo":"7i4qdc8isd.fsf@lanthane.pps.jussieu.fr","subject":"Re: Git-aware Darcs: a tutorial","fromName":"H. Peter Anvin","fromEmail":"hpa@zytor.com","sentAt":"2005-05-09T17:55:12Z","receivedAt":"2005-05-09T17:55:12Z","isPatch":false,"sender":{"key":"hpa@zytor.com","avatar":null},"body":"Juliusz Chroboczek wrote:\n> 0. What is Darcs-git\n> \n> Darcs-git is a branch of Darcs that can work with Git repositories.\n> \n> Darcs-git is deliberately Darcs, not Git.  All commands either work in\n> the same way on Git repositories as on Darcs repositories, or they\n> fail.  If you're a Darcs user, you'll like darcs-git.  If you're a Git\n> user, you'll probably find it infuriating.\n> \n> On the other hand, Darcs-git uses stock Git repositories; a Darcs\n> command either works as-is on a Git repository, or fails.\n> \n\nHow is it, performance-wise?\n\n\t-hpa\n"},{"id":"2908","messageId":"7ihdhc426k.fsf@lanthane.pps.jussieu.fr","threadId":"551","inReplyTo":"427FA400.2060408@zytor.com","subject":"Re: [darcs-users] Re: Git-aware Darcs: a tutorial","fromName":"Juliusz Chroboczek","fromEmail":"juliusz.chroboczek@pps.jussieu.fr","sentAt":"2005-05-09T19:41:39Z","receivedAt":"2005-05-09T19:41:39Z","isPatch":false,"sender":{"key":"juliusz.chroboczek@pps.jussieu.fr","avatar":null},"body":">> Darcs-git is a branch of Darcs that can work with Git repositories.\n\n> How is it, performance-wise?\n\nIt depends very much on the command, but in general it's no faster\nthan plain Darcs right now, except for accessing the working\ndirectory when you have an up-to-date cache.  The nice thing, of\ncourse, is that since Darcs-git works on pure Git repositories, you\ncan always switch to using plain Git commands when an operation is\nlikely to be too slow, as I've done in the example above.\n\n(Editor's note: ``Patch'' is Darcs-speak for what BK calls a Changeset.)\n\nCommands that only touch the working dir and the top of the history --\ndarcs what, darcs record, and so on -- are relatively fast; unlike the\nnative Git equivalents, they stat every file in your tree (I'll be\nfixing this RSN), but they don't touch the contents of unchanged\nfiles.  Darcs whatsnew on a full kernel takes 4s on my machine.\n\nCommands that read history (darcs changes, darcs send, darcs push) are\nvery fast until they encounter a merge, as they need to read the full\ncontents of one of the two branches (just the changed files, of\ncourse).  In practice, that means that doing |darcs whatsnew| gets me\nthe last 90 patches in Linux' history in a few seconds, then stalls.\nI've tried to track the problem down, but after an afternoon of work I\nhad gotten no further.  (I've explained the issue in excruciating\ndetail on Darcs-Devel, if you're interested.)\n\nCommands that push patches around scale rather badly with the amount\nof files touched by a patch.  In practice, this means that you'll be\nable to push around all patches in a kernel tree in a reasonable time,\nexcept for the initial commit (220MB of touched files), which you can\nonly push using the native Git tools.\n\nAnd then there is what I consider as the actual showstopper: darcs diff\nis completely brain-damaged (very much so in plain Darcs, even more so\nin Darcs-git).  It needs a complete rewrite.\n\n                                        Juliusz\n"}]}