Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 70801 Details for
Bug 109477
new ebuild for trac with darcs/bzr support
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
www-apps/trac/files/0.9_beta2-vc-general.patch
0.9_beta2-vc-general.patch (text/plain), 9.13 KB, created by
Julien Allanos (RETIRED)
on 2005-10-16 10:54:19 UTC
(
hide
)
Description:
www-apps/trac/files/0.9_beta2-vc-general.patch
Filename:
MIME Type:
Creator:
Julien Allanos (RETIRED)
Created:
2005-10-16 10:54:19 UTC
Size:
9.13 KB
patch
obsolete
>diff -ruN upstream/trac/env.py current/trac/env.py >--- upstream/trac/env.py 2005-09-20 10:52:59.000000000 +0200 >+++ current/trac/env.py 2005-09-20 10:54:16.000000000 +0200 >@@ -131,17 +131,8 @@ > > @param authname: user name for authorization > """ >- from trac.versioncontrol.cache import CachedRepository >- from trac.versioncontrol.svn_authz import SubversionAuthorizer >- from trac.versioncontrol.svn_fs import SubversionRepository >- repos_dir = self.config.get('trac', 'repository_dir') >- if not repos_dir: >- raise EnvironmentError, 'Path to repository not configured' >- authz = None >- if authname: >- authz = SubversionAuthorizer(self, authname) >- repos = SubversionRepository(repos_dir, authz, self.log) >- return CachedRepository(self.get_db_cnx(), repos, authz, self.log) >+ from trac.versioncontrol import get_repository >+ return get_repository(self, authname) > > def create(self, db_str=None): > """Create the basic directory structure of the environment, initialize >diff -ruN upstream/trac/Timeline.py current/trac/Timeline.py >--- upstream/trac/Timeline.py 2005-09-26 10:24:30.000000000 +0200 >+++ current/trac/Timeline.py 2005-09-27 11:13:55.000000000 +0200 >@@ -24,7 +24,6 @@ > from trac.perm import IPermissionRequestor > from trac.util import enum, escape, format_date, format_time, http_date, \ > shorten_line >-from trac.versioncontrol.svn_authz import SubversionAuthorizer > from trac.web import IRequestHandler > from trac.web.chrome import add_link, add_stylesheet, INavigationContributor > >diff -ruN upstream/trac/versioncontrol/api.py current/trac/versioncontrol/api.py >--- upstream/trac/versioncontrol/api.py 2005-09-13 15:34:00.000000000 +0200 >+++ current/trac/versioncontrol/api.py 2005-09-17 18:00:03.911532176 +0200 >@@ -198,13 +198,32 @@ > > def get_changes(self): > """ >- Generator that produces a (path, kind, change, base_rev, base_path) >+ Generator that produces a (path, kind, change, base_path, base_rev) > tuple for every change in the changeset, where change can be one of > Changeset.ADD, Changeset.COPY, Changeset.DELETE, Changeset.EDIT or > Changeset.MOVE, and kind is one of Node.FILE or Node.DIRECTORY. > """ > raise NotImplementedError > >+ def insert_in_cache(self, cursor, kindmap, actionmap, log): >+ """ >+ Insert this changeset in the cache db. >+ """ >+ cursor.execute("INSERT INTO revision (rev,time,author,message) " >+ "VALUES (%s,%s,%s,%s)", (str(self.rev), >+ self.date, self.author, >+ self.message)) >+ for path,kind,action,base_path,base_rev in self.get_changes(): >+ log.debug("Caching node change in [%s]: %s" >+ % (self.rev, (path, kind, action, >+ base_path, base_rev))) >+ kind = kindmap[kind] >+ action = actionmap[action] >+ cursor.execute("INSERT INTO node_change (rev,path,kind," >+ "change,base_path,base_rev) " >+ "VALUES (%s,%s,%s,%s,%s,%s)", >+ (str(self.rev), path, kind, action, >+ base_path, base_rev)) > > class PermissionDenied(PermissionError): > """ >@@ -237,3 +256,55 @@ > def has_permission_for_changeset(self, rev): > return 1 > >+ >+def get_repository(env, authname): >+ """ >+ Return the right repository backend wrapped by a CachedRepository. >+ >+ This looks for a ``darcs:`` or ``bzr:`` prefix on the >+ 'repository_dir' from the configuration: if present it qualifies >+ respectively a Darcs or a Bazaar-NG repository, otherwise it uses >+ the Subversion backend. >+ """ >+ >+ authz = None >+ repos_dir = env.config.get('trac', 'repository_dir') >+ db = env.get_db_cnx() >+ if not repos_dir: >+ raise EnvironmentError, 'Path to repository not configured' >+ if repos_dir.startswith('darcs:'): >+ from trac.versioncontrol.darcs import DarcsRepository, \ >+ DarcsCachedRepository as CachedRepository >+ repos = DarcsRepository(db, repos_dir[6:], env.log) >+ elif repos_dir.startswith('bzr:'): >+ from trac.versioncontrol.bzr import BzrRepository, \ >+ BzrCachedRepository as CachedRepository >+ #from trac.versioncontrol.cache import CachedRepository >+ repos = BzrRepository(db, repos_dir[4:], env.log) >+ else: >+ from trac.versioncontrol.svn_authz import SubversionAuthorizer >+ from trac.versioncontrol.svn_fs import SubversionRepository >+ from trac.versioncontrol.cache import CachedRepository >+ if authname: >+ authz = SubversionAuthorizer(env, authname) >+ repos = SubversionRepository(repos_dir, authz, env.log) >+ return CachedRepository(db, repos, authz, env.log) >+ >+ >+def get_authorizer(env, authname): >+ """ >+ Return the right authorizer for the configured repository. >+ >+ Like ``get_repository()`` this looks for a ``darcs:`` or ``bzr:`` >+ prefix on the 'repository_dir' setting: if present it returns >+ a basic Authorizer(), otherwise a SubversionAuthorizer. >+ """ >+ >+ authz = Authorizer() >+ repos_dir = env.config.get('trac', 'repository_dir') >+ if not repos_dir.startswith('darcs:') \ >+ and not repos_dir.startswith('bzr:'): >+ from trac.versioncontrol.svn_authz import SubversionAuthorizer >+ if authname: >+ authz = SubversionAuthorizer(env, authname) >+ return authz >diff -ruN upstream/trac/versioncontrol/cache.py current/trac/versioncontrol/cache.py >--- upstream/trac/versioncontrol/cache.py 2005-08-31 10:10:17.000000000 +0200 >+++ current/trac/versioncontrol/cache.py 2005-09-17 18:00:03.912532024 +0200 >@@ -62,21 +62,7 @@ > current_rev = self.repos.oldest_rev > while current_rev is not None: > changeset = self.repos.get_changeset(current_rev) >- cursor.execute("INSERT INTO revision (rev,time,author,message) " >- "VALUES (%s,%s,%s,%s)", (str(current_rev), >- changeset.date, changeset.author, >- changeset.message)) >- for path,kind,action,base_path,base_rev in changeset.get_changes(): >- self.log.debug("Caching node change in [%s]: %s" >- % (current_rev, (path, kind, action, >- base_path, base_rev))) >- kind = kindmap[kind] >- action = actionmap[action] >- cursor.execute("INSERT INTO node_change (rev,path,kind," >- "change,base_path,base_rev) " >- "VALUES (%s,%s,%s,%s,%s,%s)", >- (str(current_rev), path, kind, action, >- base_path, base_rev)) >+ changeset.insert_in_cache(cursor, kindmap, actionmap, self.log) > current_rev = self.repos.next_rev(current_rev) > self.db.commit() > self.repos.authz = authz # restore permission checking >diff -ruN upstream/trac/versioncontrol/web_ui/changeset.py current/trac/versioncontrol/web_ui/changeset.py >--- upstream/trac/versioncontrol/web_ui/changeset.py 2005-09-23 09:47:58.000000000 +0200 >+++ current/trac/versioncontrol/web_ui/changeset.py 2005-09-23 09:48:59.000000000 +0200 >@@ -25,8 +25,7 @@ > from trac.perm import IPermissionRequestor > from trac.Search import ISearchSource, query_to_sql, shorten_result > from trac.Timeline import ITimelineEventProvider >-from trac.versioncontrol import Changeset, Node >-from trac.versioncontrol.svn_authz import SubversionAuthorizer >+from trac.versioncontrol import Changeset, Node, get_authorizer > from trac.versioncontrol.diff import get_diff_options, hdf_diff, unified_diff > from trac.web import IRequestHandler > from trac.web.chrome import add_link, add_stylesheet, INavigationContributor >@@ -64,7 +63,7 @@ > > rev = req.args.get('rev') > repos = self.env.get_repository(req.authname) >- authzperm = SubversionAuthorizer(self.env, req.authname) >+ authzperm = get_authorizer(self.env, req.authname) > authzperm.assert_permission_for_changeset(rev) > > diff_options = get_diff_options(req) >@@ -106,7 +105,7 @@ > 'changeset_show_files')) > db = self.env.get_db_cnx() > repos = self.env.get_repository() >- authzperm = SubversionAuthorizer(self.env, req.authname) >+ authzperm = get_authorizer(self.env, req.authname) > rev = repos.youngest_rev > while rev: > if not authzperm.has_permission_for_changeset(rev): >@@ -376,7 +375,7 @@ > def get_search_results(self, req, query, filters): > if not 'changeset' in filters: > return >- authzperm = SubversionAuthorizer(self.env, req.authname) >+ authzperm = get_authorizer(self.env, req.authname) > db = self.env.get_db_cnx() > sql = "SELECT rev,time,author,message " \ > "FROM revision WHERE %s OR %s" % \
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 109477
:
70801
|
70802
|
73644
|
73645