Opened 14 years ago
Last modified 9 years ago
#10118 new enhancement
(almost patch) make browser quickjump dropdown context sensitive
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | unscheduled |
Component: | version control/browser | Version: | 0.12.2 |
Severity: | normal | Keywords: | patch |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
Hi, I made my quickjump context menu context sensitive because I have many many projects within the same erpository, and adding them all by hand to the trac.ini would not only be tedious, it would also confuse people since they probably only want to see available tags/branches to whatever server/program/library they are currently looking at.
I made a little patch to my trac 0.12.2 that does exactly what I want, but I guess to make it a full feature it should be configurable in some way (at lest switch it on/off, restrict it to some directory or all that match a pattern, or have some special keyword that gets substituted by the current path, or all at once).
Here are the changes:
-
versioncontrol/web_ui/browser.py
diff -r -U5 /root/src/Trac-0.12.2/trac/versioncontrol/web_ui/browser.py ./versioncontrol/web_ui/browser.py
old new 396 397 397 398 quickjump_data = properties_data = None 398 399 if node and not xhr: 399 400 properties_data = self.render_properties( 400 401 'browser', context, node.get_properties()) 401 quickjump_data = list(repos.get_quickjump_entries(rev ))402 quickjump_data = list(repos.get_quickjump_entries(rev,path)) 402 403 403 404 data = { 404 405 'context': context, 'reponame': reponame, 'repos': repos, 405 406 'repoinfo': all_repositories.get(reponame or ''), 406 407 'path': path, 'rev': node and node.rev, 'stickyrev': rev, -
versioncontrol/svn_fs.py
diff -r -U5 /root/src/Trac-0.12.2/trac/versioncontrol/svn_fs.py ./versioncontrol/svn_fs.py
old new 399 399 self.repos = self.fs_ptr = self.pool = None 400 400 401 401 def get_base(self): 402 402 return self.base 403 403 404 def _get_tags_or_branches(self, paths ):404 def _get_tags_or_branches(self, paths, showpath = None): 405 405 """Retrieve known branches or tags.""" 406 for path in self.params.get(paths, []): 406 mypaths=self.params.get(paths,[]) 407 if( showpath and showpath.startswith("trunk") ): 408 npath=showpath.replace("trunk",paths) 409 if( not npath.endswith("/") ): 410 npath += "/" 411 npath += "*" 412 mypaths.append(npath) 413 for path in mypaths: 407 414 if path.endswith('*'): 408 415 folder = posixpath.dirname(path) 409 416 try: 410 417 entries = [n for n in self.get_node(folder).get_entries()] 411 418 for node in sorted(entries, key=lambda n: … … 418 425 try: 419 426 yield self.get_node(path) 420 427 except: # no right 421 428 pass 422 429 423 def get_quickjump_entries(self, rev ):430 def get_quickjump_entries(self, rev, showpath = None): 424 431 """Retrieve known branches, as (name, id) pairs. 425 432 426 433 Purposedly ignores `rev` and always takes the last revision. 427 434 """ 428 for n in self._get_tags_or_branches('branches' ):435 for n in self._get_tags_or_branches('branches',showpath): 429 436 yield 'branches', n.path, n.path, None 430 for n in self._get_tags_or_branches('tags' ):437 for n in self._get_tags_or_branches('tags',showpath): 431 438 yield 'tags', n.path, n.created_path, n.created_rev 432 439 433 440 def get_path_url(self, path, rev): 434 441 url = self.params.get('url', '').rstrip('/') 435 442 if url:
This should give you an idea of what the feature looks like that I wanted to have.
Attachments (0)
Change History (6)
comment:1 by , 13 years ago
Component: | general → version control/browser |
---|---|
Milestone: | → next-major-0.1X |
comment:2 by , 13 years ago
the patch assumes a structure of the svn like trunk/XXX/YYY and when you are looking at that in the browser, it automatically adds to the quickjump menu a list of things present in /branches/XXX/YYY/* and /tags/XXX/YYY/* so you can quickly jump to one of the tags/branches made out of the currently viewed trunk. Of course not everyone will have this struture or wants this feature, so to be a real feature it would need to be configureable.
comment:3 by , 12 years ago
Description: | modified (diff) |
---|---|
Milestone: | next-major-releases → unscheduled |
Version: | → 0.12.2 |
comment:4 by , 12 years ago
[OT] not sure what's going on in the description for the styling of the second file…
comment:5 by , 12 years ago
Summary: | (almost patch) make browser quickjum dropdown context sensitive → (almost patch) make browser quickjump dropdown context sensitive |
---|
comment:6 by , 9 years ago
Keywords: | patch added |
---|
I fail to see what the patch does (or how it could work…
showpath.replace("trunk", paths)
wherepaths
is alist
?), so please provide us with an example instead.I do see a few possible enhancements for the quickjump features though: