Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#1830 closed defect (fixed)

Repository subsets have to be fully self contained

Reported by: Jonas Borgström Owned by: Christian Boos
Priority: normal Milestone: 0.10
Component: version control Version: devel
Severity: normal Keywords:
Cc: gkokanosky@…, ndelon@…, dserodio@…, trac.tickets@…, calvin@…, jwilliams@…, trac@…, johannes_rudolph@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When Trac is configured to use a repository subset it has to be fully self contained. It can not contain any resources copied or moved from parts of the repository that are outside of the configured subset.

See #586 for more information.

Attachments (2)

trac-rev.diff (1.4 KB ) - added by ndelon@… 19 years ago.
patch for copy/move in subset bug
trac-bug-1830.sh (851 bytes ) - added by John Williams <jwilliams@…> 19 years ago.
Minimal test case of subset repo problem to demonstrate the problem.

Download all attachments as: .zip

Change History (29)

comment:1 by anonymous, 19 years ago

Cc: gkokanosky@… added

comment:2 by anonymous, 19 years ago

Cc: ndelon@… added

comment:3 by ndelon@…, 19 years ago

Here is a patch that can solve this issue:

=== trac/versioncontrol/cache.py
==================================================================
--- trac/versioncontrol/cache.py  (revision 145)
+++ trac/versioncontrol/cache.py  (local)
@@ -46,8 +46,11 @@
         if not self.synced:
             self.sync()
             self.synced = 1
-        return CachedChangeset(self.repos.normalize_rev(rev), self.db,
-                               self.authz)
+        try:
+            return CachedChangeset(self.repos.normalize_rev(rev), self.db,
+                                   self.authz)
+        except TracError:
+            return self.repos.get_changeset(rev)

     def sync(self):
         self.log.debug("Checking whether sync with repository is needed")
=== trac/versioncontrol/svn_fs.py
==================================================================
--- trac/versioncontrol/svn_fs.py  (revision 145)
+++ trac/versioncontrol/svn_fs.py  (local)
@@ -230,7 +230,7 @@
         rev = int(rev)
         if rev == 0:
             return None
-        if self.scope == '/':
+        if self.scope == '/' or not rev in self.history:
             return rev - 1
         idx = self.history.index(rev)
         if idx + 1 < len(self.history):
@@ -241,7 +241,7 @@
         rev = int(rev)
         if rev == self.rev:
             return None
-        if self.scope == '/':
+        if self.scope == '/' or not rev in self.history:
             return rev + 1
         if rev == 0:
             return self.oldest_rev
  • trac/versioncontrol/cache.py: the CachedRepository stores all revisions contained in a given subset of a repository, but not revisions that are outside of this subset scope, that's why we try to fetch revisions directly from the repository if they can't be found in the database (but those rev are not putted back in the cache, shall they ?).
  • trac/versioncontrol/svn_fs.py: if the methods previous_rev and next_rev of the SubversionRepository class get a rev number that is not in the history (that store all the revisions of a subset if trac is handling a specific subset) we consider this revision is out of the subset

Despite this patch seems to work correctly, I'm not sure that this the good way to fix the copy/move issue.

by ndelon@…, 19 years ago

Attachment: trac-rev.diff added

patch for copy/move in subset bug

comment:4 by Gunnar Wagenknecht <gunnar@…>, 19 years ago

Cc: gunnar@… added

comment:5 by Christopher Lenz, 19 years ago

#1930 has been marked as duplicate of this ticket.

comment:6 by anonymous, 19 years ago

Cc: dserodio@… added

comment:7 by anonymous, 19 years ago

What's holding this patch from being applied to the trunk? Any pitfalls?

comment:8 by anonymous, 19 years ago

Cc: trac.tickets@… added

comment:9 by dserodio@…, 19 years ago

The attached patch didn't solve my problem: my project was renamed, so the whole "repository subset" was moved.

comment:10 by anonymous, 19 years ago

Cc: calvin@… added

comment:11 by Christopher Lenz, 19 years ago

Component: generalversion control
Owner: changed from Jonas Borgström to Christopher Lenz

