Rev 1233: Support get_parent_ids() rather than pending_merges(), which has been removed. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4/

Jelmer Vernooij jelmer at samba.org
Tue Jun 17 20:53:52 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/0.4/

------------------------------------------------------------
revno: 1233
revision-id: jelmer at samba.org-20080617195350-opqh4swky27h0ky7
parent: jelmer at samba.org-20080616172701-z1mb62so2euf64rp
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Tue 2008-06-17 21:53:50 +0200
message:
  Support get_parent_ids() rather than pending_merges(), which has been removed.
modified:
  ra.py                          ra.py-20080615005305-t5221niknu8rm6bt-1
  tests/test_workingtree.py      test_workingtree.py-20060622191524-0di7bc3q1ckdbybb-1
  workingtree.py                 workingtree.py-20060306120941-b083cb0fdd4a69de
=== modified file 'ra.py'
--- a/ra.py	2008-06-16 17:27:01 +0000
+++ b/ra.py	2008-06-17 19:53:50 +0000
@@ -168,7 +168,7 @@
                     self._client)
         except SubversionException, (_, num):
             if num == svn_errors.ERR_RA_SVN_REPOS_NOT_FOUND:
-                raise NoSvnRepositoryPresent(url=url)
+                raise svn_errors.NoSvnRepositoryPresent(url=url)
             if num == svn_errors.ERR_BAD_URL:
                 raise InvalidURL(url)
             raise

=== modified file 'tests/test_workingtree.py'
--- a/tests/test_workingtree.py	2008-06-15 02:48:51 +0000
+++ b/tests/test_workingtree.py	2008-06-17 19:53:50 +0000
@@ -17,6 +17,7 @@
 
 """Working tree tests."""
 
+from bzrlib.branch import Branch
 from bzrlib.bzrdir import BzrDir
 from bzrlib.errors import NoSuchFile, OutOfDateTree
 from bzrlib.inventory import Inventory
@@ -330,11 +331,11 @@
         self.assertFalse(inv.has_filename("bl"))
         self.assertFalse(basis_inv.has_filename("dir/bl"))
 
-    def test_pending_merges_empty(self):
-        self.make_client('a', 'dc')
+    def test_get_parent_ids_no_merges(self):
+        repos_url = self.make_client('a', 'dc')
         self.build_tree({"dc/bl": "data"})
         tree = self.open_checkout("dc")
-        self.assertEqual([], tree.pending_merges())
+        self.assertEqual([Branch.open(repos_url).last_revision()], tree.get_parent_ids())
  
     def test_delta(self):
         self.make_client('a', 'dc')
@@ -442,15 +443,17 @@
         self.assertEqual('symlink', inv[inv.path2id("bla")].kind)
         self.assertEqual("target", inv[inv.path2id("bla")].symlink_target)
 
-    def test_pending_merges(self):
-        self.make_client('a', 'dc')
+    def test_get_parent_ids(self):
+        repos_url = self.make_client('a', 'dc')
         self.build_tree({"dc/bl": None})
 
+        lhs_parent_id = Branch.open(repos_url).last_revision()
+
         tree = self.open_checkout("dc")
         tree.set_pending_merges(["a", "c"])
-        self.assertEqual(["a", "c"], tree.pending_merges())
+        self.assertEqual([lhs_parent_id, "a", "c"], tree.get_parent_ids())
         tree.set_pending_merges([])
-        self.assertEqual([], tree.pending_merges())
+        self.assertEqual([lhs_parent_id], tree.get_parent_ids())
 
     def test_set_pending_merges_prop(self):
         self.make_client('a', 'dc')

=== modified file 'workingtree.py'
--- a/workingtree.py	2008-06-16 17:27:01 +0000
+++ b/workingtree.py	2008-06-17 19:53:50 +0000
@@ -653,7 +653,7 @@
         merges.append(revid)
         self.set_pending_merges(merges)
 
-    def pending_merges(self):
+    def get_parent_ids(self):
         merged = self._get_bzr_merges(self._get_base_branch_props()).splitlines()
         wc = self._get_wc()
         try:
@@ -670,9 +670,9 @@
                len(merged)+1 == len(set_merged))
 
         if len(set_merged) > len(merged):
-            return set_merged[-1].split("\t")
+            return [self.base_revid] + set_merged[-1].split("\t")
 
-        return []
+        return [self.base_revid]
 
     def _reset_data(self):
         pass




More information about the bazaar-commits mailing list