Edgewall Software

Version 35 (modified by Christian Boos, 16 years ago) ( diff )

How to link to a remote Trac at the toplevel (r6137)

This page documents the 1.4 (latest stable) release. Documentation for other releases can be found here.

InterTrac Links

Trac supports a convenient way to refer to resources of other Trac servers, from within the Wiki markup, since version 0.10.

Definitions

An InterTrac link can be seen as a scoped TracLinks. It is used for referring to a Trac resource (Wiki page, changeset, ticket, …) located in another Trac environment.

List of Active InterTrac Prefixes

PrefixTrac Site
bhAlias for bloodhound
bittenBitten
blAlias for Babel
bnAlias for Bitten
btAlias for Bitten
demo-1.0https://trac.edgewall.org/demo-1.0
demo-1.2https://trac.edgewall.org/demo-1.2
demo-1.3https://trac.edgewall.org/demo-1.3
demo-1.4https://trac.edgewall.org/demo-1.4
gAlias for Genshi
genshiGenshi
hAlias for TracHacks
tAlias for trac
thAlias for TracHacks
tracThe Trac Project
trachacksTrac-Hacks Community Site

Link Syntax

Simply use the name of the other Trac environment as a prefix, followed by a colon, ending with the resource located in the other environment.

<target_environment>:<TracLinks>

The other resource is specified using a regular TracLinks, of any flavor.

That target environment name is either the real name of the environment, or an alias for it. The aliases are defined in trac.ini (see below). The prefix is case insensitive.

For convenience, there's also some alternative short-hand form, where one can use an alias as an immediate prefix for the identifier of a ticket, changeset or report: (e.g. #T234, [T1508], [trac 1508], …)

Examples

It is necessary to setup a configuration for the InterTrac facility. This configuration has to be done in the TracIni file, [intertrac] section.

You cannot define aliases that have the same name as a complex type - if you do the InterTrac macro will return an error "object does not support item assignment" as it tries to assign properties to a basic string variable.

Hm, this looks like a bug. Can you open a ticket for that, please? (don't forget to get the backtrace for that error, which you can find in the log) — cboos

Example configuration:

...
[intertrac]
# -- Example of setting up an alias:
t = trac

# -- Link to an external Trac:
trac.title = Edgewall's Trac for Trac
trac.url = http://projects.edgewall.com/trac
trac.compat = false

The .url is mandatory and is used for locating the other Trac. This can be a relative URL in case that Trac environment is located on the same server.

The .title information will be used for providing an useful tooltip when moving the cursor over an InterTrac links.

Finally, the .compat option can be used to activate or disable a compatibility mode:

  • If the targeted Trac is running a version below milestone:0.10 (r3526 to be precise), then it doesn't know how to dispatch an InterTrac link, and it's up to the local Trac to prepare the correct link. Not all links will work that way, but the most common do. This is called the compatibility mode, and is true by default.
  • If you know that the remote Trac knows how to dispatch InterTrac links, you can explicitely disable this compatibility mode and then any TracLinks can become an InterTrac link.

Now, given the above configuration, one could create the following links:

The generic form intertrac_prefix:module:id is translated to the corresponding URL <remote>/module/id, shorthand links are specific to some modules (e.g. #T234 is processed by the ticket module) and for the rest (intertrac_prefix:something), we rely on the TracSearch#quickjump facility of the remote Trac.


Discussion

I think that the trac prefix could even be set as a default in the [intertrac] TracIni section. —CB

I modified the trac svn post-commit hook to use such a prefix to choose among several Trac instances in which to modify tickets (e.g. closes bigclient:#54), since they all share one repository. —DWA


See also: TracLinks, InterWiki

Note: See TracWiki for help on using the wiki.