Rev 593: Merge 0.4. in file:///data/jelmer/bzr-svn/revprops/

Jelmer Vernooij jelmer at samba.org
Thu Dec 6 17:53:21 GMT 2007


At file:///data/jelmer/bzr-svn/revprops/

------------------------------------------------------------
revno: 593
revision-id:jelmer at samba.org-20071206175320-jee45l5n5au7vrif
parent: jelmer at samba.org-20071121204458-4bspbs83eyhzxx5c
parent: jelmer at samba.org-20071206175113-m0ayc56h3u3wi5s5
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: revprops
timestamp: Thu 2007-12-06 18:53:20 +0100
message:
  Merge 0.4.
modified:
  FAQ                            faq-20070910195147-p9u38s9wplds2d4o-1
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
  errors.py                      errors.py-20061226172623-w1sbj8ynpo0eojqp-1
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  format.py                      format.py-20070917005147-94kb7zysotf82kqw-1
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
  revids.py                      revids.py-20070416220458-36vfa0730cchevp1-1
  revspec.py                     revspec.py-20071106211507-q4fz2en91yrmjjl8-1
  setup.py                       setup.py-20060502115218-86950492da22353f
  tests/test_fetch.py            test_fetch.py-20070624210302-luvgwjmlfysk5qeq-1
  tests/test_radir.py            test_radir.py-20061231173434-31utf9o4byu7wktm-1
  tests/test_repos.py            test_repos.py-20060508151940-ddc49a59257ca712
  tests/test_revids.py           test_revids.py-20070516230044-d7x872cqi7xb4eow-1
  tests/test_revspec.py          test_revspec.py-20071111183646-0wohlrzaevdsr9ia-1
    ------------------------------------------------------------
    revno: 579.1.224
    revision-id:jelmer at samba.org-20071206175113-m0ayc56h3u3wi5s5
    parent: jelmer at samba.org-20071206155408-23oe0l7zjw17tlqe
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Thu 2007-12-06 18:51:13 +0100
    message:
      Implement optimization in find_branches() to be able to start from a 
      different revno than 0. Speeds up push significantly.
    modified:
      repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
      tests/test_repos.py            test_repos.py-20060508151940-ddc49a59257ca712
    ------------------------------------------------------------
    revno: 579.1.223
    revision-id:jelmer at samba.org-20071206155408-23oe0l7zjw17tlqe
    parent: jelmer at samba.org-20071201172644-hm2xjcjda0df69lc
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Thu 2007-12-06 16:54:08 +0100
    message:
      Remember where revids have already been found.
    modified:
      NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
      __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
      repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
      revids.py                      revids.py-20070416220458-36vfa0730cchevp1-1
      tests/test_revids.py           test_revids.py-20070516230044-d7x872cqi7xb4eow-1
    ------------------------------------------------------------
    revno: 579.1.222
    revision-id:jelmer at samba.org-20071201172644-hm2xjcjda0df69lc
    parent: jelmer at samba.org-20071201170912-8y56f2osff3achq3
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sat 2007-12-01 18:26:44 +0100
    message:
      Also mark as being compatible with 0.93, whatever that will be :-).
    modified:
      __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
    ------------------------------------------------------------
    revno: 579.1.221
    revision-id:jelmer at samba.org-20071201170912-8y56f2osff3achq3
    parent: jelmer at samba.org-20071201140259-odtv32a1j7zylr70
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sat 2007-12-01 18:09:12 +0100
    message:
      Open 0.4.6 for development.
    modified:
      NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
      __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
      setup.py                       setup.py-20060502115218-86950492da22353f
    ------------------------------------------------------------
    revno: 579.1.220
    tags: bzr-svn-0.4.5
    revision-id:jelmer at samba.org-20071201140259-odtv32a1j7zylr70
    parent: jelmer at samba.org-20071128114557-2ngrtbhid2k7cven
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sat 2007-12-01 15:02:59 +0100
    message:
      Release 0.4.5.
    modified:
      NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
      __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
    ------------------------------------------------------------
    revno: 579.1.219
    revision-id:jelmer at samba.org-20071128114557-2ngrtbhid2k7cven
    parent: jelmer at samba.org-20071126113201-v0s6liknxv88dmse
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Wed 2007-11-28 12:45:57 +0100
    message:
      Mention rich-root-pack.
    modified:
      FAQ                            faq-20070910195147-p9u38s9wplds2d4o-1
    ------------------------------------------------------------
    revno: 579.1.218
    revision-id:jelmer at samba.org-20071126113201-v0s6liknxv88dmse
    parent: jelmer at samba.org-20071125184546-l1efuvd5bv2ajth5
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Mon 2007-11-26 11:32:01 +0000
    message:
      Give comprehensible error when a backslash is encountered.
    modified:
      NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
      errors.py                      errors.py-20061226172623-w1sbj8ynpo0eojqp-1
      fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
      tests/test_fetch.py            test_fetch.py-20070624210302-luvgwjmlfysk5qeq-1
    ------------------------------------------------------------
    revno: 579.1.217
    revision-id:jelmer at samba.org-20071125184546-l1efuvd5bv2ajth5
    parent: jelmer at samba.org-20071123132017-g3k7y2za854gtvrt
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sun 2007-11-25 18:45:46 +0000
    message:
      Depend on 0.93 rather than 1.0. Thanks, mwh.
    modified:
      __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
    ------------------------------------------------------------
    revno: 579.1.216
    revision-id:jelmer at samba.org-20071123132017-g3k7y2za854gtvrt
    parent: jelmer at samba.org-20071120193302-m5wdqg627arqe4jy
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Fri 2007-11-23 14:20:17 +0100
    message:
      Switch to new rich-roots format.
    modified:
      FAQ                            faq-20070910195147-p9u38s9wplds2d4o-1
      NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
      __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
      format.py                      format.py-20070917005147-94kb7zysotf82kqw-1
      tests/test_radir.py            test_radir.py-20061231173434-31utf9o4byu7wktm-1
      tests/test_repos.py            test_repos.py-20060508151940-ddc49a59257ca712
    ------------------------------------------------------------
    revno: 579.1.215
    revision-id:jelmer at samba.org-20071120193302-m5wdqg627arqe4jy
    parent: jelmer at samba.org-20071115223353-lw7ugchkhj27n5gq
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Tue 2007-11-20 20:33:02 +0100
    message:
      Fix inventory_sha1 property.
    modified:
      repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
    ------------------------------------------------------------
    revno: 579.1.214
    revision-id:jelmer at samba.org-20071115223353-lw7ugchkhj27n5gq
    parent: jelmer at samba.org-20071115215733-wirqr6dc6ooufd2p
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Thu 2007-11-15 23:33:53 +0100
    message:
      Fix out-of-range revspecs.
    modified:
      revspec.py                     revspec.py-20071106211507-q4fz2en91yrmjjl8-1
      tests/test_revspec.py          test_revspec.py-20071111183646-0wohlrzaevdsr9ia-1
