Rev 429: Merge upstream. in file:///home/jelmer/bzr-svn/customrevids/

Jelmer Vernooij jelmer at samba.org
Wed May 16 14:43:11 BST 2007


At file:///home/jelmer/bzr-svn/customrevids/

------------------------------------------------------------
revno: 429
revision-id: jelmer at samba.org-20070516134309-1kmi1dajlhf8rf01
parent: jelmer at samba.org-20070416232957-4p8w07zrz9fgjk96
parent: jelmer at samba.org-20070516133028-ykjexckioosx0vtn
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: customrevids
timestamp: Wed 2007-05-16 14:43:09 +0100
message:
  Merge upstream.
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
  checkout.py                    workingtree.py-20060306120941-b083cb0fdd4a69de
  errors.py                      errors.py-20061226172623-w1sbj8ynpo0eojqp-1
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  format.py                      format.py-20060406233823-b6fa009fe35dfde7
  mapping.txt                    mapping.txt-20060625151311-9ghaqrm71ajq593n-1
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
  revids.py                      revids.py-20070416220458-36vfa0730cchevp1-1
  tests/test_commit.py           test_commit.py-20060624213521-l5kcufywkh9mnilk-1
  tests/test_errors.py           test_errors.py-20070129114605-ban03f32t6ja14ez-1
  tests/test_logwalker.py        test_logwalker.py-20060622141944-pkocc3rj8g62ukbi-1
  tests/test_radir.py            test_radir.py-20061231173434-31utf9o4byu7wktm-1
  tests/test_repos.py            test_repos.py-20060508151940-ddc49a59257ca712
  tests/test_workingtree.py      test_workingtree.py-20060622191524-0di7bc3q1ckdbybb-1
    ------------------------------------------------------------
    revno: 421.1.32
    merged: jelmer at samba.org-20070516133028-ykjexckioosx0vtn
    parent: jelmer at samba.org-20070516132803-atj347dynttwtwvv
    parent: jelmer at samba.org-20070516105310-6ebfp4439v18qfqg
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: main
    timestamp: Wed 2007-05-16 14:30:28 +0100
    message:
      Merge the 0.3 branch.
        ------------------------------------------------------------
        revno: 402.1.47
        merged: jelmer at samba.org-20070516105310-6ebfp4439v18qfqg
        parent: jelmer at samba.org-20070505140230-7rlcyyelnr15sygw
        committer: Jelmer Vernooij <jelmer at samba.org>
        branch nick: 0.3
        timestamp: Wed 2007-05-16 11:53:10 +0100
        message:
          Start 0.3.4.
        ------------------------------------------------------------
        revno: 402.1.46
        merged: jelmer at samba.org-20070505140230-7rlcyyelnr15sygw
        parent: jelmer at samba.org-20070429150201-luf9gqyyscj1ee10
        parent: jelmer at samba.org-20070429155336-748nze9cgmm7vude
        committer: Jelmer Vernooij <jelmer at samba.org>
        branch nick: 0.3
        timestamp: Sat 2007-05-05 16:02:30 +0200
        message:
          Merge 0.3.3 release.
            ------------------------------------------------------------
            revno: 402.1.45.1.1
            tags: bzr-svn-0.3.3
            merged: jelmer at samba.org-20070429155336-748nze9cgmm7vude
            parent: jelmer at samba.org-20070429150201-luf9gqyyscj1ee10
            committer: Jelmer Vernooij <jelmer at samba.org>
            branch nick: 0.3
            timestamp: Sun 2007-04-29 17:53:36 +0200
            message:
              Release 0.3.3
        ------------------------------------------------------------
        revno: 402.1.45
        merged: jelmer at samba.org-20070429150201-luf9gqyyscj1ee10
        parent: jelmer at samba.org-20070425142442-b8gw64dz2nxtw2z1
        parent: jelmer at samba.org-20070426131316-hg3jf00jfksudw36
        committer: Jelmer Vernooij <jelmer at samba.org>
        branch nick: 0.3
        timestamp: Sun 2007-04-29 17:02:01 +0200
        message:
          merge offline revisions.
            ------------------------------------------------------------
            revno: 402.1.44.1.1
            merged: jelmer at samba.org-20070426131316-hg3jf00jfksudw36
            parent: jelmer at samba.org-20070425142442-b8gw64dz2nxtw2z1
            committer: Jelmer Vernooij <jelmer at samba.org>
            branch nick: 0.3
            timestamp: Thu 2007-04-26 15:13:16 +0200
            message:
              Fix compatibility with latest bzr.dev.
        ------------------------------------------------------------
        revno: 402.1.44
        merged: jelmer at samba.org-20070425142442-b8gw64dz2nxtw2z1
        parent: jelmer at samba.org-20070415161300-w8q2nd1f32e4ik16
        committer: Jelmer Vernooij <jelmer at samba.org>
        branch nick: 0.3
        timestamp: Wed 2007-04-25 16:24:42 +0200
        message:
          Fix no working tree warning.
    ------------------------------------------------------------
    revno: 421.1.31
    merged: jelmer at samba.org-20070516132803-atj347dynttwtwvv
    parent: jelmer at samba.org-20070516091932-yfr4vawpgkhhl4my
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: main
    timestamp: Wed 2007-05-16 14:28:03 +0100
    message:
      Fix mainline_revision_parent().
    ------------------------------------------------------------
    revno: 421.1.30
    merged: jelmer at samba.org-20070516091932-yfr4vawpgkhhl4my
    parent: jelmer at samba.org-20070516091151-5cnstft757privhr
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: main
    timestamp: Wed 2007-05-16 10:19:32 +0100
    message:
      Clarify what is considered a revision and what isn't.
    ------------------------------------------------------------
    revno: 421.1.29
    merged: jelmer at samba.org-20070516091151-5cnstft757privhr
    parent: jelmer at samba.org-20070515225541-s3qdlzaz6tzdl99o
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: main
    timestamp: Wed 2007-05-16 10:11:51 +0100
    message:
      Make sure a correct exception is raised if get_revision_paths() 
      receives an invalid revision number.
    ------------------------------------------------------------
    revno: 421.1.28
    merged: jelmer at samba.org-20070515225541-s3qdlzaz6tzdl99o
    parent: jelmer at samba.org-20070507163704-l1vvahgstjknx1sg
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: main
    timestamp: Tue 2007-05-15 23:55:41 +0100
    message:
      Mark as compatibile with 0.17
    ------------------------------------------------------------
    revno: 421.1.27
    merged: jelmer at samba.org-20070507163704-l1vvahgstjknx1sg
    parent: jelmer at samba.org-20070505141653-lzcfl8um8utc7yyc
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Mon 2007-05-07 18:37:04 +0200
    message:
      Fix tests when using custom global ignores setting in ~/.subversion/config.
    ------------------------------------------------------------
    revno: 421.1.26
    merged: jelmer at samba.org-20070505141653-lzcfl8um8utc7yyc
    parent: jelmer at samba.org-20070502115715-4o1dliyaye1a6a3n
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: main
    timestamp: Sat 2007-05-05 16:16:53 +0200
    message:
      Convert working copy locking errors to Bazaar errors.
    ------------------------------------------------------------
    revno: 421.1.25
    merged: jelmer at samba.org-20070502115715-4o1dliyaye1a6a3n
    parent: jelmer at samba.org-20070502005238-juqk20xhks8t6501
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: main
    timestamp: Wed 2007-05-02 13:57:15 +0200
    message:
      Reproduce mwh bug with a simpler test function.
    ------------------------------------------------------------
    revno: 421.1.24
    merged: jelmer at samba.org-20070502005238-juqk20xhks8t6501
    parent: jelmer at samba.org-20070415161553-4s5vprta60mch70r
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: main
    timestamp: Wed 2007-05-02 02:52:38 +0200
    message:
      Try to fix a bug found by mwh's test.
