Opened 20 years ago
Closed 20 years ago
#2100 closed enhancement (fixed)
Implement a TracLinks syntax for targeting line numbers in repository files
| Reported by: | Christian Boos | Owned by: | Christopher Lenz |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.9 |
| Component: | version control/browser | Version: | devel |
| Severity: | normal | Keywords: | source link line number |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
In order to support code reviews, either formal or informal, it's necessary to be able to precisely refer to line numbers.
Trac should support a simple syntax for this. I would suggest the following (lifted from ticket #2011):
- source:trunk/README@head or source:trunk/README@123 the new peg revision notation
- source:trunk/README@123#100 the new peg revision notation, with line number (line 100 in revision 123)
- source:trunk/README@123#100:110 line number range support?
While it's obvious what the target of a link to a single line number should be, the target of a range is a little bit less obvious.
Attachments (0)
Change History (5)
comment:1 by , 20 years ago
comment:2 by , 20 years ago
| Component: | wiki → browser |
|---|---|
| Milestone: | → 0.9 |
| Owner: | changed from to |
| Status: | new → assigned |
I don't see how we could support line number ranges, but the rest looks good.
About change #l100 to #line100 I'm not sure that's worth the extra three bytes per line. Maybe just use an upper-case L to avoid it being confused with a 1.
comment:4 by , 20 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
Ok, yeah the uppercase L seems sufficiently clear. However, my main point above was that it seems more consistent to use source:/README@123#L12 so the anchor in the link syntax is the same as the actual URL anchor.



Yes, I think this would be generally preferrable to current use of # for specifying a revision. However, I think that we should use the existing line anchors which are like #l100 (though in some ways I'd sort of prefer to change that to #line100, since the lower case 'l' can look a bit like a '1', which is confusing).
Is there any precedence in Trac for deprecating Wiki syntaxes? I think that the current #rev syntax should be removed at some point after the @rev is implemented, but I don't know how we'd want to handle that.