Ticket #3644 (closed defect: duplicate)
Opened 5 years ago
Last modified 5 years ago
PATCH: allow source: TracLinks with line number but no revision
| Reported by: | hyugaricdeau@… | Owned by: | cboos |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | version control | Version: | devel |
| Severity: | minor | Keywords: | TracLinks |
| Cc: | |||
| Release Notes: | |||
| API Changes: | |||
Description
Currently, to include a line number in a link, the revision also has to be specified, for example: [source:/path/to/file@3#L5]. However, a link like [source:/path/to/file#L5] will end up linking to the file at revision 5. This is just a simple change to the regexp used.
Attachments
Change History
Changed 5 years ago by hyugaricdeau@…
- Attachment trac-source-links.patch added
comment:1 Changed 5 years ago by cboos
- Component changed from general to version control
- Owner changed from jonas to cboos
- Version set to devel
comment:2 Changed 5 years ago by hyugaricdeau@…
I see--I had some users complaining about this, and thought it might be a bug, as I wasn't sure about the rationale. But this makes sense, and I'll pass your points along. I also didn't realize that source:file#rev was actually correct, albeit deprecated syntax.
I still wonder if there isn't a better solution. But I'll have to think about it.
comment:3 Changed 5 years ago by cboos
We could support source:file#rev and source:file#Lxyz (with xyz a line number) at the same time, and in the latter case use the youngest rev, so it's not a technical issue, it's more that we don't want to encourage creating links that will most certainly become non-sense over time.
In the few cases where you're pretty sure the meaning of a line number will remain the same over time (near top of the file, source file below /tags, or nearly frozen branches, etc.), you could still use @head.
Someone also proposed being able to link to function name or class names within source files, and I think that's a good idea, which I still keep in mind for doing later, when we implement the necessary infrastructure to post-process the result of code highlighters (see #1520 and #1292).
comment:4 Changed 5 years ago by cboos
- Resolution set to duplicate
- Status changed from new to closed



The idea was to make the revision mandatory on purpose, as a line numbers aren't good for permanent reference, i.e. what's at line 100 at rev. 1000 will probably have nothing to do with what's at line 100 at rev. 2000.
If you really want to refer to the last revision of a file, you can use @head.
But I'm open to other opinions.
Note also that at least for 0.10, we must still support the source:file#rev (deprecated) syntax.