Edgewall Software

Ticket #2011 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Use SVN-like peg revisions instead of own syntax

Reported by: Manuzhai Owned by: cboos
Priority: normal Milestone: 0.9
Component: version control/browser Version: 0.9b1
Severity: minor Keywords:
Cc:

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

Change History

Changed 3 years ago by cboos

  • owner changed from jonas to cboos
  • status changed from new to assigned
  • severity changed from normal to minor
  • summary changed from Use SVN-like peg revisions instead of invented syntax to Use 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

Changed 3 years ago by cboos

  • milestone set to 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).

Changed 3 years ago by cboos

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...

Changed 3 years ago by cboos

  • status changed from assigned to closed
  • resolution set to fixed

Applied the above patches in r2277.

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

Add/Change #2011 (Use SVN-like peg revisions instead of own syntax)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.