Rev 444: Merge upstream. in file:///data/jelmer/bzr-svn/nestedtrees/

Jelmer Vernooij jelmer at samba.org
Thu Jul 12 09:53:47 BST 2007


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

------------------------------------------------------------
revno: 444
revision-id: jelmer at samba.org-20070712085346-e8b64qrt4yth0qcr
parent: jelmer at samba.org-20070706160429-qhkibx8b4lllyfg5
parent: jelmer at samba.org-20070712085012-4givggs5uymua380
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: nestedtrees
timestamp: Thu 2007-07-12 11:53:46 +0300
message:
  Merge upstream.
renamed:
  checkout.py => workingtree.py workingtree.py-20060306120941-b083cb0fdd4a69de
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  TODO                           todo-20060729211917-2kpobww0zyvvo0j2-1
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
  logwalker.py                   logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
  mapping.txt                    mapping.txt-20060625151311-9ghaqrm71ajq593n-1
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
  tests/test_checkout.py         test_checkout.py-20070101154110-eevkc29qj0q7udz5-1
  tests/test_push.py             test_push.py-20070201165715-g2ievcdfqi33wqsy-1
  tests/test_repos.py            test_repos.py-20060508151940-ddc49a59257ca712
  tests/test_upgrade.py          test_upgrade.py-20070106170128-64zt3eqggg4tng1c-1
  tests/test_workingtree.py      test_workingtree.py-20060622191524-0di7bc3q1ckdbybb-1
  transport.py                   transport.py-20060406231150-b3472d06b3a0818d
  upgrade.py                     upgrade.py-20070106192108-0rakplee2lzah4gs-1
  workingtree.py                 workingtree.py-20060306120941-b083cb0fdd4a69de
    ------------------------------------------------------------
    revno: 438.1.1.1.82
    revision-id: jelmer at samba.org-20070712085012-4givggs5uymua380
    parent: jelmer at samba.org-20070710150136-roo08q723iiq6k3g
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Thu 2007-07-12 11:50:12 +0300
    message:
      Rename checkout to workingtree, mark 0.4 as being compatible with just 0.18.
    ------------------------------------------------------------
    revno: 438.1.1.1.81
    revision-id: jelmer at samba.org-20070710150136-roo08q723iiq6k3g
    parent: jelmer at samba.org-20070710133459-1gbetnemqb3pgvp1
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Tue 2007-07-10 16:01:36 +0100
    message:
      Update todo.
    ------------------------------------------------------------
    revno: 438.1.1.1.80
    revision-id: jelmer at samba.org-20070710133459-1gbetnemqb3pgvp1
    parent: jelmer at samba.org-20070710032434-q4a4hkcymd1i0ox3
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Tue 2007-07-10 14:34:59 +0100
    message:
      Add -v option to svn-upgrade.
    ------------------------------------------------------------
    revno: 438.1.1.1.79
    revision-id: jelmer at samba.org-20070710032434-q4a4hkcymd1i0ox3
    parent: jelmer at samba.org-20070709164826-v6kgvuded2zl16qx
    parent: jelmer at samba.org-20070705162811-spxhzl1p7xwcfyvj
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Tue 2007-07-10 04:24:34 +0100
    message:
      Merge tets fixes.
        ------------------------------------------------------------
        revno: 438.1.1.1.76.1.1
        revision-id: jelmer at samba.org-20070705162811-spxhzl1p7xwcfyvj
        parent: jelmer at samba.org-20070705103229-tiahwcgwm7lokboq
        committer: Jelmer Vernooij <jelmer at samba.org>
        branch nick: 0.4
        timestamp: Thu 2007-07-05 18:28:11 +0200
        message:
          Fix some tests.
    ------------------------------------------------------------
    revno: 438.1.1.1.78
    revision-id: jelmer at samba.org-20070709164826-v6kgvuded2zl16qx
    parent: jelmer at samba.org-20070708141353-6npnskwaakaak292
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Mon 2007-07-09 17:48:26 +0100
    message:
      Don't be verbose when trying to connect unless -Dtransport was specified. Fixes #124858.
    ------------------------------------------------------------
    revno: 438.1.1.1.77
    revision-id: jelmer at samba.org-20070708141353-6npnskwaakaak292
    parent: jelmer at samba.org-20070705103229-tiahwcgwm7lokboq
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sun 2007-07-08 15:13:53 +0100
    message:
      Update mapping for singlebranchingscheme.