=== modified file 'FAQ'
--- a/FAQ	2007-11-05 21:59:01 +0000
+++ b/FAQ	2007-11-28 11:45:57 +0000
@@ -40,13 +40,13 @@
 
 ::
 
-  $ bzr upgrade --dirstate-with-subtree
+  $ bzr upgrade --rich-root
 
 or, if you would like to try the experimental packs format:
 
 ::
 
- $ bzr upgrade --knitpack-subtree 
+ $ bzr upgrade --rich-root-pack
 
 ===========================================================================
 Pushing a branch that didn't exist in Subversion yet with `bzr push` fails.

=== modified file 'NEWS'
--- a/NEWS	2007-11-13 23:22:15 +0000
+++ b/NEWS	2007-12-06 15:54:08 +0000
@@ -1,4 +1,12 @@
-bzr-svn 0.4.5	UNRELEASED
+bzr-svn 0.4.6	UNRELEASED
+
+  PERFORMANCE
+  
+   * Remember where revids have already been detected. Makes incremental
+     push a lot faster, in particular in Subversion repositories 
+	 with a lot of branches.
+
+bzr-svn 0.4.5	2007-12-01
 
   IMPROVEMENTS
 
@@ -10,12 +18,21 @@
      This should make it easier to use bzr-specific revprops later on and 
      saves some disk space.
 
