[bug] can't cat revision after rename

Matthieu Moy Matthieu.Moy at imag.fr
Tue Feb 7 13:28:05 GMT 2006


Vincent LADEUIL <v.ladeuil at alplog.fr> writes:

> === modified file 'bzrlib/repository.py'
> --- bzrlib/repository.py	
> +++ bzrlib/repository.py	
> [...]
> @@ -260,7 +261,8 @@
>          # use inventory as it was in that revision
>          file_id = tree.inventory.path2id(file)
>          if not file_id:
> -            raise BzrError("%r is not present in revision %s" % (file, revno))
> +            raise BzrError("%r is not present in revision %s" %
> +                           (file, revision_id))

If you change the revno into a revision_id here, then the remaining
code becomes useless:

>              try:
>                  revno = self.revision_id_to_revno(revision_id)
>              except errors.NoSuchRevision:
                   ....

Indeed, a better version would be almost:

=== modified file 'bzrlib/repository.py'
--- bzrlib/repository.py	
+++ bzrlib/repository.py	
@@ -17,7 +17,7 @@
 from cStringIO import StringIO
 
 from bzrlib.decorators import needs_read_lock, needs_write_lock
-from bzrlib.errors import InvalidRevisionId
+from bzrlib.errors import InvalidRevisionId, BzrError
 from bzrlib.lockable_files import LockableFiles
 from bzrlib.osutils import safe_unicode
 from bzrlib.revision import NULL_REVISION
@@ -260,10 +260,9 @@
         # use inventory as it was in that revision
         file_id = tree.inventory.path2id(file)
         if not file_id:
-            raise BzrError("%r is not present in revision %s" % (file, revno))
             try:
                 revno = self.revision_id_to_revno(revision_id)
-            except errors.NoSuchRevision:
+            except bzrlib.errors.NoSuchRevision:
                 # TODO: This should not be BzrError,
                 # but NoSuchFile doesn't fit either
                 raise BzrError('%r is not present in revision %s' 


However, there is no revision_id_to_revno method in Repository (this
is a branch method - which is logical - but we have no branch object
here).

-- 
Matthieu




More information about the bazaar mailing list