Rev 1031: merge 0.4. in file:///data/jelmer/bzr-svn/pyrex/

Jelmer Vernooij jelmer at samba.org
Sat Mar 22 20:18:52 GMT 2008


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

------------------------------------------------------------
revno: 1031
revision-id: jelmer at samba.org-20080322201850-2u1m2l7k7k0qp1qd
parent: jelmer at samba.org-20080322142716-p7vpxnkkm0740643
parent: jelmer at samba.org-20080322195846-mjnodu9ga5dyza6p
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: pyrex
timestamp: Sat 2008-03-22 21:18:50 +0100
message:
  merge 0.4.
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  branch.py                      svnbranch.py-20051017135706-11c749eb0dab04a7
  branchprops.py                 branchprops.py-20061223204623-80lvm7pjrpsgk0dd-1
  commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  fileids.py                     fileids.py-20060714013623-u5iiyqqnko11grcf-1
  logwalker.py                   logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
  mapping.py                     mapping.py-20080128201303-6cp01phc0dmc0kiv-1
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
  tests/test_branch.py           test_branch.py-20060508162215-74ffeb5d608f8e20
  tests/test_branchprops.py      test_branchprops.py-20061223210444-04xf5224zcg69m3w-1
  tests/test_repos.py            test_repos.py-20060508151940-ddc49a59257ca712
  workingtree.py                 workingtree.py-20060306120941-b083cb0fdd4a69de
    ------------------------------------------------------------
    revno: 950.1.39
    revision-id: jelmer at samba.org-20080322195846-mjnodu9ga5dyza6p
    parent: jelmer at samba.org-20080322190412-1m7e7b14a5iucx4u
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sat 2008-03-22 20:58:46 +0100
    message:
      Avoid fetching revision properties once extra for fileid renames.
    modified:
      fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
      fileids.py                     fileids.py-20060714013623-u5iiyqqnko11grcf-1
      repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
    ------------------------------------------------------------
    revno: 950.1.38
    revision-id: jelmer at samba.org-20080322190412-1m7e7b14a5iucx4u
    parent: jelmer at samba.org-20080322190110-agrawwv6d2iieidk
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sat 2008-03-22 20:04:12 +0100
    message:
      use lazy_dict.
    modified:
      commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
    ------------------------------------------------------------
    revno: 950.1.37
    revision-id: jelmer at samba.org-20080322190110-agrawwv6d2iieidk
    parent: jelmer at samba.org-20080322185908-399qhpr8eox3hn6l
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sat 2008-03-22 20:01:10 +0100
    message:
      Remove unused function touches_property.
    modified:
      branchprops.py                 branchprops.py-20061223204623-80lvm7pjrpsgk0dd-1
      tests/test_branchprops.py      test_branchprops.py-20061223210444-04xf5224zcg69m3w-1
    ------------------------------------------------------------
    revno: 950.1.36
    revision-id: jelmer at samba.org-20080322185908-399qhpr8eox3hn6l
    parent: jelmer at samba.org-20080322182458-ka9mfwl038gc7v5n
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sat 2008-03-22 19:59:08 +0100
    message:
      Save some calls retrieving branch properties.
    modified:
      workingtree.py                 workingtree.py-20060306120941-b083cb0fdd4a69de
    ------------------------------------------------------------
    revno: 950.1.35
    revision-id: jelmer at samba.org-20080322182458-ka9mfwl038gc7v5n
    parent: jelmer at samba.org-20080322173832-zv5dd3vgt6w9azwj
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sat 2008-03-22 19:24:58 +0100
    message:
      Fix test.
    modified:
      branch.py                      svnbranch.py-20051017135706-11c749eb0dab04a7
    ------------------------------------------------------------
    revno: 950.1.34
    revision-id: jelmer at samba.org-20080322173832-zv5dd3vgt6w9azwj
    parent: jelmer at samba.org-20080322171858-wlp8hv9u4nwcqb0t
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sat 2008-03-22 18:38:32 +0100
    message:
      share some code between logwalker and the follow_branch code.
    modified:
      logwalker.py                   logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
      repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
    ------------------------------------------------------------
    revno: 950.1.33
    revision-id: jelmer at samba.org-20080322171858-wlp8hv9u4nwcqb0t
    parent: jelmer at samba.org-20080322171301-sqmaw9i9p1y0e9o3
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sat 2008-03-22 18:18:58 +0100
    message:
      Add test for #183361
    modified:
      tests/test_repos.py            test_repos.py-20060508151940-ddc49a59257ca712
    ------------------------------------------------------------
    revno: 950.1.32
    revision-id: jelmer at samba.org-20080322171301-sqmaw9i9p1y0e9o3
    parent: jelmer at samba.org-20080322155912-2vyfnfggsovwkqr3
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sat 2008-03-22 18:13:01 +0100
    message:
      Properly use current branching scheme when following branches.
    modified:
      NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
      repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
      tests/test_branch.py           test_branch.py-20060508162215-74ffeb5d608f8e20
    ------------------------------------------------------------
    revno: 950.1.31
    revision-id: jelmer at samba.org-20080322155912-2vyfnfggsovwkqr3
    parent: jelmer at samba.org-20080322155311-9ha78plxvrse7tay
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sat 2008-03-22 16:59:12 +0100
    message:
      Remove experimental flag on v3 mapping.
    modified:
      mapping.py                     mapping.py-20080128201303-6cp01phc0dmc0kiv-1
    ------------------------------------------------------------
    revno: 950.1.30
    revision-id: jelmer at samba.org-20080322155311-9ha78plxvrse7tay
    parent: jelmer at samba.org-20080322140604-gr99ufb54gy6i9g4
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Sat 2008-03-22 16:53:11 +0100
    message:
      Add new utility function get_lhs_ancestry(), fix test failure for signature storage.
    modified:
      branch.py                      svnbranch.py-20051017135706-11c749eb0dab04a7
      fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
      repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
