monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] RFC: Fake IDs


From: Zack Weinberg
Subject: [Monotone-devel] RFC: Fake IDs
Date: Tue, 18 Jul 2006 14:10:21 -0700

There are a small number of places that need a fake ID of some variety
(ignoring all the unit tests, which use 'em heavily) and we currently
just pick a "random" 160-bit number.   I need to add a few more of
these, so I thought it would be a good idea to have a principled way
of generating them.  The  implementation I've picked is to have
vocab.hh provide a fake_id() function/macro that hashes __FILE__ and
__LINE__.

Typical use case (from cmd_merging.cc - I'm not posting a diff for
that, as I have a lot of other changes in that file right now):

      // Just pick some unused revid, all that's important is that it not
      // match the work revision or any ancestors of the base revision.
-      r_target_id =
revision_id(hexenc<id>("5432100000000000000000000500000000000000"));
+      r_target_id = revision_id(fake_id());

Thoughts?

zw

Attachment: fake-ids.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]