Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

Last modified 19 years ago

#2572 closed defect (fixed)

Bug with partial repositories in r2746

Reported by: Manuzhai Owned by: Christian Boos
Priority: high Milestone: 0.10
Component: version control Version: devel
Severity: normal Keywords:
Cc: manuzhai@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

With r2746, I get the following error when viewing a particular revision. The environment is confined to a part of the repository, this works fine when browing source and viewing the timeline, but when viewing this particular changeset (which is confirmed to only change files within the configured partial repository), I get this exception:

Traceback (most recent call last):
  File "/home/manuzhai/dev/trac/trac/web/modpython_frontend.py", line 206, in handler
    dispatch_request(mpr.path_info, mpr, env)
  File "/home/manuzhai/dev/trac/trac/web/main.py", line 139, in dispatch_request
    dispatcher.dispatch(req)
  File "/home/manuzhai/dev/trac/trac/web/main.py", line 107, in dispatch
    resp = chosen_handler.process_request(req)
  File "/home/manuzhai/dev/trac/trac/versioncontrol/web_ui/changeset.py", line 91, in process_request
    self._render_html(req, repos, chgset, diff_options)
  File "/home/manuzhai/dev/trac/trac/versioncontrol/web_ui/changeset.py", line 155, in _render_html
    oldest_rev = repos.oldest_rev
  File "/home/manuzhai/dev/trac/trac/versioncontrol/api.py", line 125, in <lambda>
    oldest_rev = property(lambda x: x.get_oldest_rev())
  File "/home/manuzhai/dev/trac/trac/versioncontrol/cache.py", line 107, in get_oldest_rev
    return self.repos.oldest_rev
  File "/home/manuzhai/dev/trac/trac/versioncontrol/api.py", line 125, in <lambda>
    oldest_rev = property(lambda x: x.get_oldest_rev())
  File "/home/manuzhai/dev/trac/trac/versioncontrol/svn_fs.py", line 301, in get_oldest_rev
    self.oldest = self.next_rev(0)
  File "/home/manuzhai/dev/trac/trac/versioncontrol/svn_fs.py", line 328, in next_rev
    for path, next in self._history('', rev+1, next, limit=1):
  File "/home/manuzhai/dev/trac/trac/versioncontrol/svn_fs.py", line 58, in _get_history
    start, end, 1, pool())
  File "/usr/lib/python2.4/site-packages/libsvn/repos.py", line 291, in svn_repos_history2
    return apply(_repos.svn_repos_history2, args)
SubversionException: ("File not found: revision 1, path 'hebe/'", 160013)

It seems that line 58 from svn_fs.py explicitly refers to r1, while it should probably refer to some other revision number that is the first revision of the partial repository.

Attachments (0)

Change History (5)

comment:1 by Christian Boos, 19 years ago

Milestone: 0.9.4
Owner: changed from Christopher Lenz to Christian Boos
Priority: normalhigh

This is because the path corresponding to the partial repository was not existing at rev. 1. That should be a pretty common situation, unfortunately I only tested by restricting to trunk or similar path that already existed at rev. 1.

I'm trying to get a fix.

comment:2 by Christian Boos, 19 years ago

Milestone: 0.9.41.0
Status: newassigned

Fix tested with Subversion 1.2.3 and 1.3.0 on Windows.

Index: tests/svn_fs.py
===================================================================
--- tests/svn_fs.py	(revision 2746)
+++ tests/svn_fs.py	(working copy)
@@ -544,6 +544,24 @@
                          changes.next())
         self.assertRaises(StopIteration, changes.next)
 
+
+class RecentPathScopedRepositoryTestCase(unittest.TestCase):
+
+    def setUp(self):
+        self.repos = SubversionRepository(REPOS_PATH + '/trunk/dir1', None,
+                                          logger_factory('test'))
+
+    def tearDown(self):
+        self.repos = None
+
+    def test_rev_navigation(self):
+        self.assertEqual(False, self.repos.has_node('/', 1))
+        self.assertEqual(False, self.repos.has_node('/', 2))
+        self.assertEqual(False, self.repos.has_node('/', 3))
+        self.assertEqual(True, self.repos.has_node('/', 4))
+        self.assertEqual(4, self.repos.oldest_rev)
+
+
 def suite():
     global has_svn
     suite = unittest.TestSuite()
@@ -552,6 +570,8 @@
             'test', suiteClass=SubversionRepositoryTestSetup))
         suite.addTest(unittest.makeSuite(ScopedSubversionRepositoryTestCase,
             'test', suiteClass=SubversionRepositoryTestSetup))
+        suite.addTest(unittest.makeSuite(RecentPathScopedRepositoryTestCase,
+            'test', suiteClass=SubversionRepositoryTestSetup))
     return suite
 
 if __name__ == '__main__':
Index: svn_fs.py
===================================================================
--- svn_fs.py	(revision 2746)
+++ svn_fs.py	(working copy)
@@ -298,7 +298,7 @@
         if self.oldest is None:
             self.oldest = 1
             if self.scope != '/':
-                self.oldest = self.next_rev(0)
+                self.oldest = self.next_rev(0, find_initial_rev=True)
         return self.oldest
 
     def get_youngest_rev(self):
@@ -319,7 +319,7 @@
                 pass
         return None
 
-    def next_rev(self, rev):
+    def next_rev(self, rev, find_initial_rev=False):
         rev = self.normalize_rev(rev)
         next = rev + 1
         youngest = self.youngest_rev
@@ -328,8 +328,12 @@
                 for path, next in self._history('', rev+1, next, limit=1):
                     return next
                 next += 1
-            except SystemError: # i.e. "null arg to internal routine"
-                return next # a 'delete' event is also interesting... 
+            except (SystemError, # "null arg to internal routine" in 1.2.x
+                    core.SubversionException): # in 1.3.x
+                if not find_initial_rev:
+                    return next # a 'delete' event is also interesting...
+                else:
+                    next += 1
         return None
 
     def rev_older_than(self, rev1, rev2):

The problem doesn't exist for milestone:0.9.3. It was a regression introduced in r2462 (vc-refactoring branch).

comment:3 by Manuzhai, 19 years ago

That works just fine, thanks. Please commit it!

comment:4 by Christian Boos, 19 years ago

Resolution: fixed
Status: assignedclosed

Thanks for testing, I committed a slightly simplified fix in r2747.

comment:5 by Christopher Lenz, 19 years ago

Milestone: 1.00.10

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.