=== modified file 'NEWS'
--- a/NEWS	2008-03-22 14:27:16 +0000
+++ b/NEWS	2008-03-22 20:18:50 +0000
@@ -28,6 +28,8 @@
 
    * More correct implementation of Repository.get_ancestry(). 
 
+   * Properly use current branching scheme when following branches. (#183361)
+
   INTERNALS
 
    * Allow multiple mappings to be available at the same time.

=== modified file 'branch.py'
--- a/branch.py	2008-03-18 21:52:58 +0000
+++ b/branch.py	2008-03-22 20:18:50 +0000
@@ -21,7 +21,7 @@
 from bzrlib.errors import (NoSuchFile, DivergedBranches, NoSuchRevision, 
                            NotBranchError)
 from bzrlib.inventory import (Inventory)
-from bzrlib.revision import ensure_null
+from bzrlib.revision import ensure_null, NULL_REVISION
 from bzrlib.workingtree import WorkingTree
 
 import core
@@ -197,12 +197,7 @@
        
     def _generate_revision_history(self, last_revnum):
         """Generate the revision history up until a specified revision."""
-        revhistory = []
-        for (branch, rev) in self.repository.follow_branch(
-                self.get_branch_path(last_revnum), last_revnum, self.mapping):
-            revhistory.append(
-                self.repository.generate_revision_id(rev, branch, 
-                    self.mapping))
+        revhistory = list(self.repository.iter_lhs_ancestry(self.generate_revision_id(last_revnum)))
         revhistory.reverse()
         return revhistory
 
@@ -398,7 +393,7 @@
 
     def get_parent(self):
         """See Branch.get_parent()."""
-        return self.base
+        return None
 
     def set_parent(self, url):
         """See Branch.set_parent()."""

=== modified file 'branchprops.py'
--- a/branchprops.py	2008-03-16 05:56:59 +0000
+++ b/branchprops.py	2008-03-22 20:18:50 +0000
@@ -136,24 +136,6 @@
             return props[name]
         return default
 
-    def touches_property(self, path, revnum, name):
-        """Check whether a property was modified in a revision."""
-        assert isinstance(path, str)
-        assert isinstance(revnum, int)
-        assert isinstance(name, str)
-        # If the path this property is set on didn't change, then 
-        # the property can't have changed.
-        if not self.log.touches_path(path, revnum):
-            return ""
-
-        current = self.get_property(path, revnum, name, None)
-        (prev_path, prev_revnum) = self.log.get_previous(path, revnum)
-        if prev_path is None and prev_revnum == -1:
-            return (current is not None)
-        previous = self.get_property(prev_path.encode("utf-8"), 
-                                     prev_revnum, name, None)
-        return (previous != current)
-
     def get_property_diff(self, path, revnum, name):
         """Returns the new lines that were added to a particular property."""
         assert isinstance(path, str)

=== modified file 'commit.py'
--- a/commit.py	2008-03-22 14:27:16 +0000
+++ b/commit.py	2008-03-22 20:18:50 +0000
@@ -35,7 +35,7 @@
                  parse_svk_features, SVN_PROP_SVK_MERGE)
 import constants
 from mapping import parse_revision_id