+   * Use new rich-roots format everywhere rather than experimental 
+     dirstate-with-subtree.
+
   BUG FIXES
 
    * Properly decode unicode commit messages. 
 
    * Handle some corner cases when finding branches.
 
+   * Print comprehensible error when unsupport characters occur in file names.
+     (partial fix of #163585)
+
+   * Fix compatibility with Bazaar 1.0rc1.
+
+
 bzr-svn 0.4.4	2007-11-02
 
   PERFORMANCE

=== modified file '__init__.py'
--- a/__init__.py	2007-11-21 20:44:58 +0000
+++ b/__init__.py	2007-12-06 17:53:20 +0000
@@ -31,7 +31,7 @@
 # versions ending in 'exp' mean experimental mappings
 # versions ending in 'dev' mean development version
 # versions ending in 'final' mean release (well tested, etc)
-version_info = (0, 4, 5, 'dev', 0)
+version_info = (0, 4, 6, 'dev', 0)
 
 if version_info[3] == 'final':
     version_string = '%d.%d.%d' % version_info[:3]
@@ -39,7 +39,7 @@
     version_string = '%d.%d.%d%s%d' % version_info
 __version__ = version_string
 
-COMPATIBLE_BZR_VERSIONS = [(0, 92)]
+COMPATIBLE_BZR_VERSIONS = [(0, 93), (1, 0)]
 
 def check_bzrlib_version(desired):
     """Check that bzrlib is compatible.
@@ -136,6 +136,7 @@
     InterRepository.register_optimiser(fetch.InterFromSvnRepository)
     InterRepository.register_optimiser(commit.InterToSvnRepository)
 
+
 def get_scheme(schemename):
     """Parse scheme identifier and return a branching scheme."""
     from scheme import BranchingScheme

=== modified file 'errors.py'
--- a/errors.py	2007-10-30 23:35:41 +0000
+++ b/errors.py	2007-11-26 11:32:01 +0000
@@ -126,3 +126,11 @@
 
     def __init__(self, error):
         DependencyNotPresent.__init__(self, 'bzr-rebase', error)
+
+
+class InvalidFileName(BzrError):
+    _fmt = "Unable to convert Subversion path %(path)s because it contains characters invalid in Bazaar."
+
+    def __init__(self, path):
+        BzrError.__init__(self)
+        self.path = path

=== modified file 'fetch.py'
--- a/fetch.py	2007-11-05 13:46:26 +0000
+++ b/fetch.py	2007-11-26 11:32:01 +0000
@@ -28,6 +28,7 @@
 from svn.core import Pool
 import svn.core
 
+from bzrlib.plugins.svn.errors import InvalidFileName
 from fileids import generate_file_id
 from repository import (SvnRepository, SVN_PROP_BZR_ANCESTRY, 
                 SVN_PROP_SVK_MERGE, SVN_PROP_BZR_MERGE,
@@ -70,6 +71,16 @@
     return s.hexdigest()
 
 
+def check_filename(path):
+    """Check that a path does not contain invalid characters.
+
+    :param path: Path to check
+    :raises InvalidFileName:
+    """
+    if "\\" in path:
+        raise InvalidFileName(path)
+
+
 class RevisionBuildEditor(svn.delta.Editor):
     """Implementation of the Subversion commit editor interface that builds a 
     Bazaar revision.
@@ -195,6 +206,7 @@
     def add_directory(self, path, parent_id, copyfrom_path, copyfrom_revnum, 
                       pool):
         path = path.decode("utf-8")
+        check_filename(path)
         file_id = self._get_new_id(parent_id, path)
 
         self.dir_baserev[file_id] = []
@@ -300,6 +312,7 @@
 
     def add_file(self, path, parent_id, copyfrom_path, copyfrom_revnum, baton):
         path = path.decode("utf-8")
+        check_filename(path)
         self.is_symlink = False
         self.is_executable = None
         self.file_data = ""

=== modified file 'format.py'
--- a/format.py	2007-10-30 23:11:07 +0000
+++ b/format.py	2007-11-23 13:20:17 +0000
@@ -34,8 +34,8 @@
     if format.repository_format.rich_root_data:
         return format
     # Default format does not support rich root data, 
-    # fall back to dirstate-with-subtree
-    format = format_registry.make_bzrdir('dirstate-with-subtree')
+    # fall back to rich-root
+    format = format_registry.make_bzrdir('rich-root')
     assert format.repository_format.rich_root_data
     return format
 

=== modified file 'repository.py'
--- a/repository.py	2007-11-15 22:07:22 +0000
+++ b/repository.py	2007-12-06 17:53:20 +0000
@@ -289,7 +289,6 @@
         self.dir_cache = {}
         self.pool = Pool()
         self.get_config().add_location(self.base)
-        self._revids_seen = {}
         cache_dir = self.create_cache_dir()
         cachedir_transport = get_transport(cache_dir)
         cache_file = os.path.join(cache_dir, 'cache-v%d' % MAPPING_VERSION)
@@ -646,7 +645,10 @@
         parent_ids = self.revision_parents(revision_id)
 
         # Commit SVN revision properties to a Revision object
-        rev = Revision(revision_id=revision_id, parent_ids=parent_ids)
+        class LazySvnRevision(Revision):
+            inventory_sha1 = property(lambda rev: self.get_inventory_sha1(rev.revision_id))
+
+        rev = LazySvnRevision(revision_id=revision_id, parent_ids=parent_ids)
 
         svn_revprops = self.transport.revprop_list(revnum)
 
@@ -673,9 +675,6 @@
                 self.branchprop_list.get_property(path, revnum, 
                      SVN_PROP_BZR_REVISION_INFO, ""), rev)
 
