[MERGE] RevisionSpec.as_revision_id()

Lukáš Lalinský lalinsky at gmail.com
Sun Mar 30 12:37:22 BST 2008


On Ne, 2008-03-30 at 12:33 +0300, John Arbash Meinel wrote:
> +     def _last_revision_info(self):
> +         """Read the last_revision information from disk."""
> +         revision_string =
> self.control_files.get('last-revision').read()
> +         revno, revision_id = revision_string.rstrip('\n').split(' ',
> 1)
> +         revision_id = cache_utf8.get_cached_utf8(revision_id)
> +         revno = int(revno)
> +         return revno, revision_id

Syntax error. Needs one space less indent. :)

> === modified file 'bzrlib/diff.py'
> --- bzrlib/diff.py	2008-03-07 14:15:10 +0000
> +++ bzrlib/diff.py	2008-03-20 22:45:35 +0000
> @@ -314,9 +314,9 @@
>  
>      def spec_tree(spec):
>          if tree:
> -            revision = spec.in_store(tree.branch)
> +            revision = spec.as_revision_id(tree.branch)
>          else:
> -            revision = spec.in_store(None)
> +            revision = spec.as_revision_id(None)
>          revision_id = revision.rev_id
>          branch = revision.branch
>          return branch.repository.revision_tree(revision_id)

This is wrong, the code expects a RevisionInfo instance, not a string.

The non-deprecated diff code could use as_revision_id, too.
Unfortunately it's not possible to use it because as_revision_id
discards the branch info from RevisionSpec_revno. Another problem is
that as_revision_spec expects the branch to be locked, which was not
required for in_history and cmd_diff doesn't do it (because of the old
read/write lock issue in RevisionSpec_branch).

Lukas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Toto je =?ISO-8859-1?Q?digit=E1lne?=
	=?ISO-8859-1?Q?_podp=EDsan=E1?= =?UTF-8?Q?_=C4=8Das=C5=A5?=
	=?ISO-8859-1?Q?_spr=E1vy?=
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080330/d6b9068a/attachment.pgp 


More information about the bazaar mailing list