-from repository import (SvnRepositoryFormat, SvnRepository)
+from repository import (SvnRepositoryFormat, SvnRepository, lazy_dict)
 import urllib
 
 
@@ -151,7 +151,7 @@
         if self.base_revid is None:
             base_branch_props = {}
         else:
-            base_branch_props = self.repository.branchprop_list.get_properties(self.base_path, self.base_revnum)
+            base_branch_props = lazy_dict(lambda: self.repository.branchprop_list.get_properties(self.base_path, self.base_revnum))
         (self._svn_revprops, self._svnprops) = self.base_mapping.export_revision(self.branch.get_branch_path(), timestamp, timezone, committer, revprops, revision_id, self.base_revno+1, merges, base_branch_props)
 
         if len(merges) > 0:

=== modified file 'fetch.py'
--- a/fetch.py	2008-03-22 14:27:16 +0000
+++ b/fetch.py	2008-03-22 20:18:50 +0000
@@ -98,8 +98,10 @@
     def start_revision(self, revid, prev_inventory):
         self.revid = revid
         (self.branch_path, self.revnum, self.mapping) = self.source.lookup_revision_id(revid)
+        self.svn_revprops = self.source._log._get_transport().revprop_list(self.revnum)
         changes = self.source._log.get_revision_paths(self.revnum, self.branch_path)
-        renames = self.source.revision_fileid_renames(revid)
+        renames = self.source.revision_fileid_renames(self.branch_path, self.revnum, self.mapping, 
+                                                      revprops=self.svn_revprops)
         self.id_map = self.source.transform_fileid_map(self.source.uuid, 
                               self.revnum, self.branch_path, changes, renames, 
                               self.mapping)
@@ -123,10 +125,9 @@
         # Commit SVN revision properties to a Revision object
         rev = Revision(revision_id=revid, parent_ids=self._get_parent_ids())
 
-        svn_revprops = self.source._log._get_transport().revprop_list(self.revnum)
-        self.mapping.import_revision(svn_revprops, self._branch_fileprops, rev)
+        self.mapping.import_revision(self.svn_revprops, self._branch_fileprops, rev)
 
-        signature = svn_revprops.get(SVN_REVPROP_BZR_SIGNATURE)
+        signature = self.svn_revprops.get(SVN_REVPROP_BZR_SIGNATURE)
 
         return (rev, signature)
 
