Edgewall Software
Modify

Opened 20 years ago

Closed 18 years ago

Last modified 6 months 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@… Branch:
Release Notes:
API Changes:
Internal 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@… 19 years ago.
Intertrac patch, made against 1017
intertrac.1017.2.diff (8.0 KB ) - added by cboos@… 19 years ago.
Fixed version of the Intertrac patch against 1017.

Download all attachments as: .zip

Change History (35)

comment:1 by daniel, 20 years ago

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 by daniel, 20 years ago

A more advanced example:

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

comment:3 by daniel, 20 years ago

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

[project:changeset:42 my changeset]

comment:4 by daniel, 20 years ago

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 by daniel, 20 years ago

Milestone: 0.8
Priority: normallow

comment:6 by Daniel Lundin <daniel@…>, 20 years ago

Milestone: 0.81.0

by cboos@…, 19 years ago

Attachment: intertrac.1017.diff added

Intertrac patch, made against 1017

comment:7 by cboos@…, 19 years ago

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 by cboos@…, 19 years ago

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:

by cboos@…, 19 years ago

Attachment: intertrac.1017.2.diff added

Fixed version of the Intertrac patch against 1017.

comment:9 by Christopher Lenz, 19 years ago

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

comment:10 by cboos@…, 19 years ago

> 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 by cboos@…, 19 years ago

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 by cboos@…, 19 years ago

(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 by cboos@…, 19 years ago

…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 by Matthew Good, 19 years ago

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 by Christian Boos, 19 years ago

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 by Matthew Good, 19 years ago

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 by Christian Boos, 19 years ago

#<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 by Christian Boos, 19 years ago

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

comment:19 by trac@…, 19 years ago

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 by Christian Boos, 19 years ago

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

Feedback welcomed!

comment:21 by ebcom, 19 years ago

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 by Christian Boos, 19 years ago

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 by Christopher Lenz, 19 years ago

Component: generalwiki

comment:24 by Christian Boos, 19 years ago

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 by anonymous, 19 years ago

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

comment:26 by Christian Boos, 19 years ago

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 by Christian Boos, 19 years ago

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

comment:28 by anonymous, 18 years ago

Cc: trac.tickets@… added

comment:29 by Christian Boos, 18 years ago

Keywords: intertrac added

comment:30 by pixelpapst@…, 18 years ago

Cc: pixelpapst@… added

comment:31 by Christian Boos, 18 years ago

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 by Christian Boos, 18 years ago

Resolution: fixed
Status: assignedclosed

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

comment:35 by trac.tickets@…, 13 years ago

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.