-        rev.inventory_sha1 = property(
-            lambda: self.get_inventory_sha1(revision_id))
-
         return rev
 
     def get_revisions(self, revision_ids):
@@ -762,14 +761,15 @@
             if scheme is None:
                 scheme = self.get_scheme()
             last_revnum = self.transport.get_latest_revnum()
-            if (self._revids_seen.has_key(str(scheme)) and 
-                last_revnum <= self._revids_seen[str(scheme)]):
+            if (last_revnum <= self.revmap.last_revnum_checked(str(scheme))):
                 # All revision ids in this repository for the current 
                 # scheme have already been discovered. No need to 
                 # check again.
                 raise e
             found = False
-            for (branch, revno, _) in self.find_branches(scheme, last_revnum):
+            for (branch, revno, _) in self.find_branches(scheme, 
+                    self.revmap.last_revnum_checked(str(scheme)),
+                    last_revnum):
                 # Look at their bzr:revision-id-vX
                 revids = []
                 try:
@@ -789,14 +789,11 @@
                         found = True
                     self.revmap.insert_revid(entry_revid, branch, 0, revno, 
                             str(scheme), entry_revno)
-
-                if found:
-                    break
                 
+            # We've added all the revision ids for this scheme in the repository,
+            # so no need to check again unless new revisions got added
+            self.revmap.set_last_revnum_checked(str(scheme), last_revnum)
             if not found:
-                # We've added all the revision ids for this scheme in the repository,
-                # so no need to check again unless new revisions got added
-                self._revids_seen[str(scheme)] = last_revnum
                 raise e
             (branch_path, min_revnum, max_revnum, scheme) = self.revmap.lookup_revid(revid)
             assert isinstance(branch_path, str)
@@ -1035,15 +1032,15 @@
 
         return self._ancestry
 
-    def find_branches(self, scheme, revnum=None):
+    def find_branches(self, scheme, from_revnum=0, to_revnum=None):
         """Find all branches that were changed in the specified revision number.
 
         :param revnum: Revision to search for branches.
         :return: iterator that returns tuples with (path, revision number, still exists). The revision number is the revision in which the branch last existed.
         """
         assert scheme is not None