@@ -566,15 +567,11 @@
         """
         needed = []
         parents = {}
-        (path, until_revnum, mapping) = self.source.lookup_revision_id(revision_id)
 
         prev_revid = None
         pb = ui.ui_factory.nested_progress_bar()
         try:
-            for (branch, revnum) in self.source.follow_branch(path, 
-                                                              until_revnum, mapping):
-                pb.update("determining revisions to fetch", until_revnum-revnum, until_revnum)
-                revid = self.source.generate_revision_id(revnum, branch, mapping)
+            for revid in self.source.iter_lhs_ancestry(revision_id, pb):
 
                 if prev_revid is not None:
                     parents[prev_revid] = revid

=== modified file 'fileids.py'
--- a/fileids.py	2008-03-21 18:36:14 +0000
+++ b/fileids.py	2008-03-22 19:58:46 +0000
@@ -208,7 +208,7 @@
 
                 (revnum, branch) = quickrevidmap[revid]
                 (idmap, changes) = self.actual.apply_changes(self.repos.uuid, revnum, branch, 
-                                          global_changes, renames_cb(revid), mapping,
+                                          global_changes, renames_cb(branch, revnum, mapping), mapping,
                                           log_find_children)
                 pb.update('generating file id map', i, len(todo))
 

=== modified file 'logwalker.py'
--- a/logwalker.py	2008-03-21 22:45:37 +0000
+++ b/logwalker.py	2008-03-22 20:18:50 +0000
@@ -29,6 +29,45 @@
 
 LOG_CHUNK_LIMIT = 0
 
+def changes_find_prev_location(paths, branch_path, revnum):
+    if revnum == 0:
+        assert branch_path == ""
+        return
+    # 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 paths[branch_path][1] is None: 
+            return None # Was added here
+        revnum = paths[branch_path][2]
+        branch_path = paths[branch_path][1].encode("utf-8")
+        return (branch_path, revnum)
+    
+    # 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
+    for p in sorted(paths.keys(), reverse=True):
+        if paths[p][0] == 'M':
+            continue
+        if branch_path.startswith(p+"/"):
+            assert paths[p][0] in ('A', 'R'), "Parent wasn't added"
+            assert paths[p][1] is not None, \
+                "Empty parent added, but child wasn't added !?"
+
+            revnum = paths[p][2]
+            branch_path = paths[p][1].encode("utf-8") + branch_path[len(p):]
+            return (branch_path, revnum)
+
+    return (branch_path, revnum)
+
+
+
 class LogWalker(object):
     """Easy way to access the history of a Subversion repository."""
     def __init__(self, transport, cache_db=None, limit=None):
@@ -140,29 +179,12 @@
             if revpaths != {}:
                 yield (path, copy(revpaths), revnum)
 
-            if path == "":
-                revnum -= 1
-                continue
-
-            if revpaths.has_key(path):
-                if revpaths[path][1] is None:
-                    if revpaths[path][0] in ('A', 'R'):
-                        # this path didn't exist before this revision
-                        return
-                else:
-                    # In this revision, this path was copied from 
-                    # somewhere else
-                    revnum = revpaths[path][2]
-                    path = revpaths[path][1]
-                    assert path == "" or revnum > 0
-                    continue
-            revnum -= 1
-            for p in sorted(revpaths.keys()):
-                if path.startswith(p+"/") and revpaths[p][0] in ('A', 'R'):
-                    assert revpaths[p][1]
-                    path = path.replace(p, revpaths[p][1])
-                    revnum = revpaths[p][2]
-                    break
+            next = changes_find_prev_location(revpaths, path, revnum)
+
+            if next is None:
+                break
+
+            (path, revnum) = next
 
     def get_revision_paths(self, revnum, path=None, recurse=False):
         """Obtain dictionary with all the changes in a particular revision.

=== modified file 'mapping.py'
--- a/mapping.py	2008-03-22 14:27:16 +0000
+++ b/mapping.py	2008-03-22 20:18:50 +0000
@@ -435,7 +435,7 @@
     """The third version of the mappings as used in the 0.4.x series.
 
     """
-    experimental = True
+    experimental = False
     upgrade_suffix = "-svn3"
     revid_prefix = "svn-v3-"
 

=== modified file 'repository.py'
--- a/repository.py	2008-03-22 14:27:16 +0000
+++ b/repository.py	2008-03-22 20:18:50 +0000
@@ -121,6 +121,19 @@
     def check_conversion_target(self, target_repo_format):
         return target_repo_format.rich_root_data
 
