Rev 470: Return last revision in which a branch was changed but existed rather than revision in which it was removed. in file:///home/jelmer/bzr-svn/0.4/

Jelmer Vernooij jelmer at samba.org
Mon May 28 13:58:48 BST 2007


------------------------------------------------------------
revno: 470
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2007-05-28 14:58:17 +0200
message:
  Return last revision in which a branch was changed but existed rather than revision in which it was removed.
modified:
  repository.py
  tests/test_repos.py
=== modified file 'repository.py'
--- a/repository.py	2007-05-28 12:24:15 +0000
+++ b/repository.py	2007-05-28 12:58:17 +0000
@@ -678,7 +678,7 @@
         """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)
+        :return: iterator that returns tuples with (path, revision number, still exists). The revision number is the revision in which the branch last existed.
         """
         if revnum is None:
             revnum = self.transport.get_latest_revnum()
@@ -695,17 +695,21 @@
                 if self.scheme.is_branch(p) or self.scheme.is_tag(p):
                     if paths[p][0] in ('R', 'D'):
                         del created_branches[p]
-                        yield (p, i, False)
+                        j = self._log.find_latest_change(p, i-1, recurse=True)
+                        yield (p, j, False)
 
                     if paths[p][0] in ('A', 'R'): 
                         created_branches[p] = i
-                elif self.scheme.is_branch_parent(p) or self.scheme.is_tag_parent(p):
+                elif self.scheme.is_branch_parent(p) or \
+                        self.scheme.is_tag_parent(p):
                     if paths[p][0] in ('R', 'D'):
                         k = created_branches.keys()
                         for c in k:
                             if c.startswith(p+"/"):
                                 del created_branches[c] 
-                                yield (c, i, False)
+                                j = self._log.find_latest_change(c, i-1, 
+                                        recurse=True)
+                                yield (c, j, False)
                     if paths[p][0] in ('A', 'R'):
                         parents = [p]
                         while parents:

=== modified file 'tests/test_repos.py'
--- a/tests/test_repos.py	2007-05-27 16:35:12 +0000
+++ b/tests/test_repos.py	2007-05-28 12:58:17 +0000
@@ -308,7 +308,7 @@
         self.client_commit("dc", "remove")
 
         self.assertEqual([("trunk", 1, True)], list(repos.find_branches(1)))
-        self.assertEqual([("trunk", 2, False)], list(repos.find_branches(2)))
+        self.assertEqual([("trunk", 1, False)], list(repos.find_branches(2)))
 
     def test_url(self):
         """ Test repository URL is kept """




More information about the bazaar-commits mailing list