[MERGE] reject reserved revision ids

John Arbash Meinel john at arbash-meinel.com
Thu Jan 11 17:47:48 GMT 2007

Hash: SHA1

Aaron Bentley wrote:
> Hi all,
> We seem to be agreed that revision ids ending with ':' should be
> reserved.  There are currently two such ids:
> 'null:' (the null revision)
> 'current:' (the current on-disk state)
> This patch causes all reserved ids to be rejected by versionedfiles,
> repositories, branches and trees.  Perhaps it doesn't cover every
> possible method, but it should cover enough that using a reserved id
> will lead to errors immediately.
> Unfortunately, the test cases mean that API compatibility is not
> preserved-- we are adding a new requirement (to throw ReservedId), and
> plugins that implement branch, repository or tree will fail the test
> suite until they are updated.
> I hope that this small incompatibility is permissible.  The alternative
> is much more complex.

Having tests fail because an implementation is not 100% compliant with
the new definition is fine.

Having it fail at runtime because of that is what we are trying to avoid.

So if I understand your change, I think it is perfectly ok. This is
updating the API to handle a new edge case, not something that occurs
normally, and asking all implementations to also handle that edge case.

> Aaron


=== modified file bzrlib/revision.py
- --- bzrlib/revision.py
+++ bzrlib/revision.py
@@ -454,3 +454,6 @@
         next = best_ancestor(next)
     return path
+def reserved_id(revision_id):
+    return revision_id.endswith(':')

^- This needs an extra space and a doc string.

And we probably should have a NEWS entry under INTERNALS.

So +1 conditional from me.


Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the bazaar mailing list