Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

#2011 closed enhancement (fixed)

Use SVN-like peg revisions instead of own syntax

Reported by: Manuzhai Owned by: Christian Boos
Priority: normal Milestone: 0.9
Component: version control/browser Version: 0.9b1
Severity: minor Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

With the source browser, there is currently the source:/#2100 syntax. In Subversion, peg revisions can be used with the command line client that have an @: source:/@1200. I think we should support the latter syntax and maybe deprecate the former.

Attachments (0)

Change History (4)

comment:1 by Christian Boos, 19 years ago

Owner: changed from Jonas Borgström to Christian Boos
Severity: normalminor
Status: newassigned
Summary: Use SVN-like peg revisions instead of invented syntaxUse SVN-like peg revisions instead of own syntax

Yes; I'd prefer explaining things once to my users, and not have to answer questions like: why does Subversion use @ and Trac uses #?

The fix is easy:

Index: trac/versioncontrol/web_ui/util.py
===================================================================
--- trac/versioncontrol/web_ui/util.py  (revision 2198)
+++ trac/versioncontrol/web_ui/util.py  (working copy)
@@ -24,7 +24,7 @@

 __all__ = [ 'get_changes', 'get_path_links', 'get_path_rev' ]

-rev_re = re.compile(r"([^#]*)#(.+)")
+rev_re = re.compile(r"([^@#]*)[@#](.+)") # also support SVN's peg revision

 def get_changes(env, repos, revs, full=None, req=None, format=None):
     db = env.get_db_cnx()

As a side-effect, the log: syntax will also support peg revisions: log:trunk@2000:2200

comment:2 by Christian Boos, 19 years ago

Milestone: 0.9

… and as a follow-up to r2199, the link to the Rev of the file inside the Revision Log View could be displayed as @xyz.

  • log.cs

     
    108108     <td class="date"><?cs var:log.changes[item.rev].date ?></td>
    109109     <td class="rev">
    110110      <a href="<?cs var:item.browser_href ?>"
    111          title="Browse at revision <?cs var:item.rev ?>"><?cs var:item.rev ?></a>
     111         title="Browse at revision <?cs var:item.rev ?>">@<?cs var:item.rev ?></a>
    112112     </td>
    113113     <td class="chgset">
    114114      <a href="<?cs var:item.changeset_href ?>"

I think this change is important to bring in 0.9, as it will make it easier for people to adopt the new notation and deprecate the old one.

The symbol # should be used in a way consistent with the wiki page name syntax, to refer to a location within an object. In the case of source: links, this could be the line number (see #2035).

comment:3 by Christian Boos, 19 years ago

By the way, I just realized that supporting line number targets with "#" will not necessarily introduce an incompatibility: simply make the "@rev" part mandatory when referring to line number, which seems a good thing to do anyway… (line 100 of the "head"… which head?)

So:

Yes, one could still write source:trunk/README@head#100, but then the potential problem with that is made quite obvious…

comment:4 by Christian Boos, 19 years ago

Resolution: fixed
Status: assignedclosed

Applied the above patches in r2277.

The proposal for the line number syntax is now in a ticket of its own: #2100.

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.