comment:12 by dserodio@…, 19 years ago

r2865 finally fixed this problem for me.

comment:13 by Christian Boos, 19 years ago

Milestone: 0.10
Owner: changed from Christopher Lenz to Christian Boos

Perhaps, but that's far from being enough…

Our own test repos can be used to exercise this situation, when repository_dir uses the tags/v1 for its scope. The only available changeset is 7, and the browser view and the changeset view will fail (the revision log will work, though).

comment:14 by dserodio@…, 19 years ago

Damn, I spoke too soon. To workaround this bug, I had set the problematic project's repository_dir to the repository root. Now that I've pointed it back to a subset of the repository, it's happening again, both in the Changeset view and in the Browser view too.
In the Changeset view, the error is:

Traceback (most recent call last):
  File "/usr/lib/python2.3/site-packages/trac/web/modpython_frontend.py", line 208, in handler
    dispatch_request(mpr.path_info, mpr, env)
  File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 141, in dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 109, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.3/site-packages/trac/versioncontrol/web_ui/changeset.py", line 216, in process_request
    diff_args, diff_options)
  File "/usr/lib/python2.3/site-packages/trac/versioncontrol/web_ui/changeset.py", line 425, in _render_html
    diffs = _content_changes(old_node, new_node)
  File "/usr/lib/python2.3/site-packages/trac/versioncontrol/web_ui/changeset.py", line 382, in _content_changes
    data = old_node.get_content().read()
AttributeError: 'NoneType' object has no attribute 'read'

and in the Browser view:

No changeset 1162 in the repository

I'm using r2865

comment:15 by anonymous, 19 years ago

Cc: jwilliams@… added

comment:16 by Curtis Buys <trac@…>, 19 years ago

Cc: trac@… added

comment:17 by anonymous, 19 years ago

Cc: trac@… added; trac@… removed

comment:18 by Christian Boos, 19 years ago

Status: newassigned

The support for this feature made some progress: Please test r2992.

That changeset is on the VcRefactoring branch, but the corresponding diff should also apply cleanly on the source:trunk@2991.

comment:19 by John Williams <jwilliams@…>, 19 years ago

I tried this, as suggested merging the diff from the VcRefactoring branch onto source:trunk@2991

Applied cleanly, testing with tracd.

Point it at the test repo that is created by my script posted to trac list in February:

http://lists.edgewall.com/archive/trac/2006-February/006655.html

(trac-bug-1830.sh script added as attachment)

If I point svn_repository to repo/subdir, I can at least browse to the (virtual) root - this is an improvement on before.

However, attempt to browse to a subdirectory within the subset repo, I get the following oops:

Traceback (most recent call last):
  File "/home/jwilliams/tmp/trac-test/trac-install/lib/python2.3/site-packages/trac/web/main.py", line 283, in dispatch_request
    dispatcher.dispatch(req)
  File "/home/jwilliams/tmp/trac-test/trac-install/lib/python2.3/site-packages/trac/web/main.py", line 170, in dispatch
    resp = chosen_handler.process_request(req)
  File "/home/jwilliams/tmp/trac-test/trac-install/lib/python2.3/site-packages/trac/versioncontrol/web_ui/browser.py", line 106, in process_request
    self._render_directory(req, repos, node, rev)
  File "/home/jwilliams/tmp/trac-test/trac-install/lib/python2.3/site-packages/trac/versioncontrol/web_ui/browser.py", line 137, in _render_directory
    changes = get_changes(self.env, repos, [i['rev'] for i in info])
  File "/home/jwilliams/tmp/trac-test/trac-install/lib/python2.3/site-packages/trac/versioncontrol/web_ui/util.py", line 36, in get_changes
    except NoSuchChangeset:
NameError: global name 'NoSuchChangeset' is not defined

by John Williams <jwilliams@…>, 19 years ago

Attachment: trac-bug-1830.sh added

Minimal test case of subset repo problem to demonstrate the problem.

comment:20 by Christian Boos, 19 years ago

oops, you need the small fix of r3009.

I'll try also with your repo later.

