Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Eric Y. Kow <eric.kow <at> gmail.com>
Subject: Re: darcs patch: make write_repo_format agree with read_repo_format (us...
Newsgroups: gmane.comp.version-control.darcs.devel
Date: Saturday 27th January 2007 23:11:31 UTC (over 10 years ago)
> Fri Jan 26 15:37:52 CET 2007  Benedikt Schmidt 
>   * make write_repo_format agree with read_repo_format (use | for
separating properties)

Going in.  Thanks for fixing this too (and David for the quick review).

About RepoFormat
----------------
For the curious, the RepoFormat mechanism is how we assure compatibility
across different versions of darcs we introduce features that affect it.
There may be mistakes in the following tale of repo formats, so caveat
lector...

Each darcs repository has a little file _darcs/format that has a list of
lines that look like this, modulo indentation for readibility:
  foo|alternate-foo|maybe-a-different-foo
  bar|alternate-bar
  baz|not-quite-baz

Each line contains some property that darcs must know about.  If you
read a repository, you must know about ONE property from every line.
So say I create a repository with darcs unstable circa 2007, using the
hashed inventory feature.  My _darcs/format will contain this line:
  darcs-1.0|hashed-inventory

Can I read the repository with an older version of darcs, say 1.0.8?
Well, 1.0.8 doesn't know anything about hashed-inventories, but it
does know about darcs-1.0 (inventories), so yes that's ok!  We've
created a repository such it will be read by anything that supports
one of darcs-1.0 or hashed-inventory.

So much for reading.  Now what would happen if we tried to write to the
repository with an older darcs?  Writing repositories is a much more
demanding affair in that we must not only know about one property from
every line, we must now know about *every* property from every line.  In
our example, darcs-1.0.8 doesn't know anything about hashed-inventory,
and if it tried to write to this repository it might mess up all the
lovely hashy stuff.  Luckily it stops itself from trying to write to it
because it notices that the repository contains a property it does not
recognise.

Now let's try this with a more elaborate example.  Darcs development has
been going swimmingly, it's 2010, world domination, lots of new patch
types, everything works brilliantly.  I create a repository with a new
repo format:
  darcs-1.0|hashed-inventory
  darcs-2.0-conflict-resolution
  fancy-new-feature|even-better-one

I dig my old darcs unstable ca 2007-01 out, try to do a darcs get and...
    Can't understand repository format: darcs-2.0-conflict-resolution
    Can't understand repository format: fancy-new-feature even-better-one

And I'm happy! Because my old darcs didn't lie to me about what it
doesn't know how to do; it just told me up front that it is no match for
darcs-2010.  And that's ok because at least it's being honest about it.
Likewise, it would also refuse to write to this fancy new repo on
similar grounds.  And now if I dig out a darcs-2009 which supports every
new feature except for even-better-one, what would happen is... left as
exercise to the reader.

And that concludes my very longwinded version of the repo format story,
which Benedikt just fixed because we would have accidentally said
  darcs-1.0 hashed-inventory
missing the pipe and confusing darcs-1.0.8 into thinking it can't read
from this repo because it doesn't know about 'darcs-1.0
hashed-inventory'

-- 
Eric Kow                     http://www.loria.fr/~kow
PGP Key ID: 08AC04F9         Merci de corriger mon fran├žais.
 
CD: 3ms