Edgewall Software
Modify

Opened 12 years ago

Closed 11 years ago

Last modified 5 years ago

#234 closed enhancement (fixed)

Inter-project links

Reported by: david.larsson@… Owned by: Christian Boos
Priority: normal Milestone: 0.10
Component: wiki system Version: devel
Severity: major Keywords: intertrac
Cc: pixelpapst@…
Release Notes:
API Changes:

Description

It would be nice to be able to link between projects (on the same server), e.g. [link:/trac/TestPage A test page in the trac project]. I know I can use a full URL, but I want to use the same protocol (https/http) in the link as the current user session. (This is because I force user login on https but not on http).

Attachments (2)

intertrac.1017.diff (8.0 KB) - added by cboos@… 12 years ago.
Intertrac patch, made against 1017
intertrac.1017.2.diff (8.0 KB) - added by cboos@… 12 years ago.
Fixed version of the Intertrac patch against 1017.

Download all attachments as: .zip

Change History (35)

comment:1 Changed 12 years ago by daniel

A possible syntax, that also remains compatible with InterWikiLinks?:

  • project:#42 == project:ticket:42
  • project:WikiPage == project:wiki:WikiPage

See also: http://c2.com/cgi/wiki?InterWiki, http://c2.com/cgi/wiki?InterWiki

comment:2 Changed 12 years ago by daniel

A more advanced example:

{{{[project:changeset:42 my changeset]}}.

comment:3 Changed 12 years ago by daniel

Oops, didn't get quoting on that previous comment:

[project:changeset:42 my changeset]

comment:4 Changed 12 years ago by daniel

the <project> part should be automatically detemermined for locally hosted projects, but it should also reference an Intermap-style map, to retain the InterWiki semantic.

comment:5 Changed 12 years ago by daniel

Milestone: 0.8
Priority: normallow

comment:6 Changed 12 years ago by Daniel Lundin <daniel@…>

Milestone: 0.81.0

Changed 12 years ago by cboos@…

Attachment: intertrac.1017.diff added

Intertrac patch, made against 1017

comment:7 Changed 12 years ago by cboos@…

Priority: lownormal
Severity: normalenhancement
Version: 0.6devel

This ticket seems related to my need of handling intertrac links.

An intertrac link is a 1-character prefix you put before the ticket/changeset number, e.g. #T234 or [T1010]. It can also be set in a module href: ticket:T:234, changeset:T:1010.

Each prefix should be documented in the [intertrac] section of the conf/trac.ini file:

[intertrac]
T.title = Edgewall Trac
T.href = http://projects.edgewall.com/trac

(I hope this patch gets noticed, otherwise I'll create a new ticket for it)

Patch added intertrac.1017.diff

comment:8 Changed 12 years ago by cboos@…

Oops, the patch initially posted ( Fri Nov 5 09:37:01 2004. ) had a little typo in it, I just uploaded the fixed version.

The typo was:

  • trac/WikiFormatter.py

    === trac/WikiFormatter.py
    ==================================================================
     
    186186    def _tickethref_formatter(self, match, fullmatch):
    187187        intertrac = fullmatch.group('t_intertrac')
    188188        if intertrac:
    189             number = int(match[1+len(intertrac):-1])
     189            number = int(match[1+len(intertrac):])
    190190            href, title, _class = self._intertrac_link(intertrac)
    191191            return '<a class="%s" title="%s" href="%s/ticket/%d">#%d</a>' % (_class, title, href, number, number)
    192192        else:

Changed 12 years ago by cboos@…

Attachment: intertrac.1017.2.diff added

Fixed version of the Intertrac patch against 1017.

comment:9 Changed 12 years ago by Christopher Lenz

Isn't this just a special case of #40 (InterWiki links)?

comment:10 Changed 12 years ago by cboos@…

> Isn't this just a special case of #40 (InterWiki links)?

I think that an InterWiki link is a kind of InterTrac link, as the proposed cross-referencing is not only for Wiki pages, but for all trac related objects: wikis, tickets and changesets. That's why I added my intertrac patch here (#234) and not there (#40).

I find it useful to have quick shortcuts to other trac projects (like #T234 to refer to the #234 ticket for Trac), because sometimes you work on a project that involves multiple source repositories (SVN repositories only for now).

For instance, I have a trac database set up on a local source code repository for 3rd party software, which is managed by SVK. In there, I mirror the edgewall trac SVN repository.

I often need to refer to bugs and changesets from the official trac database for Trac when I hack my local version of Trac. I also often refer to our "main" SVN repository, under the control of a different trac database.

comment:11 Changed 12 years ago by cboos@…

I just fixed an embarassing bug in my patch:

!diff
=== WikiFormatter.py
==================================================================
--- WikiFormatter.py  (revision 1072)
+++ WikiFormatter.py  (local)
@@ -116,7 +116,7 @@
               r"""(?P<tickethref>!?#(?P<t_intertrac>[a-zA-z]?)\d+)""",
               r"""(?P<changesethref>!?\[(?P<c_intertrac>[a-zA-z]?)\d+\])""",
               r"""(?P<reporthref>!?\{\d+\})""",
-              r"""(?P<modulehref>!?((?P<modulename>bug|ticket|browser|source|repos|report|changeset|wiki|milestone|search):(?P<m_intertrac>[a-zA-z]:?)(?P<moduleargs>(&#34;(.*?)&#34;|'(.*?)')|([^ ]*[^\., \)]))))""",
+              r"""(?P<modulehref>!?((?P<modulename>bug|ticket|browser|source|repos|report|query|changeset|wiki|milestone|search):(?P<m_intertrac>[a-zA-z]:)?(?P<moduleargs>(&#34;(.*?)&#34;|'(.*?)')|([^ ]*[^\., \)]))))""",
               r"""(?P<wikilink>!?(^|(?<=[^A-Za-z]))[A-Z][a-z]+(?:[A-Z][a-z]*[a-z/])+(?=\Z|\s|,|\.|:|\)))""",
               r"""(?P<fancylink>!?\[(?P<fancyurl>([a-z]+:[^ ]+)) (?P<linkname>.*?)\])"""]

comment:12 Changed 12 years ago by cboos@…

(Once again, coffee badly needed…)

  • WikiFormatter.py

    === WikiFormatter.py
    ==================================================================
     
    116116              r"""(?P<tickethref>!?#(?P<t_intertrac>[a-zA-z]?)\d+)""",
    117117              r"""(?P<changesethref>!?\[(?P<c_intertrac>[a-zA-z]?)\d+\])""",
    118118              r"""(?P<reporthref>!?\{\d+\})""",
    119               r"""(?P<modulehref>!?((?P<modulename>bug|ticket|browser|source|repos|report|changeset|wiki|milestone|search):(?P<m_intertrac>[a-zA-z]:?)(?P<moduleargs>(&#34;(.*?)&#34;|'(.*?)')|([^ ]*[^\., \)]))))""",
     119              r"""(?P<modulehref>!?((?P<modulename>bug|ticket|browser|source|repos|report|changeset|wiki|milestone|search):(?P<m_intertrac>[a-zA-z]:)?(?P<moduleargs>(&#34;(.*?)&#34;|'(.*?)')|([^ ]*[^\., \)]))))""",
    120120              r"""(?P<wikilink>!?(^|(?<=[^A-Za-z]))[A-Z][a-z]+(?:[A-Z][a-z]*[a-z/])+(?=\Z|\s|,|\.|:|\)))""",
    121121              r"""(?P<fancylink>!?\[(?P<fancyurl>([a-z]+:[^ ]+)) (?P<linkname>.*?)\])"""]
    122122

comment:13 Changed 12 years ago by cboos@…

…hum, what about a feature to edit/remove embarassingly stupid comments :)

  • WikiFormatter.py

    === WikiFormatter.py
    ==================================================================
     
    116116              r"""(?P<tickethref>!?#(?P<t_intertrac>[a-zA-z]?)\d+)""",
    117117              r"""(?P<changesethref>!?\[(?P<c_intertrac>[a-zA-z]?)\d+\])""",
    118118              r"""(?P<reporthref>!?\{\d+\})""",
    119               r"""(?P<modulehref>!?((?P<modulename>bug|ticket|browser|source|repos|report|changeset|wiki|milestone|search):(?P<m_intertrac>[a-zA-z]:?)(?P<moduleargs>(&#34;(.*?)&#34;|'(.*?)')|([^ ]*[^\., \)]))))""",
     119              r"""(?P<modulehref>!?((?P<modulename>bug|ticket|browser|source|repos|report|changeset|wiki|milestone|search):(?P<m_intertrac>[a-zA-z]:)?(?P<moduleargs>(&#34;(.*?)&#34;|'(.*?)')|([^ ]*[^\., \)]))))""",
    120120              r"""(?P<wikilink>!?(^|(?<=[^A-Za-z]))[A-Z][a-z]+(?:[A-Z][a-z]*[a-z/])+(?=\Z|\s|,|\.|:|\)))""",
    121121              r"""(?P<fancylink>!?\[(?P<fancyurl>([a-z]+:[^ ]+)) (?P<linkname>.*?)\])"""]
    122122

comment:14 Changed 11 years ago by Matthew Good

Well, it looks like cboos put [1505] in his branch related to this. I would prefer the original syntax proposed by daniel. The patch apparently supports arbitrary length names, although cboos tends to use a single character. I think that the syntax used by [1505] is ok if it is just a single character name, but for longer names I think the original syntax would work better.

I think we want to focus on handling the longer names, since for multi-project setups people will want to use the project's path as its InterTrac name. This will be important for forwards compatibility, since as daniel noted earlier, we should provide out-of-the-box support for linking to other projects in a multi-project installation.

comment:15 Changed 11 years ago by Christian Boos

Owner: changed from Jonas Borgström to Christian Boos
Status: newassigned