+
+def changes_path(changes, path):
+    """Check if one of the specified changes applies 
+    to path or one of its children.
+    """
+    for p in changes:
+        assert isinstance(p, str)
+        if p == path or p.startswith(path+"/") or path == "":
+            return True
+    return False
+
+
+
 CACHE_DB_VERSION = 3
 
 cachedbs = {}
@@ -365,18 +378,20 @@
 
         return SvnRevisionTree(self, revision_id)
 
-    def revision_fileid_renames(self, revid):
+    def revision_fileid_renames(self, path, revnum, mapping,
+                                revprops=None, fileprops=None):
         """Check which files were renamed in a particular revision.
         
-        :param revid: Id of revision to look up.
+        :param path: Branch path
+        :
         :return: dictionary with paths as keys, file ids as values
         """
-        (path, revnum, mapping) = self.lookup_revision_id(revid)
-
-        svn_revprops = lazy_dict(lambda: self.transport.revprop_list(revnum))
-        svn_fileprops = lazy_dict(lambda: self.branchprop_list.get_changed_properties(path, revnum))
-
-        return mapping.import_fileid_map(svn_revprops, svn_fileprops)
+        if revprops is None:
+            revprops = lazy_dict(lambda: self._log.transport.revprop_list(revnum))
+        if fileprops is None:
+            fileprops = lazy_dict(lambda: self.branchprop_list.get_changed_properties(path, revnum))
+
+        return mapping.import_fileid_map(revprops, fileprops)
 
     def _mainline_revision_parent(self, path, revnum, mapping):
         """Find the mainline parent of the specified revision.
@@ -678,6 +693,13 @@
                     pass
             revnum -= 1
 
+    def iter_lhs_ancestry(self, revid, pb=None):
+        (branch_path, revnum, mapping) = self.lookup_revision_id(revid)
+        for (bp, rev) in self.follow_branch(branch_path, revnum, mapping):
+            if pb is not None:
+                pb.update("determining revision ancestry", revnum-rev, revnum)
+            yield self.generate_revision_id(rev, bp, mapping)
+
     def follow_branch(self, branch_path, revnum, mapping):
         """Follow the history of a branch. Will yield all the 
         left-hand side ancestors of a specified revision.
@@ -697,60 +719,24 @@
             assert revnum > 0 or branch_path == ""
             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:
-                assert isinstance(p, str)
-                if (p == branch_path or 
-                    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 mapping.is_branch(paths[branch_path][1]) and \
-                   not mapping.is_tag(paths[branch_path][1]):
-                    # FIXME: if copyfrom_path is not a branch path, 
-                    # should simulate a reverse "split" of a branch
-                    # for now, just make it look like the branch ended here
-                    return
-                revnum = paths[branch_path][2]
-                branch_path = paths[branch_path][1].encode("utf-8")
-                continue
-            
-            # 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
-            for p in sorted(paths.keys(), reverse=True):
-                if paths[p][0] == 'M':
-                    continue
-                if branch_path.startswith(p+"/"):
-                    assert paths[p][0] in ('A', 'R'), "Parent wasn't added"
-                    assert paths[p][1] is not None, \
-                        "Empty parent added, but child wasn't added !?"
-
-                    revnum = paths[p][2]
-                    branch_path = paths[p][1].encode("utf-8") + branch_path[len(p):]
-                    break
-
+            if changes_path(paths, branch_path):
+                yield (branch_path, revnum)
+            next = logwalker.changes_find_prev_location(paths, branch_path, revnum)
+            if next is None:
+                break
+            (branch_path, revnum) = next
+            if not mapping.is_branch(branch_path) and \
+               not mapping.is_tag(branch_path):
+                # FIXME: if copyfrom_path is not a branch path, 
+                # should simulate a reverse "split" of a branch
+                # for now, just make it look like the branch ended here
+                break
+        
     def follow_branch_history(self, branch_path, revnum, mapping):
         """Return all the changes that happened in a branch 
-        between branch_path and revnum. 
+        until branch_path,revnum. 
 
         :return: iterator that returns tuples with branch path, 
             changed paths and revision number.
@@ -796,7 +782,10 @@
         :return: False, as no signatures are stored for revisions in Subversion 
             at the moment.
         """
-        (path, revnum, mapping) = self.lookup_revision_id(revision_id)
+        try:
+            (path, revnum, mapping) = self.lookup_revision_id(revision_id)
+        except NoSuchRevision:
+            return False
         revprops = self.transport.revprop_list(revnum)
         return revprops.has_key(SVN_REVPROP_BZR_SIGNATURE)
 

=== modified file 'tests/test_branch.py'
--- a/tests/test_branch.py	2008-02-04 16:16:22 +0000
+++ b/tests/test_branch.py	2008-03-22 17:13:01 +0000
@@ -139,7 +139,7 @@
     def test_get_parent(self):
         repos_url = self.make_client('a', 'dc')
         branch = Branch.open("svn+"+repos_url)
-        self.assertEqual("svn+"+repos_url, branch.get_parent())
+        self.assertEqual(None, branch.get_parent())
 
     def test_append_revision(self):
         repos_url = self.make_client('a', 'dc')

=== modified file 'tests/test_branchprops.py'
--- a/tests/test_branchprops.py	2008-02-04 03:21:32 +0000
+++ b/tests/test_branchprops.py	2008-03-22 19:01:10 +0000
@@ -141,20 +141,6 @@
         self.assertEquals("newdata\n", 
                           bp.get_changed_properties("", 3)["myp2"])
 
-    def test_touches_property(self):
-        repos_url = self.make_client('d', 'dc')
-        self.client_set_prop("dc", "myprop", "data\n")
-        self.client_commit("dc", "My Message")
-        self.client_set_prop("dc", "myprop", "data\ndata2\n")
-        self.client_commit("dc", "My Message")
-
-        logwalk = LogWalker(transport=SvnRaTransport(repos_url))
-
-        bp = BranchPropertyList(logwalk, self.db)
-        self.assertTrue(bp.touches_property("", 2, "myprop"))
-        self.assertTrue(bp.touches_property("", 1, "myprop"))
-        self.assertFalse(bp.touches_property("", 1, "nonexistant-property"))
-
     def test_get_property_diff_ignore_origchange(self):
         repos_url = self.make_client('d', 'dc')
         self.client_set_prop("dc", "myprop", "foodata\n")

=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py	2008-03-22 14:27:16 +0000
+++ b/tests/test_repos.py	2008-03-22 20:18:50 +0000
@@ -35,7 +35,7 @@
 from mapping import (escape_svn_path, unescape_svn_path, 
                      SVN_PROP_BZR_REVISION_ID, SVN_PROP_BZR_BRANCHING_SCHEME)
 from scheme import (TrunkBranchingScheme, NoBranchingScheme, 
-                    ListBranchingScheme)
+                    ListBranchingScheme, SingleBranchingScheme)
 from transport import SvnRaTransport
 from tests import TestCaseWithSubversionRepository
 from repository import SvnRepositoryFormat
@@ -179,6 +179,18 @@
         self.assertEquals([('pygments/trunk', 3), ('pykleur/trunk', 2), ('pykleur/trunk', 1)], 
                 list(repos.follow_branch("pygments/trunk", 3, TrunkBranchingScheme(1))))
 
+    def test_follow_branch_move_single(self):
+        repos_url = self.make_client('a', 'dc')
+        self.build_tree({'dc/pykleur/bla': None})
+        self.client_add("dc/pykleur")
+        self.client_commit("dc", "initial")
+        self.client_copy("dc/pykleur", "dc/pygments", 1)
+        self.client_update("dc")
+        self.client_commit("dc", "commit")
+        repos = Repository.open(repos_url)
+        self.assertEquals([('pygments', 2)], 
+                list(repos.follow_branch("pygments", 2, SingleBranchingScheme("pygments"))))
+
     def test_history_all(self):
         repos_url = self.make_client("a", "dc")
         self.build_tree({'dc/trunk/file': "data", "dc/foo/file":"data"})

