[darcs-users] Patches are immutable

David Roundy droundy at abridgegame.org
Tue Oct 26 12:19:51 UTC 2004


On Tue, Oct 26, 2004 at 08:41:30AM -0300, Zooko Wilcox-O'Hearn wrote:
> On 2004, Oct 26, at 08:17, David Roundy wrote:
> 
> >>It occurs to me that if I use darcs programmatically from another tool,
> >>for example the tailor.py script that I currently use, then I'm playing
> >>Russian Roulette with darcs's unsafe method of generating unique patch
> >>ids.
> >
> >Well, that's what the time is there for.  If it's something you're
> >concerned about, just make sure a second passes between each patch you
> >record.  (or change the patch name)
> 
> But in practice I sometimes run tailor.py in one window and then run
> other darcs commands or even another tailor.py in another window.
> 
> Maybe the darcs manual should have a prominent warning that one mustn't
> run multiple darcs record commands at the same time, even if they are on
> different repos?  Maybe darcs should acquire a lock in ~/.darcs before
> snapping a timestamp?

Darcs is designed to be run by humans, who aren't likely to make this sort
of mistake.  Getting a lock in ~/.darcs really wouldn't help much, since
the two patches quite likely would be created on different computers.

Of course, if this really concerns you (and you really *need* to reuse
patch names), you could just use a slightly different author for each
repo to avoid this danger.

> The timestamp method of attempting to make patch ids unique is going to
> bite someone someday.  What will happen if two completely different
> patches have identical patch ids?

Bad things will happen, repository corruption.  Probably it would be caught
relatively soon, and you wouldn't lose any data.

> >>Is it too late to change patch ids to be 128-bit random numbers?
> >
> >Yes.
> 
> It's a shame.  Contemplating this issue gives me a queasy feeling that 
> the tool I'm using on my source code is a sloppy tool which doesn't 
> bother to guarantee important invariants like unique identifiers.

You can guarantee unique patch names by giving your patches unique names.

We *could* add a random number to the patch name and then try to hide that
number from the user.  Older darcs wouldn't hide the name, but at least
would be able to interoperate.  We could also make this random number added
be optional as someone suggested here.
-- 
David Roundy
http://www.abridgegame.org




More information about the darcs-users mailing list