Well, I don't mind changing in favor of <project>:<module>:<id>, instead of <module>:<project>:<id>, for long links.

However, I largely prefer #<project><id> over <project>:#<id> and [<project><id>] over <project>:[<id>], for short-hand links.

I'll also have a look how to handle InterWiki links (#40) at the same time.

comment:16 Changed 11 years ago by Matthew Good

Well, besides just a personal preference for <project>:#<id> and the equivalents for other modules, the problem I can see with #<project><id> is possible ambiguities. Particularly, if the project name contains a number, it becomes difficult or impossible to determine what's part of the project name and what's the id. Numbers are valid for project URLs, so there's a chance that people are using them in multi-project setups. I don't think : characters are nearly as likely to be in a project URL as a number would be.

comment:17 Changed 11 years ago by Christian Boos

#<project><id> … ambiguities. Particularly, if the project name contains a number

I see. My original idea was not to use the project name, but a project key, a kind of shortcut, e.g. T for Trac's Trac, most of the time one letter, but I allowed for more in case disambiguation is needed.

Now I also see the benefit of using the environment's name, for automatic linking into a Trac hosted by the same server, removing the need of setting up an [intertrac] section in TracIni.

Anyway, one can have the full project name and additionally define a project key, e.g. one of our environment is bct_repository: you can see it's more convenient to type #b123 than bct_repository:#123.

comment:18 Changed 11 years ago by Christian Boos

I tried to get the best of both worlds in [1508]. See the updated InterTrac specification. Please test!

comment:19 Changed 11 years ago by trac@…

One simple way to fulfill David's original request is to use relative URLs, which use the same protocol as the current page. If you need to construct an absolute URL that uses the same protocol, you can use the relatively unknown protocol-relative URL link syntax:

hostname.domain/path/to/filename.ext

(just leave off the http:)

comment:20 Changed 11 years ago by Christian Boos

I think the InterTrac feature is candidate for merging, see [1569].

Feedback welcomed!

comment:21 Changed 11 years ago by ebcom

Using URLs (relative or absolute) is a bad idea: What about if the server name changes, or if the projects change on the server?: all the Wiki syntax (including pages, tickets, milestones, etc.) would have to be updated ;-(

InterTrac proposal seems nice. I hope it would be merged (very) soon into the trunk, as the need for InterTrac links is increasing every day.

Any comment from C.Lenz ?

comment:22 Changed 11 years ago by Christian Boos

Milestone: 1.00.9
Priority: normalhigh

It would help to get some feedback about the feature. You can do a checkout of the intertrac-branch

svn co http://svn.projects.edgewall/trac/branches/cboos-dev/intertrac-branch

and setup several test environments, all managed by one tracd server, and tell us what you think.

Btw, if you rename an environment, you either have to rename the links or you have to setup an alias, e.g.

[intertrac]
# 'testproj' is now named 'project', but let's keep the intertrac links working
testproj = project

comment:23 Changed 11 years ago by Christopher Lenz

Component: generalwiki

comment:24 Changed 11 years ago by Christian Boos

Priority: highhighest

The feature was reimplemented against the current trunk.

Check out r1912.

Note: The InterTrac branch is a superset of the TracDiff branch. This has the advantage of needing less work for me in order to stay in sync with the trunk in all of my branches, and has the only disadvantage of needing a bit of work if one wants to isolate the feature.

But this isolation work should not happen often, in fact at most once if we decide to integrate InterTrac and not TracDiff, whereas the synchronization of the branches with the trunk happens quite regularly…

comment:25 Changed 11 years ago by anonymous

이렇게 올리면 되는걸까요?

comment:26 Changed 11 years ago by Christian Boos

Milestone: 0.91.0
Priority: highestnormal
Severity: normalmajor

This will be post-poned to 1.0.

The InterTrac branch will be actively maintained meanwhile, and a patch for each released 0.9 version will be uploaded here.

comment:27 Changed 11 years ago by Christian Boos

I created a special purpose ticket for the branch integration: #2041. You can find the patches against 0.9.x there.

comment:28 Changed 11 years ago by anonymous

Cc: trac.tickets@… added

comment:29 Changed 11 years ago by Christian Boos

Keywords: intertrac added

comment:30 Changed 11 years ago by pixelpapst@…

Cc: pixelpapst@… added

comment:31 Changed 11 years ago by Christian Boos

Milestone: 1.00.10

The syntax proposed by mgood is not working anymore for changesets and reports, because of issues like #1153 and #2240.

Only ticket links like trac:#234 are still working that way, so now there's the question to keep that as special cases or not.

Other forms of shorthand intertrac links still work (e.g. [T1505] or [trac 1505] and #T234).

comment:32 Changed 11 years ago by Christian Boos

Resolution: fixed
Status: assignedclosed

Inter-project links (InterTrac links) are now part of the mainstream Trac, since r2839.

comment:35 Changed 5 years ago by trac.tickets@…

Cc: trac.tickets@… removed

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.