Rev 1778: Skip trying to lookup a revision id if the mapping doesn't round trip. in file:///data/jelmer/bzr-svn/trunk/
Jelmer Vernooij
jelmer at samba.org
Tue Sep 2 03:31:37 BST 2008
At file:///data/jelmer/bzr-svn/trunk/
------------------------------------------------------------
revno: 1778
revision-id: jelmer at samba.org-20080902023136-b7xq7b9aocba1023
parent: jelmer at samba.org-20080902014929-nk64wlimf8xob98z
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2008-09-02 04:31:36 +0200
message:
Skip trying to lookup a revision id if the mapping doesn't round trip.
modified:
revids.py revids.py-20070416220458-36vfa0730cchevp1-1
tests/mapping_implementations/test_repository.py test_repository.py-20080902013845-ity7d1ymye69sobm-2
=== modified file 'revids.py'
--- a/revids.py 2008-09-01 22:34:27 +0000
+++ b/revids.py 2008-09-02 02:31:36 +0000
@@ -31,13 +31,16 @@
self.repos = repos
def get_revision_id(self, revnum, path, mapping, revprops, fileprops):
- # See if there is a bzr:revision-id revprop set
- try:
- (bzr_revno, revid) = mapping.get_revision_id(path, revprops, fileprops)
- except SubversionException, (_, num):
- if num == ERR_FS_NO_SUCH_REVISION:
- raise NoSuchRevision(path, revnum)
- raise
+ if mapping.supports_roundtripping():
+ # See if there is a bzr:revision-id revprop set
+ try:
+ (bzr_revno, revid) = mapping.get_revision_id(path, revprops, fileprops)
+ except SubversionException, (_, num):
+ if num == ERR_FS_NO_SUCH_REVISION:
+ raise NoSuchRevision(path, revnum)
+ raise
+ else:
+ revid = None
# Or generate it
if revid is None:
=== modified file 'tests/mapping_implementations/test_repository.py'
--- a/tests/mapping_implementations/test_repository.py 2008-09-02 01:39:01 +0000
+++ b/tests/mapping_implementations/test_repository.py 2008-09-02 02:31:36 +0000
@@ -22,7 +22,7 @@
from bzrlib.osutils import has_symlinks
from bzrlib.repository import Repository
from bzrlib.revision import NULL_REVISION
-from bzrlib.tests import TestCase, TestSkipped
+from bzrlib.tests import TestCase, TestSkipped, TestNotApplicable
import os
@@ -723,6 +723,8 @@
(num, date, author) = self.client_commit("dc", "Second Message")
repository = Repository.open(repos_url)
mapping = repository.get_mapping()
+ if not mapping.supports_roundtripping():
+ raise TestNotApplicable
revid = mapping.revision_id_foreign_to_bzr((repository.uuid, 2, ""))
rev = repository.get_revision("myrevid")
self.assertEqual((repository.generate_revision_id(1, "", mapping),),
More information about the bazaar-commits
mailing list