=== renamed file 'checkout.py' => 'workingtree.py'
--- a/checkout.py	2007-06-24 18:14:04 +0000
+++ b/workingtree.py	2007-07-12 08:50:12 +0000
@@ -103,15 +103,6 @@
                                                    svn.wc.get_adm_dir(), 'bzr'))
         self._control_files = LockableFiles(control_transport, 'lock', LockDir)
 
-    def lock_write(self):
-        pass
-
-    def lock_read(self):
-        pass
-
-    def unlock(self):
-        pass
-
     def get_ignore_list(self):
         ignores = set([svn.wc.get_adm_dir()])
         ignores.update(svn.wc.get_default_ignores(svn_config))

=== modified file 'NEWS'
--- a/NEWS	2007-07-03 16:42:54 +0000
+++ b/NEWS	2007-07-10 15:01:36 +0000
@@ -30,12 +30,18 @@
 
    * Consistently treat property changes as actual changes (#122115)
 
+   * Be a bit less verbose when trying to connect (#124858)
+
   PERFORMANCE
 
    * do_update() is now used to find the contents of a directory recursively. 
      This should reduce the number of roundtrips significantly when 
 	 finding file id mappings.
 
+  FEATURES
+   
+   * add -v option to svn-upgrade
+
   INTERNALS
 
    * Implement SvnRaTransport.local_abspath(). (#117090)

=== modified file 'TODO'
--- a/TODO	2007-07-05 02:09:17 +0000
+++ b/TODO	2007-07-10 15:01:36 +0000
@@ -1,3 +1,12 @@
+mandatory before 0.4.0:
+- integrate bzr:merge into bzr:revision-info or rename to bzr:merge-vXXYY
+- splittree support
+- nestedtree support
+
+todo:
+- intelligent guessing of branching scheme
+- be able to create new branches
+- make has_revision() more efficient - just call logwalker.touches_path() ?
 - simplify find_branches by using Transport.list_dir() ?
 - fix autorealm repository
 - avoid extra connect in logwalker?
@@ -5,11 +14,10 @@
 - free memory!
 - report changes to delta editor in Branch.pull()
 - more blackbox tests
-- integrate bzr:merge into bzr:revision-info or rename to bzr:merge-vXXYY
 - transform file ids in workingtree in svn-upgrade
 - more intelligent mechanism for finding branching scheme. Look at directory structure in current tree?
 
-Working trees:
+working trees:
 - custom implementation of WorkingTree.revert() / WorkingTree.merge()
 - add tests for objects returned by WorkingTree.pull(), Branch.pull()
 - what happened to WorkingTree.add() ?
@@ -18,3 +26,7 @@
   also commit the file property changes for the tree root (except 
   for pending merges).														   
 - faster "bzr status"
+
+for other things to do, see:
+
+* https://bugs.launchpad.net/bzr-svn

=== modified file '__init__.py'
--- a/__init__.py	2007-07-06 16:04:29 +0000
+++ b/__init__.py	2007-07-12 08:53:46 +0000
@@ -26,7 +26,7 @@
 from bzrlib.trace import warning, mutter
 
 __version__ = '0.4.0'
-COMPATIBLE_BZR_VERSIONS = [(0, 15), (0, 16), (0, 17), (0, 18)]
+COMPATIBLE_BZR_VERSIONS = [(0, 18)]
 
 def check_bzrlib_version(desired):
     """Check that bzrlib is compatible.
@@ -67,7 +67,7 @@
 import convert
 import format
 import transport
-import checkout
+import workingtree
 
 from bzrlib.transport import register_transport
 register_transport('svn://', transport.SvnRaTransport)
@@ -85,7 +85,7 @@
 import svn.core
 _subr_version = svn.core.svn_subr_version()
 
-BzrDirFormat.register_control_format(checkout.SvnWorkingTreeDirFormat)
+BzrDirFormat.register_control_format(workingtree.SvnWorkingTreeDirFormat)
 
 InterRepository.register_optimiser(InterFromSvnRepository)
 InterRepository.register_optimiser(InterToSvnRepository)
@@ -163,10 +163,10 @@
     were mapped from svn revisions.
     """
     takes_args = ['svn_repository?']
-    takes_options = []
+    takes_options = ['verbose']
 
     @display_command
-    def run(self, svn_repository=None):
+    def run(self, svn_repository=None, verbose=False):
         from upgrade import upgrade_branch
         from bzrlib.errors import NoWorkingTree
         from bzrlib.workingtree import WorkingTree
@@ -190,7 +190,8 @@
         else:
             svn_repository = Repository.open(svn_repository)
 
-        upgrade_branch(branch_to, svn_repository, allow_changes=True)
+        upgrade_branch(branch_to, svn_repository, allow_changes=True, 
+                       verbose=verbose)
 
         if wt_to is not None:
             wt_to.set_last_revision(branch_to.last_revision())

=== modified file 'logwalker.py'
--- a/logwalker.py	2007-07-03 00:31:08 +0000
+++ b/logwalker.py	2007-07-05 16:28:11 +0000
@@ -252,8 +252,11 @@
     def find_children(self, path, revnum):
         """Find all children of path in revnum."""
         path = path.strip("/")
-        if self.transport.check_path(path, revnum) == svn.core.svn_node_file:
+        ft = self.transport.check_path(path, revnum)
+        if ft == svn.core.svn_node_file:
             return []
+        assert ft == svn.core.svn_node_dir
+
         class TreeLister(svn.delta.Editor):
             def __init__(self, base):
                 self.files = []
@@ -296,12 +299,16 @@
         pool = Pool()
         editor = TreeLister(path)
         edit, baton = svn.delta.make_editor(editor, pool)
-        root_repos = self.transport.get_repos_root()
-        self.transport.reparent(os.path.join(root_repos, path))
-        reporter = self.transport.do_update(
-                        revnum, "", True, edit, baton, pool)
-        reporter.set_path("", revnum, True, None, pool)
-        reporter.finish_report(pool)
+        old_base = self.transport.base
+        try:
+            root_repos = self.transport.get_repos_root()
+            self.transport.reparent(os.path.join(root_repos, path))
+            reporter = self.transport.do_update(
+                            revnum, "", True, edit, baton, pool)
+            reporter.set_path("", revnum, True, None, pool)
+            reporter.finish_report(pool)
+        finally:
+            self.transport.reparent(old_base)
         return editor.files
 
     def get_previous(self, path, revnum):

=== modified file 'mapping.txt'
--- a/mapping.txt	2007-06-24 14:08:49 +0000
+++ b/mapping.txt	2007-07-08 14:13:53 +0000
@@ -29,6 +29,9 @@
 - ListBranchingScheme: There is a list of branches. This branching 
   scheme is present in the code, but is never used automatically (yet).
 
+- SingleBranchingScheme: There is a single branch (path of that branch is also 
+	part of the scheme name).
+
 The branching scheme can be explicitly specified or automatically guessed. 
 The guessing algorithm currently works as follows and is based on paths 
 relative to the repository root:
@@ -52,7 +55,7 @@
 including the branch path (trunk, branches/SAMBA_4_0, etc) in the 
 revision-id. Example revision id:
 
-``svn-v3-trunk:0c0555d6-39d7-0310-84fc-f1cc0bd64818:trunk:14323``
+``svn-v3-trunk0:0c0555d6-39d7-0310-84fc-f1cc0bd64818:trunk:14323``
 
 The version number is used to distinguish between versions of the mapping 
 between Bazaar and Subversion. The mapping will change when previously 

=== modified file 'repository.py'
--- a/repository.py	2007-07-04 21:33:40 +0000
+++ b/repository.py	2007-07-05 16:28:11 +0000
@@ -291,11 +291,18 @@
             return True
 
         try:
-            self.lookup_revision_id(revision_id)
-            return True
+            (path, revnum, scheme) = self.lookup_revision_id(revision_id)
         except NoSuchRevision:
             return False
 
+        try:
+            return (svn.core.svn_node_dir == self.transport.check_path(path, revnum))
+        except SubversionException, (_, num):
+            if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
+                return False
+            raise
+
+
     def revision_trees(self, revids):
         """See Repository.revision_trees()."""
         for revid in revids:

=== modified file 'tests/test_checkout.py'
--- a/tests/test_checkout.py	2007-05-17 16:52:31 +0000
+++ b/tests/test_checkout.py	2007-07-12 08:50:12 +0000
@@ -21,7 +21,7 @@
 from bzrlib.tests import TestCase
 
 from convert import SvnConverter
-from checkout import SvnWorkingTreeFormat, SvnWorkingTreeDirFormat
+from workingtree import SvnWorkingTreeFormat, SvnWorkingTreeDirFormat
 from tests import TestCaseWithSubversionRepository
 
 class TestWorkingTreeFormat(TestCase):

=== modified file 'tests/test_push.py'
--- a/tests/test_push.py	2007-06-24 14:08:49 +0000
+++ b/tests/test_push.py	2007-07-12 08:50:12 +0000
@@ -22,7 +22,6 @@
 
 import os
 import format
-import checkout
 import svn.core
 from commit import push_as_merged
 from repository import MAPPING_VERSION, SVN_PROP_BZR_REVISION_ID

=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py	2007-07-06 16:04:29 +0000
+++ b/tests/test_repos.py	2007-07-12 08:53:46 +0000
@@ -369,6 +369,12 @@
         repository = bzrdir.find_repository()
         self.assertTrue(repository.has_revision(None))
 
+    def test_has_revision_future(self):
+        bzrdir = self.make_client_and_bzrdir('d', 'dc')
+        repository = bzrdir.find_repository()
+        self.assertFalse(repository.has_revision(
+            generate_svn_revision_id(repository.uuid, 5, "", "none")))
+
     def test_revision_parents(self):
         repos_url = self.make_client('d', 'dc')
         self.build_tree({'dc/foo': "data"})

=== modified file 'tests/test_upgrade.py'
--- a/tests/test_upgrade.py	2007-07-04 21:23:52 +0000
+++ b/tests/test_upgrade.py	2007-07-05 16:28:11 +0000
@@ -250,7 +250,7 @@
         file("f/a", 'w').write("blackfield")
         wt.commit(message='fix it again', rev_id="anotherrev")
 
-        upgrade_branch(b, oldrepos, allow_change=True)
+        upgrade_branch(b, oldrepos, allow_changes=True)
         self.assertEqual([oldrepos.generate_revision_id(0, "", "none"),
                           oldrepos.generate_revision_id(1, "", "none"),
                           "customrev-svn%d-upgrade" % MAPPING_VERSION,

=== modified file 'tests/test_workingtree.py'
--- a/tests/test_workingtree.py	2007-06-24 18:14:04 +0000
+++ b/tests/test_workingtree.py	2007-07-12 08:50:12 +0000
@@ -56,6 +56,17 @@
         self.assertTrue(inv.has_filename("bl"))
         self.assertFalse(inv.has_filename("aa"))
 
+    def test_smart_add(self):
+        self.make_client('a', 'dc')
+        self.build_tree({"dc/bl": "data"})
+        tree = self.open_checkout("dc")
+        tree.smart_add(["bl"])
+
+        inv = tree.read_working_inventory()
+        self.assertIsInstance(inv, Inventory)
+        self.assertTrue(inv.has_filename("bl"))
+        self.assertFalse(inv.has_filename("aa"))
+
     def test_add_nolist(self):
         self.make_client('a', 'dc')
         self.build_tree({"dc/bl": "data"})

=== modified file 'transport.py'
--- a/transport.py	2007-06-24 17:52:51 +0000
+++ b/transport.py	2007-07-09 16:48:26 +0000
@@ -15,6 +15,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 """Simple transport for accessing Subversion smart servers."""
 
+from bzrlib import debug
 from bzrlib.errors import (NoSuchFile, NotBranchError, TransportNotPossible, 
                            FileExists, NotLocalUrl)
 from bzrlib.trace import mutter
@@ -103,7 +104,8 @@
         self._client.config = svn_config
 
         try:
-            mutter('opening SVN RA connection to %r' % self.svn_url)
+            if 'transport' in debug.debug_flags:
+                mutter('opening SVN RA connection to %r' % self.svn_url)
             self._ra = svn.client.open_ra_session(self.svn_url.encode('utf8'), 
                     self._client, self.pool)
         except SubversionException, (_, num):

=== modified file 'upgrade.py'
--- a/upgrade.py	2007-07-05 10:32:29 +0000
+++ b/upgrade.py	2007-07-12 08:50:12 +0000
@@ -16,7 +16,7 @@
 """Upgrading revisions made with older versions of the mapping."""
 
 from bzrlib.errors import BzrError, InvalidRevisionId
-from bzrlib.trace import mutter
+from bzrlib.trace import info, mutter
 import bzrlib.ui as ui
 
 from errors import RebaseNotPresent
@@ -80,17 +80,17 @@
         return revid + suffix
 
 
-def upgrade_branch(branch, svn_repository, allow_changes=False):
+def upgrade_branch(branch, svn_repository, allow_changes=False, verbose=False):
     """Upgrade a branch to the current mapping version.
     
     :param branch: Branch to upgrade.
     :param svn_repository: Repository to fetch new revisions from
     :param allow_changes: Allow changes in mappings.
+    :param verbose: Whether to print verbose list of rewrites
     """
     revid = branch.last_revision()
     renames = upgrade_repository(branch.repository, svn_repository, 
-              revid, allow_changes)
-    mutter('renames %r' % renames)
+              revid, allow_changes=allow_changes, verbose=verbose)
     if len(renames) > 0:
         branch.generate_revision_history(renames[revid])
 
@@ -108,18 +108,19 @@
 
 
 def upgrade_repository(repository, svn_repository, revision_id=None, 
-                       allow_change=False):
+                       allow_changes=False, verbose=False):
     """Upgrade the revisions in repository until the specified stop revision.
 
     :param repository: Repository in which to upgrade.
     :param svn_repository: Repository to fetch new revisions from.
     :param revision_id: Revision id up until which to upgrade, or None for 
                         all revisions.
-    :param allow_change: Allow changes to mappings.
+    :param allow_changes: Allow changes to mappings.
+    :param verbose: Whether to print list of rewrites
     :return: Dictionary of mapped revisions
     """
     try:
-        from bzrlib.plugins.rebase.rebase import replay_snapshot, generate_transpose_plan, rebase
+        from bzrlib.plugins.rebase.rebase import replay_snapshot, generate_transpose_plan, rebase, rebase_todo
     except ImportError, e:
         raise RebaseNotPresent(e)
     rename_map = {}
@@ -153,7 +154,7 @@
                         mutter("Remote repository doesn't have %r" % newrevid)
                     continue
                 rename_map[revid] = newrevid
-                if not allow_change:
+                if not allow_changes:
                     oldrev = repository.get_revision(revid)
                     newrev = svn_repository.get_revision(newrevid)
                     check_revision_changed(oldrev, newrev)
@@ -166,8 +167,10 @@
                 repository.fetch(svn_repository, revid)
 
         plan = generate_transpose_plan(repository, graph, rename_map, 
-                                       lambda rev: create_upgraded_revid(rev.revision_id))
-        mutter('rebase plan: %r' % plan)
+                           lambda rev: create_upgraded_revid(rev.revision_id))
+        if verbose:
+            for revid in rebase_todo(repository, plan):
+                info("%s -> %s" % (revid, plan[revid][0]))
         rebase(repository, plan, replay_snapshot)
         def remove_parents((oldrevid, (newrevid, parents))):
             return (oldrevid, newrevid)




More information about the bazaar-commits mailing list