Changes between Version 6 and Version 7 of Trac Repository Admin


Ignore:
Timestamp:
Jul 18, 2015, 12:43:07 PM (9 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Trac Repository Admin

    v6 v7  
    44== Quick start #QuickStart
    55
    6  * Manage repositories in the "Repository" admin panel, with `trac-admin` or in the `[repositories]` section of [wiki:TracIni#repositories-section trac.ini].
     6 * Enable the repository connector(s) for the version control system(s) that you will use.
     7 * Add repositories through the //Repositories// admin panel, with `trac-admin` or in the `[repositories]` section of [wiki:TracIni#repositories-section trac.ini].
    78 * Set up a call to `trac-admin $ENV changeset added $REPO $REV` in the post-commit hook of each repository. Additionally, add a call to `trac-admin $ENV changeset modified $REPO $REV` in the post-revprop-change hook of repositories allowing revision property changes.
    8  * Set the `sync_per_request` attribute to `false` to disable per-request syncing.
    9  * Make sure the user under which your Subversion hooks are run has write access to the Trac environment, or use a tool like `sudo` to temporarily elevate privileges.
     9 * Make sure the user under which your hooks are run has write access to the Trac environment, or use a tool like `sudo` to temporarily elevate privileges.
     10
     11== Enabling the components
     12
     13Support for version control systems is provided by optional components distributed with Trac, which are disabled by default //(since 1.0)//. Subversion and Git must be explicitly enabled if you wish to use them.
     14
     15The version control systems can be enabled by adding the following to the `[components]` section of your [TracIni#components-section trac.ini], or enabling the components in the //Plugins// admin panel.
     16
     17{{{#!ini
     18tracopt.versioncontrol.svn.* = enabled
     19}}}
     20
     21{{{#!ini
     22tracopt.versioncontrol.git.* = enabled
     23}}}
    1024
    1125== Specifying repositories #Repositories
    12 Trac supports more than one repository per environment. The repositories may be of the same type, or of different types. The repository configurations may be stored in different locations, the two supported by default being the [#ReposDatabase database store] and the [#ReposTracIni trac.ini configuration file].
    13 
    14 It is possible to define aliases of repositories, that act as "pointers" to real repositories. This can be useful when renaming a repository, to avoid breaking all the links to the old name.
    15 
    16 A number of attributes can be associated with each repository, which define the repository's location, type, name and how it is displayed in the source browser. The following attributes are supported:
     26Trac supports multiple repositories per environment, and the repositories may be for different version control system types. Each repository must be defined in a repository configuration provider, the two supported by default are the [#ReposDatabase database store] and the [#ReposTracIni trac.ini configuration file]. A repository should not be defined in multiple configuration providers.
     27
     28It is possible to define aliases of repositories, that act as "pointers" to real repositories. This can be useful when renaming a repository, to avoid breaking links to the old name.
     29
     30A number of attributes can be associated with each repository. The attributes define the repository's location, type, name and how it is displayed in the source browser. The following attributes are supported:
    1731
    1832||='''Attribute''' =||='''Description''' =||
     
    3044A repository `name` and one of `alias` or `dir` attributes are mandatory. All others are optional.
    3145
     46For some version control systems, it is possible to specify not only the path to the repository in the `dir` attribute, but also a ''scope'' within the repository. Trac will then only show information related to the files and changesets below that scope. The Subversion backend for Trac supports this. For other types, check the corresponding plugin's documentation.
     47
    3248After adding a repository, the cache for that repository must be re-synchronized once with the `trac-admin $ENV repository resync` command.
    3349
     
    8096Note that the default repository has an empty name, so it will likely need to be quoted when running `trac-admin` from a shell. Alternatively, the name "`(default)`" can be used instead, for example when running `trac-admin` in interactive mode.
    8197
     98== Repository caching
     99
     100The Subversion and Git repository connectors support caching, which improves the performance browsing the repository, viewing logs and viewing changesets. Cached repositories must be [#Synchronization synchronized]; either explicit or implicit synchronization can be used. When searching changesets, only cached repositories are searched.
     101
     102Subversion repositories are cached unless the type is `direct-svnfs`. Git repositories are cached when `[git]` [wiki:TracIni#git-section cached_repository] is `true`.
    82103
    83104== Repository synchronization #Synchronization
     
    145166{{{#!sh
    146167#!/bin/sh
     168tracenv=/path/to/env     # change with your Trac environment's path
     169repos=                   # change with your repository's name
    147170while read oldrev newrev refname; do
    148         git rev-list --reverse $newrev ^$oldrev  | \
    149         while read rev; do
    150                 trac-admin /path/to/env changeset added <repos> $rev
    151         done
     171    if [ "$oldrev" = 0000000000000000000000000000000000000000 ]; then
     172        git rev-list --reverse "$newrev" --
     173    else
     174        git rev-list --reverse "$newrev" "^$oldrev" --
     175    fi | xargs trac-admin "$tracenv" changeset added "$repos"
    152176done
    153177}}}
     
    190214For more information, see the documentation of the `CommitTicketUpdater` component in the //Plugins// admin panel and the [trac:CommitTicketUpdater] page.
    191215
    192 == Migration from a single-repository setup (Subversion) #Migration
    193 The following procedure illustrates a typical migration from a Subversion single-repository setup to multiple repositories.
    194 
    195  1. Remove the default repository specification from the `[trac] repository_dir` option.
    196  1. Add the main repository as a named repository.
    197  1. Re-synchronize the main repository.
    198  1. Set up post-commit and post-revprop-change hooks on the "main" repository, and set the repository's `sync_per_request` attribute to `false`.
    199  1. Add an alias to the main repository as the default repository (by leaving out the the `name`, e.g. `.alias = main`). This ensures that all links predating the migration still resolve to the main repository.
    200  1. Repeat steps 2, 3 and 4 to add other "named" repositories as needed.
    201 
    202 == Migration from a single-repository setup (Mercurial) #MigrationMercurial
    203 The following procedure illustrates a typical migration from a Mercurial single-repository setup to multiple repositories. Please note that at the time of writing, no initial resynchronization or any hooks are necessary for Mercurial repositories - see [trac:ticket:9485 #9485] for more information.
    204 
    205  1. Upgrade to the latest version of the [trac:TracMercurial] plugin.
    206  1. Remove the default repository specification from the `[trac] repository_dir` option.
    207  1. Add the main repository as a named repository.
    208  1. Add an alias to the main repository as the default repository (by leaving out the the `name`, e.g. `.alias = main`). This ensures that all links predating the migration still resolve to the main repository.
    209  1. Repeat step 3 to add other "named" repositories as needed.
    210 
    211216== Troubleshooting
    212217