Rev 1315: Fix handling replaced items in get_previous(). in http://people.samba.org/bzr/jelmer/bzr-svn/0.4

Jelmer Vernooij jelmer at samba.org
Mon Jun 23 14:59:20 BST 2008


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

------------------------------------------------------------
revno: 1315
revision-id: jelmer at samba.org-20080623135919-lx5v0qilvg8ar51k
parent: jelmer at samba.org-20080623132415-nzadc6yk8wzh6bij
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2008-06-23 15:59:19 +0200
message:
  Fix handling replaced items in get_previous().
modified:
  logwalker.py                   logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
  tests/test_logwalker.py        test_logwalker.py-20060622141944-pkocc3rj8g62ukbi-1
=== modified file 'logwalker.py'
--- a/logwalker.py	2008-06-22 23:35:07 +0000
+++ b/logwalker.py	2008-06-23 13:59:19 +0000
@@ -221,7 +221,7 @@
         if row is None:
             return (None, -1)
         if row[2] == -1:
-            if row[0] == 'A':
+            if row[0] in ('A','R'):
                 return (None, -1)
             return (path, revnum-1)
         return (row[1], row[2])
@@ -480,7 +480,7 @@
             return (None, -1)
 
         if paths[path][2] == -1:
-            if paths[path][0] == 'A':
+            if paths[path][0] in ('A', 'R'):
                 return (None, -1)
             return (path, revnum-1)
 

=== modified file 'tests/test_logwalker.py'
--- a/tests/test_logwalker.py	2008-06-23 01:11:06 +0000
+++ b/tests/test_logwalker.py	2008-06-23 13:59:19 +0000
@@ -500,6 +500,22 @@
 
         self.assertEqual(("trunk", 1), walker.get_previous("anotherfile", 2))
 
+    def test_get_previous_replace(self):
+        repos_url = self.make_repository("a")
+
+        cb = self.get_commit_editor(repos_url)
+        cb.add_dir("trunk")
+        cb.close()
+
+        cb = self.get_commit_editor(repos_url)
+        cb.delete("trunk")
+        cb.add_dir("trunk")
+        cb.close()
+
+        walker = self.get_log_walker(transport=SvnRaTransport(repos_url))
+
+        self.assertEqual((None, -1), walker.get_previous("trunk", 2))
+
     def test_find_children_empty(self):
         repos_url = self.make_repository("a")
 




More information about the bazaar-commits mailing list