=== modified file 'NEWS'
--- a/NEWS	2007-04-15 16:15:53 +0000
+++ b/NEWS	2007-05-16 13:30:28 +0000
@@ -24,14 +24,20 @@
      This should reduce the number of roundtrips significantly when 
 	 finding file id mappings.
 
-bzr-svn 0.3.3	UNRELEASED
+bzr-svn 0.3.4	UNRELEASED
+
+bzr-svn 0.3.3	2007-04-29
 
   IMPROVEMENTS
 
+  * Fix compatibility with 0.16 (#110164)
+
   * Don't do extra checkout before push if possible. (#91885)
 
   * Set parent URLs in svn-import. (#94406)
 
+  * Don't show "not updating working tree" warnings when pushing.
+
 bzr-svn 0.3.2	2007-03-13
 
   BUG FIXES

=== modified file '__init__.py'
--- a/__init__.py	2007-03-25 18:41:40 +0000
+++ b/__init__.py	2007-05-16 13:30:28 +0000
@@ -25,7 +25,7 @@
 from bzrlib.trace import warning
 
 __version__ = '0.4.0'
-COMPATIBLE_BZR_VERSIONS = [(0, 15), (0, 16)]
+COMPATIBLE_BZR_VERSIONS = [(0, 15), (0, 16), (0, 17)]
 
 def check_bzrlib_version(desired):
     """Check that bzrlib is compatible.

=== modified file 'checkout.py'
--- a/checkout.py	2007-04-16 23:29:57 +0000
+++ b/checkout.py	2007-05-16 13:43:09 +0000
@@ -635,7 +635,7 @@
     def clone(self, path, revision_id=None, force_new_repo=False):
         raise NotImplementedError(self.clone)
 
-    def open_workingtree(self, _unsupported=False):
+    def open_workingtree(self, _unsupported=False, recommend_upgrade=False):
         return SvnWorkingTree(self, self.local_path, self.open_branch())
 
     def sprout(self, url, revision_id=None, force_new_repo=False, 

=== modified file 'errors.py'
--- a/errors.py	2007-03-17 21:25:43 +0000
+++ b/errors.py	2007-05-05 14:16:53 +0000
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from bzrlib.errors import BzrError, ConnectionReset
+from bzrlib.errors import BzrError, ConnectionReset, LockError
 
 import svn.core
 
@@ -32,6 +32,8 @@
 
     if num == svn.core.SVN_ERR_RA_SVN_CONNECTION_CLOSED:
         return ConnectionReset(msg=msg)
+    elif num == svn.core.SVN_ERR_WC_LOCKED:
+        return LockError(message=msg)
     else:
         return err
 

=== modified file 'fetch.py'
--- a/fetch.py	2007-03-25 19:50:45 +0000
+++ b/fetch.py	2007-05-02 00:52:38 +0000
@@ -321,6 +321,7 @@
         parents = {}
         for (branch, revnum) in self.source.follow_history(
                                                 self.source._latest_revnum):
+            mutter('br, revnum: %r, %r' % (branch, revnum))
             revid = self.source.generate_revision_id(revnum, branch)
             parents[revid] = self.source._mainline_revision_parent(branch, 
                                                                    revnum)

=== modified file 'format.py'
--- a/format.py	2007-04-15 16:15:53 +0000
+++ b/format.py	2007-05-16 13:30:28 +0000
@@ -15,7 +15,8 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 from bzrlib.bzrdir import BzrDirFormat, BzrDir
-from bzrlib.errors import NotBranchError, NotLocalUrl, NoRepositoryPresent
+from bzrlib.errors import (NotBranchError, NotLocalUrl, NoRepositoryPresent,
+                           NoWorkingTree)
 from bzrlib.lockable_files import TransportLock
 from bzrlib.transport.local import LocalTransport
 
@@ -102,14 +103,15 @@
             transport = SvnRaTransport(self.svn_root_url)
         return SvnRepository(self, transport)
 
-    def open_workingtree(self):
+    def open_workingtree(self, _unsupported=False,
+            recommend_upgrade=True):
         """See BzrDir.open_workingtree().
 
         Will always raise NotLocalUrl as this 
         BzrDir can not be associated with working trees.
         """
         # Working trees never exist on remote Subversion repositories
-        raise NotLocalUrl(self.root_transport.base)
+        raise NoWorkingTree(self.root_transport.base)
 
     def create_workingtree(self, revision_id=None):
         """See BzrDir.create_workingtree().

=== modified file 'mapping.txt'
--- a/mapping.txt	2007-04-14 18:00:15 +0000
+++ b/mapping.txt	2007-05-16 13:43:09 +0000
@@ -80,6 +80,11 @@
 in which it was set, as subversion will not erase the property 
 for subsequent commits.
 
+A (path,revnum) tuple is valid if:
+* path is valid according to the branching scheme
+* either path,revnum or one of its children was touched in the particular 
+  revision
+
 == File ids ==
 
 Subversion does not use file ids. It is not possible to know whether a file in 

=== modified file 'repository.py'
--- a/repository.py	2007-04-16 23:29:57 +0000
+++ b/repository.py	2007-05-16 13:43:09 +0000
@@ -53,7 +53,6 @@
 SVN_REVPROP_BZR_SIGNATURE = 'bzr:gpg-signature'
 SVN_PROP_BZR_REVISION_ID = 'bzr:revision-id-v%d' % MAPPING_VERSION
 
-
 def svk_feature_to_revision_id(feature):
     """Create a revision id from a svk feature identifier.
 
@@ -260,10 +259,23 @@
     def _mainline_revision_parent(self, path, revnum):
         assert isinstance(path, basestring)
         assert isinstance(revnum, int)
-        for (branch, rev) in self.follow_branch(path, revnum):
-            if rev < revnum:
-                return self.generate_revision_id(rev, branch)
-        return None
+
+        if not self.scheme.is_branch(path) and \
+           not self.scheme.is_tag(path):
+            raise NoSuchRevision(self, self.generate_revision_id(revnum, path))
+
+        it = self.follow_branch(path, revnum)
+        # the first tuple returned should match the one specified. 
+        # if it's not, then the branch, revnum didn't change in the specified 
+        # revision and so it is invalid
+        if (path, revnum) != it.next():
+            raise NoSuchRevision(self, self.generate_revision_id(revnum, path))
+        try:
+            (branch, rev) = it.next()
+            return self.generate_revision_id(rev, branch)
+        except StopIteration:
+            # The specified revision was the first one in the branch
+            return None
 
     def revision_parents(self, revision_id, merged_data=None):
         parent_ids = []
@@ -391,13 +403,30 @@
         return bzrlib.xml5.serializer_v5.write_inventory_to_string(
             self.get_inventory(revision_id))
 
+    """Get the sha1 for the XML representation of an inventory.
+
+    :param revision_id: Revision id of the inventory for which to return the 
+        SHA1.
+    :return: XML string
+    """
     def get_inventory_sha1(self, revision_id):
         return osutils.sha_string(self.get_inventory_xml(revision_id))
 
+    """Return the XML representation of a revision.
+
+    :param revision_id: Revision for which to return the XML.
+    :return: XML string
+    """
     def get_revision_xml(self, revision_id):
         return bzrlib.xml5.serializer_v5.write_revision_to_string(
             self.get_revision(revision_id))
 
+    """Yield all the branches found between the start of history 
+    and a specified revision number.
+
+    :param revnum: Revision number up to which to search.
+    :return: iterator over branches in the range 0..revnum
+    """
     def follow_history(self, revnum):
         while revnum >= 0:
             yielded_paths = []
@@ -407,12 +436,20 @@
                     bp = self.scheme.unprefix(p)[0]
                     if not bp in yielded_paths:
                         if not paths.has_key(bp) or paths[bp][0] != 'D':
+                            assert revnum > 0 or bp == ""
                             yield (bp, revnum)
                         yielded_paths.append(bp)
                 except NotBranchError:
                     pass
             revnum -= 1
 
+    """Follow the history of a branch. Will yield all the 
+    left-hand side ancestors of a specified revision.
+    
+    :param branch_path: Subversion path to search.
+    :param revnum: Revision number in Subversion to start.
+    :return: iterator over the ancestors
+    """
     def follow_branch(self, branch_path, revnum):
         assert branch_path is not None
         assert isinstance(revnum, int) and revnum >= 0
@@ -422,14 +459,27 @@
         branch_path = branch_path.strip("/")
 
         while revnum >= 0:
-            paths = self._log.get_revision_paths(revnum, branch_path)
-            if paths == {}:
-                revnum -= 1
-                continue
-            yield (branch_path, revnum)
-            # FIXME: what if one of the parents of branch_path was moved?
+            paths = self._log.get_revision_paths(revnum)
+
+            yielded = False
+            # If something underneath branch_path changed, there is a 
+            # revision there, so yield it.
+            for p in paths:
+                if p.startswith(branch_path+"/") or branch_path == "":
+                    yield (branch_path, revnum)
+                    yielded = True
+                    break
+            
+            # If there are no special cases, just go try the 
+            # next revnum in history
+            revnum -= 1
+
+            # Make sure we get the right location for next time, if 
+            # the branch itself was copied
             if (paths.has_key(branch_path) and 
                 paths[branch_path][0] in ('R', 'A')):
+                if not yielded:
+                    yield (branch_path, revnum+1)
                 if paths[branch_path][1] is None:
                     return
                 if not self.scheme.is_branch(paths[branch_path][1]) and \
@@ -441,8 +491,27 @@
                 revnum = paths[branch_path][2]
                 branch_path = paths[branch_path][1]
                 continue
-            revnum -= 1
-
+            
+            # Make sure we get the right location for the next time if 
+            # one of the parents changed
+
+            # Path names need to be sorted so the longer paths 
+            # override the shorter ones
+            path_names = paths.keys()
+            path_names.sort()
+            for p in path_names:
+                if branch_path.startswith(p+"/"):
+                    assert paths[p][1] is not None and paths[p][0] in ('A', 'R'), "Parent didn't exist yet, but child wasn't added !?"
+
+                    revnum = paths[p][2]
+                    branch_path = paths[p][1] + branch_path[len(p):]
+
+    """Return all the changes that happened in a branch 
+    between branch_path and revnum. 
+
+    :return: iterator that returns tuples with branch path, 
+    changed paths and revision number.
+    """
     def follow_branch_history(self, branch_path, revnum):
         assert branch_path is not None
         if not self.scheme.is_branch(branch_path) and \
@@ -450,7 +519,6 @@
             raise errors.NotSvnBranchPath(branch_path, revnum)
 
         for (bp, paths, revnum) in self._log.follow_path(branch_path, revnum):
-            # FIXME: what if one of the parents of branch_path was moved?
             if (paths.has_key(bp) and 
                 paths[bp][1] is not None and 
                 not self.scheme.is_branch(paths[bp][1]) and
@@ -468,11 +536,22 @@
                      
             yield (bp, paths, revnum)
 
+    """Check whether a signature exists for a particular revision id.
+
+    :param revision_id: Revision id for which the signatures should be looked up.
+    :return: False, as no signatures are stored for revisions in Subversion 
+        at the moment.
+    """
     def has_signature_for_revision_id(self, revision_id):
         # TODO: Retrieve from SVN_PROP_BZR_SIGNATURE 
         return False # SVN doesn't store GPG signatures. Perhaps 
                      # store in SVN revision property?
 
+    """Return the signature text for a particular revision.
+
+    :param revision_id: Id of the revision for which to return the signature.
+    :raises NoSuchRevision: Always
+    """
     def get_signature_text(self, revision_id):
         # TODO: Retrieve from SVN_PROP_BZR_SIGNATURE 
         # SVN doesn't store GPG signatures

=== modified file 'revids.py'
--- a/revids.py	2007-04-16 23:29:57 +0000
+++ b/revids.py	2007-05-16 13:43:09 +0000
@@ -66,7 +66,8 @@
     assert isinstance(revnum, int)
     assert isinstance(path, basestring)
     assert revnum >= 0
-    assert revnum > 0 or path == ""
+    assert revnum > 0 or path == "", \
+            "Trying to generate revid for (%r,%r)" % (path, revnum)
     return "%s%s:%s:%s:%d" % (REVISION_ID_PREFIX, scheme, uuid, \
                    escape_svn_path(path.strip("/")), revnum)
 

=== modified file 'tests/test_commit.py'
--- a/tests/test_commit.py	2007-04-16 01:30:09 +0000
+++ b/tests/test_commit.py	2007-05-16 13:43:09 +0000
@@ -123,31 +123,31 @@
             self.client_update('sc')
         self.build_tree({'sc/de/foo':'data', 'sc/de/bar':'DATA'})
         self.client_add('sc/de')
-        self.client_commit('sc', 'blah')
+        self.client_commit('sc', 'blah') #1
         self.client_update('sc')
         os.mkdir('sc/de/trunk')
         self.client_add('sc/de/trunk')
-        mv(('sc/de/foo', 'sc/de/trunk'), ('sc/de/bar', 'sc/de/trunk'))
-        mv(('sc/de', 'sc/pyd')) 
+        mv(('sc/de/foo', 'sc/de/trunk'), ('sc/de/bar', 'sc/de/trunk')) #2
+        mv(('sc/de', 'sc/pyd'))  #3
         self.client_delete('sc/pyd/trunk/foo')
-        self.client_commit('sc', '.')
+        self.client_commit('sc', '.') #4
         self.client_update('sc')
 
         self.make_checkout(repo + '/pyd/trunk', 'pyd')
-        assert open('pyd/bar').read() == 'DATA'
+        self.assertEqual("DATA", open('pyd/bar').read())
 
         olddir = BzrDir.open("pyd")
         os.mkdir('bc')
         newdir = olddir.sprout("bc")
         newdir.open_branch().pull(olddir.open_branch())
         wt = newdir.open_workingtree()
-        assert open('bc/bar').read() == 'DATA'
+        self.assertEqual("DATA", open('bc/bar').read())
         open('bc/bar', 'w').write('data')
         wt.commit(message="Commit from Bzr")
         olddir.open_branch().pull(newdir.open_branch())
 
         self.client_update('pyd')
-        assert open('pyd/bar').read() == 'data'
+        self.assertEqual("data", open('pyd/bar').read())
         
 
 class TestPush(TestCaseWithSubversionRepository):

=== modified file 'tests/test_errors.py'
--- a/tests/test_errors.py	2007-01-31 12:54:40 +0000
+++ b/tests/test_errors.py	2007-05-05 14:16:53 +0000
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from bzrlib.errors import ConnectionReset
+from bzrlib.errors import ConnectionReset, LockError
 from bzrlib.tests import TestCase
 
 from errors import convert_svn_error, convert_error
@@ -44,6 +44,9 @@
     def test_convert_error_reset(self):
         self.assertIsInstance(convert_error(SubversionException(svn.core.SVN_ERR_RA_SVN_CONNECTION_CLOSED, "Connection closed")), ConnectionReset)
 
+    def test_convert_error_lock(self):
+        self.assertIsInstance(convert_error(SubversionException(svn.core.SVN_ERR_WC_LOCKED, "Working copy locked")), LockError)
+
     def test_decorator_nothrow(self):
         @convert_svn_error
         def test_nothrow(foo):

=== modified file 'tests/test_logwalker.py'
--- a/tests/test_logwalker.py	2007-03-25 18:41:40 +0000
+++ b/tests/test_logwalker.py	2007-05-16 09:11:51 +0000
@@ -56,6 +56,11 @@
         walker = logwalker.LogWalker(SvnRaTransport(repos_url))
         self.assertEqual({'': ('A', None, -1)}, walker.get_revision_paths(0))
 
+    def test_get_revision_paths_invalid(self):
+        repos_url = self.make_client("a", "dc")
+        walker = logwalker.LogWalker(SvnRaTransport(repos_url))
+        self.assertRaises(NoSuchRevision, lambda: walker.get_revision_paths(42))
+
     def test_get_branch_invalid_revision(self):
         repos_url = self.make_client("a", "dc")
         walker = logwalker.LogWalker(transport=SvnRaTransport(repos_url))

=== modified file 'tests/test_radir.py'
--- a/tests/test_radir.py	2007-03-28 04:00:14 +0000
+++ b/tests/test_radir.py	2007-05-16 13:30:28 +0000
@@ -15,7 +15,8 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 from bzrlib.bzrdir import BzrDir
-from bzrlib.errors import NoRepositoryPresent, NotBranchError, NotLocalUrl
+from bzrlib.errors import (NoRepositoryPresent, NotBranchError, NotLocalUrl,
+                           NoWorkingTree)
 
 from tests import TestCaseWithSubversionRepository
 
@@ -31,7 +32,12 @@
     def test_open_workingtree(self):
         repos_url = self.make_client("d", "dc")
         x = BzrDir.open(repos_url)
-        self.assertRaises(NotLocalUrl, x.open_workingtree)
+        self.assertRaises(NoWorkingTree, x.open_workingtree)
+
+    def test_open_workingtree_recommend_arg(self):
+        repos_url = self.make_client("d", "dc")
+        x = BzrDir.open(repos_url)
+        self.assertRaises(NoWorkingTree, lambda: x.open_workingtree(recommend_upgrade=True))
 
     def test_create_workingtree(self):
         repos_url = self.make_client("d", "dc")

=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py	2007-04-16 23:29:57 +0000
+++ b/tests/test_repos.py	2007-05-16 13:43:09 +0000
@@ -137,6 +137,21 @@
             repos.generate_revision_id(1, "trunk")], 
             list(repos.all_revision_ids()))
 
+    def test_follow_history_empty(self):
+        repos_url = self.make_client("a", "dc")
+        self.assertEqual([('', 0)], 
+                list(Repository.open(repos_url).follow_history(0)))
+
+    def test_follow_history_empty_branch(self):
+        repos_url = self.make_client("a", "dc")
+        self.build_tree({'dc/trunk/afile': "data", "dc/branches": None})
+        self.client_add("dc/trunk")
+        self.client_add("dc/branches")
+        self.client_commit("dc", "My Message")
+        repos = Repository.open(repos_url)
+        repos.set_branching_scheme(TrunkBranchingScheme())
+        self.assertEqual([('trunk', 1)], list(repos.follow_history(1)))
+
     def test_follow_history_follow(self):
         repos_url = self.make_client("a", "dc")
         self.build_tree({'dc/trunk/afile': "data", "dc/branches": None})
@@ -2006,6 +2021,92 @@
         repos = Repository.open(repos_url)
         repos.set_branching_scheme(NoBranchingScheme())
 
+    def test_mainline_revision_parent_null(self):
+        repos_url = self.make_client('d', 'dc')
+        repos = Repository.open(repos_url)
+        repos.set_branching_scheme(NoBranchingScheme())
+        self.assertEquals(None, repos._mainline_revision_parent("", 0))
+
+    def test_mainline_revision_parent_first(self):
+        repos_url = self.make_client('d', 'dc')
+        repos = Repository.open(repos_url)
+        repos.set_branching_scheme(NoBranchingScheme())
+        self.build_tree({'dc/adir/afile': "data"})
+        self.client_add("dc/adir")
+        self.client_commit("dc", "Initial commit")
+        self.assertEquals(repos.generate_revision_id(0, ""), \
+                repos._mainline_revision_parent("", 1))
+
+    def test_mainline_revision_parent_simple(self):
+        repos_url = self.make_client('d', 'dc')
+        self.build_tree({'dc/trunk/adir/afile': "data", 
+                         'dc/trunk/adir/stationary': None,
+                         'dc/branches/abranch': None})
+        self.client_add("dc/trunk")
+        self.client_add("dc/branches")
+        self.client_commit("dc", "Initial commit")
+        self.build_tree({'dc/trunk/adir/afile': "bla"})
+        self.client_commit("dc", "Incremental commit")
+        repos = Repository.open(repos_url)
+        repos.set_branching_scheme(TrunkBranchingScheme())
+        self.assertEquals(repos.generate_revision_id(1, "trunk"), \
+                repos._mainline_revision_parent("trunk", 2))
+
+    def test_mainline_revision_parent_copied(self):
+        repos_url = self.make_client('d', 'dc')
+        self.build_tree({'dc/py/trunk/adir/afile': "data", 
+                         'dc/py/trunk/adir/stationary': None})
+        self.client_add("dc/py")
+        self.client_commit("dc", "Initial commit")
+        self.client_copy("dc/py", "dc/de")
+        self.client_commit("dc", "Incremental commit")
+        self.build_tree({'dc/de/trunk/adir/afile': "bla"})
+        self.client_commit("dc", "Change de")
+        repos = Repository.open(repos_url)
+        repos.set_branching_scheme(TrunkBranchingScheme(1))
+        self.assertEquals(repos.generate_revision_id(1, "py/trunk"), \
+                repos._mainline_revision_parent("de/trunk", 3))
+
+    def test_mainline_revision_copied(self):
+        repos_url = self.make_client('d', 'dc')
+        self.build_tree({'dc/py/trunk/adir/afile': "data", 
+                         'dc/py/trunk/adir/stationary': None})
+        self.client_add("dc/py")
+        self.client_commit("dc", "Initial commit")
+        self.build_tree({'dc/de':None})
+        self.client_add("dc/de")
+        self.client_copy("dc/py/trunk", "dc/de/trunk")
+        self.client_commit("dc", "Copy trunk")
+        repos = Repository.open(repos_url)
+        repos.set_branching_scheme(TrunkBranchingScheme(1))
+        self.assertEquals(repos.generate_revision_id(1, "py/trunk"), \
+                repos._mainline_revision_parent("de/trunk", 2))
+
+    def test_mainline_revision_nested_deleted(self):
+        repos_url = self.make_client('d', 'dc')
+        self.build_tree({'dc/py/trunk/adir/afile': "data", 
+                         'dc/py/trunk/adir/stationary': None})
+        self.client_add("dc/py")
+        self.client_commit("dc", "Initial commit")
+        self.client_copy("dc/py", "dc/de")
+        self.client_commit("dc", "Incremental commit")
+        self.client_delete("dc/de/trunk/adir")
+        self.client_commit("dc", "Another incremental commit")
+        repos = Repository.open(repos_url)
+        repos.set_branching_scheme(TrunkBranchingScheme(1))
+        self.assertEquals(repos.generate_revision_id(1, "py/trunk"), \
+                repos._mainline_revision_parent("de/trunk", 3))
+
+    def test_mainline_revision_missing(self):
+        repos_url = self.make_client('d', 'dc')
+        repos = Repository.open(repos_url)
+        self.build_tree({'dc/py/trunk/adir/afile': "data", 
+                         'dc/py/trunk/adir/stationary': None})
+        self.client_add("dc/py")
+        self.client_commit("dc", "Initial commit")
+        self.assertRaises(NoSuchRevision, 
+                lambda: repos._mainline_revision_parent("trunk", 1))
+
     def test_fetch_crosscopy(self):
         repos_url = self.make_client('d', 'dc')
         self.build_tree({'dc/trunk/adir/afile': "data", 

=== modified file 'tests/test_workingtree.py'
--- a/tests/test_workingtree.py	2007-03-28 04:00:14 +0000
+++ b/tests/test_workingtree.py	2007-05-07 16:37:04 +0000
@@ -27,6 +27,7 @@
 
 from fileids import generate_svn_file_id
 from repository import MAPPING_VERSION
+from transport import svn_config
 from tests import TestCaseWithSubversionRepository, RENAMES
 
 class TestWorkingTree(TestCaseWithSubversionRepository):
@@ -114,13 +115,13 @@
     def test_get_ignore_list_empty(self):
         self.make_client('a', 'dc')
         tree = self.open_checkout("dc")
-        self.assertEqual([".svn"] + svn.core.SVN_CONFIG_DEFAULT_GLOBAL_IGNORES.split(" "), tree.get_ignore_list())
+        self.assertEqual([".svn"] + svn.wc.get_default_ignores(svn_config), tree.get_ignore_list())
 
     def test_get_ignore_list_onelevel(self):
         self.make_client('a', 'dc')
         self.client_set_prop("dc", "svn:ignore", "*.d\n*.c\n")
         tree = self.open_checkout("dc")
-        self.assertEqual([".svn"] + svn.core.SVN_CONFIG_DEFAULT_GLOBAL_IGNORES.split(" ") + ["./*.d", "./*.c"], tree.get_ignore_list())
+        self.assertEqual([".svn"] + svn.wc.get_default_ignores(svn_config) + ["./*.d", "./*.c"], tree.get_ignore_list())
 
     def test_get_ignore_list_morelevel(self):
         self.make_client('a', 'dc')
@@ -129,7 +130,7 @@
         self.client_add("dc/x")
         self.client_set_prop("dc/x", "svn:ignore", "*.e\n")
         tree = self.open_checkout("dc")
-        self.assertEqual([".svn"] + svn.core.SVN_CONFIG_DEFAULT_GLOBAL_IGNORES.split(" ") + ["./*.d", "./*.c", "./x/*.e"], tree.get_ignore_list())
+        self.assertEqual([".svn"] + svn.wc.get_default_ignores(svn_config) + ["./*.d", "./*.c", "./x/*.e"], tree.get_ignore_list())
 
     def test_add_reopen(self):
         self.make_client('a', 'dc')




More information about the bazaar-commits mailing list