[PATCH 1 of 1] Use tag dict code from tags.py

David Soria Parra dsoria at gmx.net
Wed Jun 9 02:13:09 CDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>> diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py
>> --- a/hgext/bookmarks.py
>> +++ b/hgext/bookmarks.py
>> @@ -29,7 +29,7 @@
>>  '''
>>
>>  from mercurial.i18n import _
>> -from mercurial.node import nullid, nullrev, hex, short
>> +from mercurial.node import nullid, nullrev, hex, short, bin
>>  from mercurial import util, commands, repair, extensions
>>  import os
>>
>> @@ -218,7 +218,9 @@
>>                 bookmarks = {}
>>                 for line in self.opener('bookmarks'):
>>                     sha, refspec = line.strip().split(' ', 1)
>> -                    bookmarks[refspec] = super(bookmark_repo, self).lookup(sha)
>> +                    nodebin = bin(sha)
>> +                    if nodebin in self.changelog.nodemap:
>> +                        bookmarks[refspec] = nodebin
>>             except:
>>                 pass
>>             return bookmarks
> 
> Ah, nice. Do we have a guarantee that the file doesn't have some other
> revision specifier (like a rev or a tag or something else)? As you
> might be aware, 'lookup' allows a much wider range of input.
If you read and write the bookmarks store file through the API, it is
safe to use bin() instead of lookup. We do the lookup when we create the
bookmark and store just the sha1. Using other revision specifier is
theoretically possible, but editing the bookmarks store by hand is
discouraged and I personally think we can safely remove this behavior
and use bin instead.

David

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJMDz8DAAoJEAT0aMuPE7Z1qfgP/1381agtranTAV/S6BR5PBxw
nyPLN8P1v++767XSv9H7wJ/P0PCQAVO9bw8NZrCdc39WXTzCO7hGKKO4MtDrmvpD
J+n6LHdZ6A7RaKLbQQkFvYnOqTGs1GPAImfthc1xpttyDO34B+ThMMfblAFKxp3S
LmTv2ZJk+tdv/93ZIiwYOkN6KkOlKz83iASVOwVp8Hk3XuB7HRhivQp0BjTmPKOO
MC+f1BWoH91fngErqnXGCwPpdPnGTTTYkiwgB2papj3lNnNNcv+Olg82xe+Re2iG
HpQuem/aeTIXKoEOmOFzYTl3I9/vomLEociaMTEtU1iT0WJQXuTjZaNH2Z5qlDcK
v4Zl4rWUcuSFRlhsduWvoaBANvpPUsobq5TM37mR45Opa7b8/65MpenfmosWmatu
+kQjpBs9bSU+UzUV0wx8exWJQa4gODtUc3D+N9W430ed0TFzftIqphhmzIz8AcB3
ZAfXrjwKbJhdFKG7AR8Fo2fBZmJiW4WFiIirjbJu4u1RtpaIBIi0toMXaoBsGE3V
LjDoOlXwZsU8b3JCrXiWHC9hLYC4BiXSza+1NnxJHockEToUv4AXpec3BJujx9h9
87pOVMnuhDh7AiJ97CVKYjos+ldDWGkHwQSHR7K8etY1PJpNE4r0+VwQLI/CMLsw
NzSRgKPy4p9Lm1hPIeWF
=fMLC
-----END PGP SIGNATURE-----


More information about the Mercurial-devel mailing list