Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Trac: Tickets

[The Trac Project] #2556: Easy switching between revisions while previewing a file in browser

 

 

Trac tickets RSS feed   Index | Next | Previous | View Threaded


noreply at edgewall

Jan 4, 2006, 7:44 AM

Post #1 of 5 (4736 views)
Permalink
[The Trac Project] #2556: Easy switching between revisions while previewing a file in browser

#2556: Easy switching between revisions while previewing a file in browser
------------------------------+---------------------------------------------
Reporter: pete[at]parkmed.com | Owner: jonas
Type: enhancement | Status: new
Priority: normal | Milestone: 0.9.3
Component: browser | Version: 0.9.2
Severity: normal | Keywords:
------------------------------+---------------------------------------------
While previewing a file in the browser it is helpful to be able to quickly
jump back and forth between revisions. Attatched is a patch to the current
/trunk/versioncontrol/web/browser.py to add links to the oldest, previous,
next, and most recent revisions to a file being previewed. I'm not
familiar with hacking the templates, so the links simply appear in the
'alternate' file downloads area.

{{{
--- browser.py 2006-01-04 10:16:03.000000000 -0500
+++ browser.py 2006-01-04 10:19:30.000000000 -0500
@@ -25,6 +25,7 @@
from trac.web.chrome import add_link, add_stylesheet,
INavigationContributor
from trac.wiki import wiki_to_html, wiki_to_oneliner, IWikiSyntaxProvider
from trac.versioncontrol.web_ui.util import *
+from trac.versioncontrol.svn_authz import SubversionAuthorizer


IMG_RE = re.compile(r"\.(gif|jpg|jpeg|png)(\?.*)?$", re.IGNORECASE)
@@ -211,6 +212,34 @@
mime_type = get_mime_type(content)
use_rev = rev and node.rev

+ newestchgset = repos.get_youngest_rev()
+ nodehistory = repos.get_path_history(node.path, newestchgset)
+ allrevs = list(nodehistory)
+ oldest_rev_num = len(allrevs) - 1
+ oldest_rev = allrevs[oldest_rev_num]
+ oldest_path = '%s' % oldest_rev[0]
+ youngest_rev = allrevs[0]
+ youngest_path = '%s' % youngest_rev[0]
+ temprev = 0
+ ##find the current rev
+ for revision in allrevs:
+ if revision[1] == int(node.rev):
+ break
+ else:
+ temprev += 1
+ continue
+
+ current_rev = allrevs[temprev]
+
+ if current_rev != oldest_rev:
+ previous_rev = allrevs[temprev + 1]
+ prev_path = '%s' % previous_rev[0]
+ if previous_rev != oldest_rev:
+ add_link(req, 'alternate',
self.env.href.browser(oldest_path, rev=oldest_rev[1]), 'Oldest Revision')
+ add_link(req, 'alternate',
self.env.href.browser(prev_path, rev=previous_rev[1]), 'Previous
Revision')
+ else:
+ add_link(req, 'alternate',
self.env.href.browser(oldest_path, rev=oldest_rev[1]), 'Previous (Oldest)
Revision')
+
if not is_binary(content):
if mime_type != 'text/plain':
plain_href = self.env.href.browser(node.path,
rev=use_rev,
@@ -230,6 +259,16 @@
add_link(req, 'alternate', raw_href, 'Original Format',
mime_type)
req.hdf['file.raw_href'] = raw_href

+ if current_rev != youngest_rev:
+ next_rev = allrevs[temprev - 1]
+ next_path = '%s' % next_rev[0]
+ if temprev - 1 > 0 and next_rev != youngest_rev:
+ add_link(req, 'alternate',
self.env.href.browser(next_path, rev=next_rev[1]), 'Next Revision')
+ add_link(req, 'alternate',
self.env.href.browser(youngest_path, rev=youngest_rev[1]), 'Most Recent
Revision')
+ else:
+ add_link(req, 'alternate',
self.env.href.browser(youngest_path, rev=youngest_rev[1]), 'Next (Most
Recent) Revision')
+
+
add_stylesheet(req, 'common/css/code.css')

# IWikiSyntaxProvider methods
}}}

--
Ticket URL: <http://projects.edgewall.com/trac/ticket/2556>
The Trac Project <http://trac.edgewall.com/>


noreply at edgewall

Jan 4, 2006, 8:51 AM

Post #2 of 5 (4691 views)
Permalink
Re: [The Trac Project] #2556: Easy switching between revisions while previewing a file in browser [In reply to]

#2556: Easy switching between revisions while previewing a file in browser
------------------------------+---------------------------------------------
Reporter: pete[at]parkmed.com | Owner: jonas
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: browser | Version: 0.9.2
Severity: normal | Resolution:
Keywords: |
------------------------------+---------------------------------------------
Changes (by cmlenz):

* milestone: 0.9.3 =>

Comment:

Using diff to compare versions sounds like a better idea to me. Anyway, no
enhancements on the maintenance branch.

--
Ticket URL: <http://projects.edgewall.com/trac/ticket/2556>
The Trac Project <http://trac.edgewall.com/>


noreply at edgewall

Jan 23, 2006, 6:39 AM

Post #3 of 5 (4688 views)
Permalink
Re: [The Trac Project] #2556: Easy switching between revisions while previewing a file in browser [In reply to]

#2556: Easy switching between revisions while previewing a file in browser
------------------------------+---------------------------------------------
Reporter: pete[at]parkmed.com | Owner: jonas
Type: enhancement | Status: closed
Priority: normal | Milestone: 0.10
Component: browser | Version: 0.9.2
Severity: normal | Resolution: fixed
Keywords: |
------------------------------+---------------------------------------------
Changes (by cboos):

* status: new => closed
* resolution: => fixed
* milestone: => 0.10

Comment:

The `trunk` has now this feature, since the merging of the TracDiff
branch.

See TracChangeset#CheckingtheLastChange.

--
Ticket URL: <http://projects.edgewall.com/trac/ticket/2556>
The Trac Project <http://trac.edgewall.com/>


noreply at edgewall

Jan 23, 2006, 6:57 AM

Post #4 of 5 (4683 views)
Permalink
Re: [The Trac Project] #2556: Easy switching between revisions while previewing a file in browser [In reply to]

#2556: Easy switching between revisions while previewing a file in browser
------------------------------+---------------------------------------------
Reporter: pete[at]parkmed.com | Owner: jonas
Type: enhancement | Status: closed
Priority: normal | Milestone: 0.10
Component: browser | Version: 0.9.2
Severity: normal | Resolution: fixed
Keywords: |
------------------------------+---------------------------------------------
Comment (by cboos):

PS: also, in the patch, the usage of `repos.get_path_history()`
seems to be quite inappropriate here. That method has a very specific
usage and should be used only in some situations (it's actually
used to implement the ''Show only add, removes'' mode of TracRevisionLog,
and for the ''search'' link shown in the TracBrowser when a path
is not found). You should have used simply `Repository.get_node()`
then `Node.get_history()`.

I also realize that the documentation for this method is misleading...
I'll fix that.

--
Ticket URL: <http://projects.edgewall.com/trac/ticket/2556>
The Trac Project <http://trac.edgewall.com/>


noreply at edgewall

Jun 24, 2006, 7:41 AM

Post #5 of 5 (4681 views)
Permalink
Re: [The Trac Project] #2556: Easy switching between revisions while previewing a file in browser [In reply to]

#2556: Easy switching between revisions while previewing a file in browser
------------------------------+---------------------------------------------
Reporter: pete[at]parkmed.com | Owner: jonas
Type: | Status: closed
Priority: | Milestone:
Component: | Version:
Severity: | Resolution: fixed
Keywords: MESSAGE |
------------------------------+---------------------------------------------
Changes (by Jalertfrehomeshirt):

* component: browser =>
* keywords: => MESSAGE
* milestone: 0.10 =>
* priority: normal =>
* severity: normal =>
* type: enhancement =>
* version: 0.9.2 =>

Comment:

We are pleased to inform you that now you can find your place of work
without leaving your house!
<a href=http://jalert.net/>http://www.jalert.Net</a> - is a mail based
recruitment business. It offers employers a genuine recruitment function
that combines the candidate capture function and the human resources
function of a recruitment agency. You just need to fill in a form and
jalert client service will send you an e-mail when a position that
interests you becomes available.

All operations are made manually, in order not to bore you with automated
robot search results. So, take your time to enter as much information
about your request and about yourself either.
<a href=http://jalert.net//register.htm>Registration Form</a>

Futhermore, <b>everyone will get a FREE T-shirt</b> of any size with
Jalert.net logo and your Initials printed on it! We assure you, that every
person who will find a job with the help of our service will receive this
<b>FREE Jalert.net T-shirt. </b>

<i>Thank you for your time. Jalert advert, Team</i>

--
Ticket URL: <http://projects.edgewall.com/trac/ticket/2556>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
Trac-Tickets[at]lists.edgewall.com
http://lists.edgewall.com/mailman/listinfo/trac-tickets

Trac tickets RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.