[MERGE] Consistent SHA1 for testaments, bundle version bump
John Arbash Meinel
john at arbash-meinel.com
Wed Jun 21 16:48:38 BST 2006
Aaron Bentley wrote:
> Hi all,
>
> This patch changes Testament.as_sha1 to produce the same sha1 as is
> produced as part of the short-form sha1.
>
> It also adds a --strict parameter to the testament command, for
> generating strict testaments.
>
> It also tweaks the StrictTestament formatting, and so there's a version
> bump.
>
> With these two changes, the testament sha1s will be utterly different,
> so I've bumped the version of Testaments to 0.8. Because 0.7 has never
> seen an official release, I haven't attempted to preserve backwards
> compatibility. During the transition, we can just use slightly-older
> versions of bzr for applying 0.7 bundles.
>
> Aaron
Aaron and I had talked about this while I was working on tracking down
some bundle problems.
...
...
I actually already merged this as part of my win32 fixes (since I needed
it to track down the problems).
But I don't think it will conflict, since I simply applied and committed
your patch.
=== modified file bzrlib/builtins.py //
last-changed:aaron.bentley at utoronto.ca-
... 20060620035311-355370a964fb8354
--- bzrlib/builtins.py
+++ bzrlib/builtins.py
@@ -2423,11 +2423,17 @@
class cmd_testament(Command):
"""Show testament (signing-form) of a revision."""
- takes_options = ['revision', 'long']
+ takes_options = ['revision', 'long',
+ Option('strict', help='Produce a strict-format'
+ ' testament')]
...
This is the big part that we wanted to fix. So +1 here.
def as_sha1(self):
- return sha(self.as_short_text()).hexdigest()
+ s = sha()
+ map(s.update, self.as_text_lines())
+ return s.hexdigest()
So why are you making the StrictTestament use v2.1 rather than v1.1?
It seems like it should either be 'version 2' or it should be version
'1.1' for .1 meaning 'strict'.
class StrictTestament(Testament):
"""This testament format is for use as a checksum in changesets"""
+ long_header = 'bazaar-ng testament version 2.1\n'
+ short_header = 'bazaar-ng testament short form 2.1\n'
def _entry_to_line(self, path, ie):
- l = ie.revision.decode('utf-8') + ' '
- l += {True: 'yes', False: 'no'}[ie.executable] + ' '
- l += Testament._entry_to_line(self, path, ie)
+ l = Testament._entry_to_line(self, path, ie)[:-1]
+ l += ' ' + ie.revision.decode('utf-8')
+ l += {True: ' yes\n', False: ' no\n'}[ie.executable]
return l
-
- def as_text_lines(self):
- lines = ['bazaar-ng testament version 2']
- lines.extend(Testament.as_text_lines(self)[1:])
- return lines
Is this the whitespace stuff that you wanted to fix?
...
Is it possible to have a STRICT testament test which includes the
executable bit? This test checks last_modified, and 'executable:no', but
it doesn't seem to check executable:yes.
+REV_2_STRICT_TESTAMENT = """\
+bazaar-ng testament version 2.1
+revision-id: test at user-2
+committer: test at user
+timestamp: 1129025483
+timezone: 36000
+parents:
+ test at user-1
+message:
+ add files and directories
+inventory:
+ file hello hello-id 34dd0ac19a24bf80c4d33b5c8960196e8d8d1f73
test at user-2 no
+ directory src src-id test at user-2 no
+ file src/foo.c foo.c-id a2a049c20f908ae31b231d98779eb63c66448f24
test at user-2 no
+properties:
+ branch-nick:
+ test branch
+"""
Generally +1 from me.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060621/9f31099a/attachment.pgp
More information about the bazaar
mailing list