=== modified file 'workingtree.py'
--- a/workingtree.py	2008-03-21 19:03:35 +0000
+++ b/workingtree.py	2008-03-22 20:18:50 +0000
@@ -445,7 +445,7 @@
         adm = self._get_wc(write_lock=True)
         try:
             adm.prop_set(SVN_PROP_BZR_REVISION_ID+str(self.branch.mapping.scheme), 
-                             self._get_bzr_revids() + extra,
+                             self._get_bzr_revids(self._get_base_branch_props()) + extra,
                              self.basedir)
             adm.prop_set(SVN_PROP_BZR_REVISION_INFO, 
                              generate_revision_metadata(timestamp, 
@@ -467,14 +467,12 @@
             # Reset properties so the next subversion commit won't 
             # accidently set these properties.
             adm = self._get_wc(write_lock=True)
+            base_branch_props = self._get_base_branch_props()
             adm.prop_set(SVN_PROP_BZR_REVISION_ID+str(self.branch.mapping.scheme), 
-                             self._get_bzr_revids(), self.basedir)
+                             self._get_bzr_revids(base_branch_props), self.basedir)
             adm.prop_set(SVN_PROP_BZR_REVISION_INFO, 
-                self.branch.repository.branchprop_list.get_property(
-                self.branch.get_branch_path(self.base_revnum), 
-                self.base_revnum, 
-                SVN_PROP_BZR_REVISION_INFO, ""), 
-                self.basedir)
+                              base_branch_props.get(SVN_PROP_BZR_REVISION_INFO, ""),
+                              self.basedir)
             adm.close()
             raise
 
@@ -620,14 +618,14 @@
         return dict(map(lambda x: str(x).split("\t"), 
             existing.splitlines()))
 
-    def _get_bzr_revids(self):
-        return self._get_base_branch_props().get(SVN_PROP_BZR_REVISION_ID+str(self.branch.mapping.scheme), "")
-
-    def _get_bzr_merges(self):
-        return self._get_base_branch_props().get(SVN_PROP_BZR_ANCESTRY+str(self.branch.mapping.scheme), "")
-
-    def _get_svk_merges(self):
-        return self._get_base_branch_props().get(SVN_PROP_SVK_MERGE, "")
+    def _get_bzr_revids(self, base_branch_props):
+        return base_branch_props.get(SVN_PROP_BZR_REVISION_ID+str(self.branch.mapping.scheme), "")
+
+    def _get_bzr_merges(self, base_branch_props):
+        return base_branch_props.get(SVN_PROP_BZR_ANCESTRY+str(self.branch.mapping.scheme), "")
+
+    def _get_svk_merges(self, base_branch_props):
+        return base_branch_props.get(SVN_PROP_SVK_MERGE, "")
 
     def set_pending_merges(self, merges):
         """See MutableTree.set_pending_merges()."""
@@ -640,10 +638,10 @@
                 bzr_merge = ""
 
             adm.prop_set(SVN_PROP_BZR_ANCESTRY+str(self.branch.mapping.scheme), 
-                                 self._get_bzr_merges() + bzr_merge, 
+                                 self._get_bzr_merges(self._get_base_branch_props()) + bzr_merge, 
                                  self.basedir)
             
-            svk_merges = parse_svk_features(self._get_svk_merges())
+            svk_merges = parse_svk_features(self._get_svk_merges(self._get_base_branch_props()))
 
             # Set svk:merge
             for merge in merges:
@@ -664,7 +662,7 @@
         self.set_pending_merges(merges)
 
     def pending_merges(self):
-        merged = self._get_bzr_merges().splitlines()
+        merged = self._get_bzr_merges(self._get_base_branch_props()).splitlines()
         adm = self._get_wc()
         try:
             merged_data = adm.prop_get(




More information about the bazaar-commits mailing list