comment:21 by Christian Boos, 19 years ago

Browsing the test repo works fine now, but for that you'll need to upgrade your trunk to r3010, which contains an important fix for scoped repositories.

comment:22 by John Williams, 19 years ago

Hmm, still not working for me - maybe I'm missing something. Here's what I tried

Clean test of trunk@3010:

$ svn update -r3010
$ svn revert -R *
$ rm -rf /home/jwilliams/tmp/trac-test/trac-install
$ python ./setup install --prefix=/home/jwilliams/tmp/trac-test/trac-install
$ export PATH=/home/jwilliams/tmp/trac-test/trac-install/bin:${PATH}
$ export PYTHONPATH=/home/jwilliams/tmp/trac-test/trac-install/lib/python2.3/site-packages:${PYTHONPATH}
$ svn-admin /home/jwilliams/trac-test/testrepo resync
$ tracd -p 10000 /home/jwilliams/tmp/trac-test/trac-instance

With trac.ini pointing to test-repo/subdir, when I attempt to browse 'b', I get

Internal Error

No changeset 3 in the repository

If merge the changes in the VcRefactoring branch, r2991:2992, and repeat, I get the following oops:

Traceback (most recent call last):
  File "/home/jwilliams/tmp/trac-test/trac-install/lib/python2.3/site-packages/trac/web/main.py", line 283, in dispatch_request
    dispatcher.dispatch(req)
  File "/home/jwilliams/tmp/trac-test/trac-install/lib/python2.3/site-packages/trac/web/main.py", line 170, in dispatch
    resp = chosen_handler.process_request(req)
  File "/home/jwilliams/tmp/trac-test/trac-install/lib/python2.3/site-packages/trac/versioncontrol/web_ui/browser.py", line 106, in process_request
    self._render_directory(req, repos, node, rev)
  File "/home/jwilliams/tmp/trac-test/trac-install/lib/python2.3/site-packages/trac/versioncontrol/web_ui/browser.py", line 137, in _render_directory
    changes = get_changes(self.env, repos, [i['rev'] for i in info])
  File "/home/jwilliams/tmp/trac-test/trac-install/lib/python2.3/site-packages/trac/versioncontrol/web_ui/util.py", line 36, in get_changes
    except NoSuchChangeset:
NameError: global name 'NoSuchChangeset' is not defined

Can you confirm, whether simply r3010 on trunk should work, or if it's r3010 on trunk plus r2991:2992 on VcRefactoring that's required?

Here is an excerpt of my trac.ini file, for reference:

[trac]
default_charset = iso-8859-15
ignore_auth_case = false
permission_store = DefaultPermissionStore
check_auth_ip = true
database = sqlite:db/trac.db
templates_dir = /opt/local/share/trac/templates
default_handler = WikiModule
metanav = login,logout,settings,help,about
mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search
repository_type = svn
repository_dir = /home/jwilliams/trac-test/test-repo/subdir
}

comment:23 by John Williams, 19 years ago

trac.ini excerpt, previewed this time!

[trac]
default_charset = iso-8859-15
ignore_auth_case = false
permission_store = DefaultPermissionStore
check_auth_ip = true
database = sqlite:db/trac.db
templates_dir = /opt/local/share/trac/templates
default_handler = WikiModule
metanav = login,logout,settings,help,about
mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search
repository_type = svn
repository_dir = /home/jwilliams/trac-test/test-repo/subdir

comment:24 by Christian Boos, 19 years ago

Sorry, the instructions were not clear enough:

Note: that diff: link will work when this trac will be switched to 0.10)

comment:25 by John Williams, 19 years ago

Fantastic! Works beautifully on the test repo and also our production repo.

Thanks for your efforts - much appreciated.

comment:26 by Christian Boos, 19 years ago

Resolution: fixed
Status: assignedclosed

Merged in r3015. For those who are interested in the feature and haven't done so yet, please test!

If you discover some new issues with the above, please create a new ticket.

comment:27 by anonymous, 18 years ago

Cc: trac@… johannes_rudolph@… added; gunnar@… trac@… removed

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.