Storage internals: UUID
John Arbash Meinel
john at arbash-meinel.com
Fri Jun 8 07:10:40 UTC 2012
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 6/8/2012 1:34 AM, Neil Martinsen-Burrell wrote:
> On Thu, Jun 7, 2012 at 6:15 PM, Daniel Carrera <dcarrera at hush.com>
> wrote:
>
> [...]
>
>> bzr update -r 165c2a8
>>
>> bzr branch -r165c2a8
>>
>> etc.
>>
>> You get the idea. As in other VCS's, you don't have to enter the
>> entire SHA1 as long as what you provide is unique. I think it
>> would be cool if at every place where you normally insert a
>> revision id, you had the option of entering the SHA1 of the
>> testament instead. For my daily work I would use the convenient
>> "-r 5" type revision number, but when I publish a release, I
>> would probably give instructions based on the hash.
>>
>> In addition, with this feature you would add one more "workflow"
>> choice for Bazaar. People who actually prefer to refer to
>> revisions by hash (perhaps refugees from Git or Hg) have an
>> option to continue working just the way they like it, and have
>> basically the same cryptographic assurance that they get from Git
>> and Hg.
>>
>> What do you think? Do you think this is doable? Easy?
>
> Bazaar has a facility for defining new "revisionspecs" in plugins.
> This means that you could define a way to specify revisions using
> the "-r sha:165c2a8" syntax. See the code in bzrlib/revisionspec.py
> for examples of how the existing "-r <type>:" revision specs work.
> The important method to define in your subclass of RevisionSpec is
> RevisionSpec._as_revision_id(self, context_branch). Then,
> register your class with
> bzrlib.revisionspec.revspec_registry.register('sha',
> revspec_subclass).
>
> -Neil
You certainly could, with the major caveat that unless you index the
value it is going to be *terribly* slow to recompute the testament for
every revision just to figure out which one matches the sha: you provided.
So while code to add a revision spec is pretty small, doing the
indexing is non-trivial. (Probably not terrible, just need a
post-branch-tip-changed hook to update your cache, and look it up in
the revision spec code.)
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk/RpXAACgkQJdeBCYSNAAPUnwCghhi9jMZOb7YHbluWaHmmCLDc
czMAnjuJT0csikzEIBZyLwebjdUgKKwh
=BpKS
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list