-        if revnum is None:
-            revnum = self.transport.get_latest_revnum()
+        if to_revnum is None:
+            to_revnum = self.transport.get_latest_revnum()
 
         created_branches = {}
 
@@ -1051,8 +1048,8 @@
 
         pb = ui.ui_factory.nested_progress_bar()
         try:
-            for i in range(revnum+1):
-                pb.update("finding branches", i, revnum+1)
+            for i in range(from_revnum, to_revnum+1):
+                pb.update("finding branches", i, to_revnum+1)
                 paths = self._log.get_revision_paths(i)
                 for p in sorted(paths.keys()):
                     if scheme.is_branch(p) or scheme.is_tag(p):
@@ -1093,7 +1090,7 @@
             pb.finished()
 
         for p in created_branches:
-            j = self._log.find_latest_change(p, revnum, 
+            j = self._log.find_latest_change(p, to_revnum, 
                                              include_parents=True,
                                              include_children=True)
             if j is None:

=== modified file 'revids.py'
--- a/revids.py	2007-09-07 11:49:21 +0000
+++ b/revids.py	2007-12-06 15:54:08 +0000
@@ -92,8 +92,20 @@
         create index if not exists lookup_branch_revnum on revmap (max_revnum, min_revnum, path, scheme);
         create table if not exists revno_cache (revid text unique, dist_to_origin integer);
         create index if not exists revid on revno_cache (revid);
+        create table if not exists revids_seen (scheme text, max_revnum int);
+        create unique index if not exists scheme on revids_seen (scheme);
         """)
         self.cachedb.commit()
+
+    def set_last_revnum_checked(self, scheme, revnum):
+        self.cachedb.execute("replace into revids_seen (scheme, max_revnum) VALUES (?, ?)", (scheme, revnum))
+
+    def last_revnum_checked(self, scheme):
+        ret = self.cachedb.execute(
+            "select max_revnum from revids_seen where scheme = ?", (scheme,)).fetchone()
+        if ret is None:
+            return 0
+        return int(ret[0])
     
     def lookup_revid(self, revid):
         ret = self.cachedb.execute(

=== modified file 'revspec.py'
--- a/revspec.py	2007-11-15 21:57:33 +0000
+++ b/revspec.py	2007-11-15 22:33:53 +0000
@@ -15,7 +15,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 """Custom revision specifier for Subversion."""
 
-from bzrlib.errors import BzrError, InvalidRevisionSpec
+from bzrlib.errors import BzrError, InvalidRevisionSpec, NoSuchRevision
 from bzrlib.revisionspec import RevisionSpec, RevisionInfo
 
 class RevisionSpec_svn(RevisionSpec):
@@ -40,6 +40,8 @@
             return RevisionInfo.from_revision_id(branch, branch.generate_revision_id(int(self.spec[loc+1:])), branch.revision_history())
         except ValueError:
             raise InvalidRevisionSpec(self.user_spec, branch)
+        except NoSuchRevision:
+            raise InvalidRevisionSpec(self.user_spec, branch)
 
     def needs_branch(self):
         return True

=== modified file 'setup.py'
--- a/setup.py	2007-11-02 14:35:21 +0000
+++ b/setup.py	2007-12-01 17:09:12 +0000
@@ -5,7 +5,7 @@
 setup(name='bzr-svn',
       description='Support for Subversion branches in Bazaar',
       keywords='plugin bzr svn',
-      version='0.4.5',
+      version='0.4.6',
       url='http://bazaar-vcs.org/BzrForeignBranches/Subversion',
       download_url='http://bazaar-vcs.org/BzrSvn',
       license='GPL',

=== modified file 'tests/test_fetch.py'
--- a/tests/test_fetch.py	2007-10-23 12:31:34 +0000
+++ b/tests/test_fetch.py	2007-11-26 11:32:01 +0000
@@ -20,9 +20,11 @@
 from bzrlib.bzrdir import BzrDir
 from bzrlib.repository import Repository
 from bzrlib.revision import NULL_REVISION
+from bzrlib.tests import TestSkipped
 from bzrlib.trace import mutter
 
 from convert import load_dumpfile
+from bzrlib.plugins.svn.errors import InvalidFileName
 from fileids import generate_svn_file_id, generate_file_id
 import format
 import remote
@@ -30,7 +32,7 @@
 from tests import TestCaseWithSubversionRepository
 from transport import SvnRaTransport
 
-import os
+import os, sys
 
 class TestFetchWorks(TestCaseWithSubversionRepository):
     def test_fetch_fileid_renames(self):
@@ -59,6 +61,19 @@
         newrepos = dir.create_repository()
         oldrepos.copy_content_into(newrepos)
 
+    def test_fetch_backslash(self):
+        if sys.platform == 'win32':
+            raise TestSkipped("Unable to create filenames with backslash on Windows")
+        repos_url = self.make_client('d', 'dc')
+        self.build_tree({'dc/trunk/file\\part': "data"})
+        self.client_add("dc/trunk")
+        self.client_commit("dc", "My Message")
+        oldrepos = Repository.open(repos_url)
+        oldrepos.set_branching_scheme(TrunkBranchingScheme())
+        dir = BzrDir.create("f",format.get_rich_root_format())
+        newrepos = dir.create_repository()
+        self.assertRaises(InvalidFileName, oldrepos.copy_content_into, newrepos)
+
     def test_fetch_null(self):
         repos_url = self.make_client('d', 'dc')
         oldrepos = Repository.open(repos_url)

=== modified file 'tests/test_radir.py'
--- a/tests/test_radir.py	2007-09-17 13:18:46 +0000
+++ b/tests/test_radir.py	2007-11-23 13:20:17 +0000
@@ -131,7 +131,7 @@
     def test_needs_format_upgrade_other(self):
         repos_url = self.make_client("d", "dc")
         x = BzrDir.open(repos_url+"/trunk")
-        self.assertTrue(x.needs_format_conversion(format_registry.make_bzrdir("dirstate-with-subtree")))
+        self.assertTrue(x.needs_format_conversion(format_registry.make_bzrdir("rich-root")))
 
     def test_needs_format_upgrade_default(self):
         repos_url = self.make_client("d", "dc")

=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py	2007-11-13 22:52:51 +0000
+++ b/tests/test_repos.py	2007-12-06 17:51:13 +0000
@@ -297,7 +297,23 @@
 
         self.assertEqual([("tags/branchab", 2, True), 
                           ("tags/brancha", 2, True)], 
-                list(repos.find_branches(TrunkBranchingScheme(), 2)))
+                list(repos.find_branches(TrunkBranchingScheme(), to_revnum=2)))
+
+    def test_find_branches_start_revno(self):
+        repos_url = self.make_client("a", "dc")
+        self.build_tree({'dc/branches/brancha': None})
+        self.client_add("dc/branches")
+        self.client_commit("dc", "My Message")
+        self.build_tree({'dc/branches/branchb': None})
+        self.client_add("dc/branches/branchb")
+        self.client_commit("dc", "My Message 2")
+
+        repos = Repository.open(repos_url)
+        repos.set_branching_scheme(TrunkBranchingScheme())
+
+        self.assertEqual([("branches/branchb", 2, True)],
+                list(repos.find_branches(TrunkBranchingScheme(), from_revnum=2, 
+                    to_revnum=2)))
 
     def test_find_branches_file_moved_from_nobranch(self):
         repos_url = self.make_client("a", "dc")
@@ -345,7 +361,7 @@
 
         self.assertEqual([("t2/branches/brancha", 2, True), 
                           ("t2/branches/branchab", 2, True)], 
-                list(repos.find_branches(TrunkBranchingScheme(1), 2)))
+                list(repos.find_branches(TrunkBranchingScheme(1), to_revnum=2)))
 
     def test_find_branches_no(self):
         repos_url = self.make_client("a", "dc")
@@ -354,7 +370,7 @@
         repos.set_branching_scheme(NoBranchingScheme())
 
         self.assertEqual([("", 0, True)], 
-                list(repos.find_branches(NoBranchingScheme(), 0)))
+                list(repos.find_branches(NoBranchingScheme(), to_revnum=0)))
 
     def test_find_branches_no_later(self):
         repos_url = self.make_client("a", "dc")
@@ -363,7 +379,7 @@
         repos.set_branching_scheme(NoBranchingScheme())
 
         self.assertEqual([("", 0, True)], 
-                list(repos.find_branches(NoBranchingScheme(), 0)))
+                list(repos.find_branches(NoBranchingScheme(), to_revnum=0)))
 
     def test_find_branches_trunk_empty(self):
         repos_url = self.make_client("a", "dc")
@@ -372,7 +388,7 @@
         repos.set_branching_scheme(TrunkBranchingScheme())
 
         self.assertEqual([], 
-                list(repos.find_branches(TrunkBranchingScheme(), 0)))
+                list(repos.find_branches(TrunkBranchingScheme(), to_revnum=0)))
 
     def test_find_branches_trunk_one(self):
         repos_url = self.make_client("a", "dc")
@@ -385,7 +401,7 @@
         self.client_commit("dc", "My Message")
 
         self.assertEqual([("trunk", 1, True)], 
-                list(repos.find_branches(TrunkBranchingScheme(), 1)))
+                list(repos.find_branches(TrunkBranchingScheme(), to_revnum=1)))
 
     def test_find_branches_removed(self):
         repos_url = self.make_client("a", "dc")
@@ -401,9 +417,9 @@
         self.client_commit("dc", "remove")
 
         self.assertEqual([("trunk", 1, True)], 
-                list(repos.find_branches(TrunkBranchingScheme(), 1)))
+                list(repos.find_branches(TrunkBranchingScheme(), to_revnum=1)))
         self.assertEqual([("trunk", 1, False)], 
-                list(repos.find_branches(TrunkBranchingScheme(), 2)))
+                list(repos.find_branches(TrunkBranchingScheme(), to_revnum=2)))
 
     def test_url(self):
         """ Test repository URL is kept """
@@ -1204,7 +1220,7 @@
 
     def test_conversion_target_compatible(self):
         self.assertTrue(self.format.check_conversion_target(
-          format_registry.make_bzrdir('dirstate-with-subtree').repository_format))
+          format_registry.make_bzrdir('rich-root').repository_format))
 
 
 class MetadataMarshallerTests(TestCase):

=== modified file 'tests/test_revids.py'
--- a/tests/test_revids.py	2007-07-21 17:07:01 +0000
+++ b/tests/test_revids.py	2007-12-06 15:54:08 +0000
@@ -27,6 +27,12 @@
     def test_create(self):
         revidmap = RevidMap()
 
+    def test_lookup_revids_seen(self):
+        revidmap = RevidMap()
+        self.assertEquals(0, revidmap.last_revnum_checked("trunk"))
+        revidmap.set_last_revnum_checked("trunk", 45)
+        self.assertEquals(45, revidmap.last_revnum_checked("trunk"))
+
     def test_lookup_revid_nonexistant(self):
         revidmap = RevidMap()
         self.assertRaises(NoSuchRevision, lambda: revidmap.lookup_revid("bla"))

=== modified file 'tests/test_revspec.py'
--- a/tests/test_revspec.py	2007-11-15 21:57:33 +0000
+++ b/tests/test_revspec.py	2007-11-15 22:33:53 +0000
@@ -65,6 +65,18 @@
 
         self.assertRaises(InvalidRevisionSpec, revspec._match_on, branch, None)
 
+    def test_oor_revnum(self):
+        """Out-of-range revnum."""
+        revspec = RevisionSpec.from_string("svn:24")
+        repos_url = self.make_client("a", "dc")
+        self.build_tree({"dc/bar": "bar"})
+        self.client_add("dc/bar")
+        self.client_commit("dc", "msg2")
+
+        branch = Branch.open(repos_url)
+
+        self.assertRaises(InvalidRevisionSpec, revspec._match_on, branch, None)
+
     def test_non_svn_branch(self):
         revspec = RevisionSpec.from_string("svn:0")
         branch = BzrDir.create_standalone_workingtree("a").branch




More information about the bazaar-commits mailing list