Rev 419: Make LogWalker.find_latest_change() check parent paths too. Fixes #84087. in file:///home/jelmer/bzr-svn/0.3/
Jelmer Vernooij
jelmer at samba.org
Sun Mar 11 22:59:03 GMT 2007
At file:///home/jelmer/bzr-svn/0.3/
------------------------------------------------------------
revno: 419
revision-id: jelmer at samba.org-20070311225839-b1vmok87wjge8y7x
parent: jelmer at samba.org-20070311015848-s4599kx059ggwd6s
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.3
timestamp: Sun 2007-03-11 23:58:39 +0100
message:
Make LogWalker.find_latest_change() check parent paths too. Fixes #84087.
modified:
NEWS news-20061231030336-h9fhq245ie0de8bs-1
logwalker.py logwalker.py-20060621215743-c13fhfnyzh1xzwh2-1
tests/test_logwalker.py test_logwalker.py-20060622141944-pkocc3rj8g62ukbi-1
=== modified file 'NEWS'
--- a/NEWS 2007-03-04 12:46:53 +0000
+++ b/NEWS 2007-03-11 22:58:39 +0000
@@ -4,6 +4,9 @@
* Fix compatibility with Bazaar 0.15.
+ * Check for parent paths moving as well in LogWalker.find_latest_change().
+ Fixes #84087.
+
bzr-svn 0.3.1 2007-01-31
BUG FIXES
=== modified file 'logwalker.py'
--- a/logwalker.py 2007-01-02 16:58:01 +0000
+++ b/logwalker.py 2007-03-11 22:58:39 +0000
@@ -226,7 +226,8 @@
extra = " or path like '%s/%%'" % path.strip("/")
else:
extra = ""
- query = "select rev from changed_path where (path='%s'%s) and rev <= %d order by rev desc limit 1" % (path.strip("/"), extra, revnum)
+ query = "select rev from changed_path where (path='%s' or ('%s' like (path || '/%%') and (action = 'R' or action = 'A'))%s) and rev <= %d order by rev desc limit 1" % (path.strip("/"), path.strip("/"), extra, revnum)
+ mutter('query: %r' % query)
row = self.db.execute(query).fetchone()
if row is None and path == "":
=== modified file 'tests/test_logwalker.py'
--- a/tests/test_logwalker.py 2007-01-03 07:13:12 +0000
+++ b/tests/test_logwalker.py 2007-03-11 22:58:39 +0000
@@ -122,18 +122,60 @@
self.assertEqual(0, walker.find_latest_change("", 1))
- def test_find_latest_notfound(self):
- repos_url = self.make_client("a", "dc")
- self.build_tree({'dc/branches/tmp': None})
- self.client_add("dc/branches")
- self.client_commit("dc", "My Message")
-
- self.client_copy("dc/branches", "dc/bla")
- self.client_commit("dc", "My Message")
-
- walker = logwalker.LogWalker(transport=SvnRaTransport(repos_url))
-
- self.assertIs(None, walker.find_latest_change("bla/tmp", 2))
+ def test_find_latest_parent(self):
+ repos_url = self.make_client("a", "dc")
+ self.build_tree({'dc/branches/tmp/foo': None, 'dc/tags': None})
+ self.client_add("dc/branches")
+ self.client_add("dc/tags")
+ self.client_commit("dc", "My Message")
+ self.client_copy("dc/branches/tmp", "dc/tags/tmp");
+ self.client_commit("dc", "My Message2")
+
+ walker = logwalker.LogWalker(transport=SvnRaTransport(repos_url))
+
+ self.assertEqual(2, walker.find_latest_change("tags/tmp/foo", 2))
+
+ def test_find_latest_parent_just_modify(self):
+ repos_url = self.make_client("a", "dc")
+ self.build_tree({'dc/branches/tmp/foo': None, 'dc/tags': None})
+ self.client_add("dc/branches")
+ self.client_add("dc/tags")
+ self.client_commit("dc", "My Message")
+ self.client_copy("dc/branches/tmp", "dc/tags/tmp");
+ self.client_commit("dc", "My Message2")
+ self.client_update("dc")
+ self.client_set_prop("dc/tags", "myprop", "mydata")
+ self.client_commit("dc", "My Message3")
+
+ walker = logwalker.LogWalker(transport=SvnRaTransport(repos_url))
+ self.assertEqual(2, walker.find_latest_change("tags/tmp/foo", 3))
+
+ def test_find_latest_parentmoved(self):
+ repos_url = self.make_client("a", "dc")
+ self.build_tree({'dc/branches/tmp': None})
+ self.client_add("dc/branches")
+ self.client_commit("dc", "My Message")
+
+ self.client_copy("dc/branches", "dc/bla")
+ self.client_commit("dc", "My Message")
+
+ walker = logwalker.LogWalker(transport=SvnRaTransport(repos_url))
+
+ self.assertIs(2, walker.find_latest_change("bla/tmp", 2))
+
+ def test_find_latest_nonexistant(self):
+ repos_url = self.make_client("a", "dc")
+ self.build_tree({'dc/branches/tmp': None})
+ self.client_add("dc/branches")
+ self.client_commit("dc", "My Message")
+
+ self.client_copy("dc/branches", "dc/bla")
+ self.client_commit("dc", "My Message")
+
+ walker = logwalker.LogWalker(transport=SvnRaTransport(repos_url))
+
+ self.assertIs(None, walker.find_latest_change("bloe", 2))
+ self.assertIs(None, walker.find_latest_change("bloe/bla", 2))
def test_find_latest_change(self):
repos_url = self.make_client("a", "dc")
More information about the bazaar-commits
mailing list