RcpathExtension

This extension is not distributed with Mercurial.

Author: G. Grothendieck

Download site: Download direct from this page - rcpath.py

Overview

This extension displays Mercurial configuration file paths and names.

hg rcpath

show path/file names to startup files

options:

 -a --all         all path/names that could be used
 -d --duplicates  retain duplicates
 -n --notused     path/names not in use

use "hg -v help rcpath" to show global options

NOTE: The current source is out of date for recent versions of Mercurial. replace scmutil for util in line 11 to fix.

Configuration

Configure your .hgrc to enable the extension by adding following lines:

[extensions]
rcpath=/path/to/rcpath.py

or place rcpath.py in your 'hgext' directory and add the following lines:

[extensions]
hgext.rcpath=

To perform the above configuration you will need to know at least one .hgrc or mercurial.ini pathname. The information for this can be found at hgrc.5.txt and includes locations such as ~/.hgrc and usually /etc/mercurial/hgrc on UNIX/Linux and %USERPROFILE%\.hgrc (e.g. C:\Users\JoeDoe\.hgrc) on Windows.

If you can't figure it out from that then the following shows how to get a list of the pathnames without previously installing rcpath. Make sure that you have a working tar (Windows users can download and install Rtools from http://www.murdoch-sutherland.com/Rtools/ which contains tar.exe that can be placed on the PATH or in the current directory or get tar.exe from one of any of a number of other free sources on the net) and Python:

1. download mercurial source from:

http://www.selenic.com/mercurial/release

2. run the following console/shell commands except the last two lines are entered into the python command line. Also note that the portion typed by the user is the portion after the last > on each line. The example here uses Mercurial 1.0.2 but replace that with whatever is the latest version:

C:\tmp> tar xvfz mercurial-1.0.2.tar.gz
C:\tmp> cd mercurial-1.0.2/mercurial
C:\tmp\mercurial-1.0.2\mercurial> python
>>> from util import *
>>> rcpath()

Examples

Here is an example of the use of the rcpath extension showing the two rc files that are currently being used. The first line is the input and the subsequent lines are the output that is returned.

C:\>hg rcpath
C:\Program Files\TortoiseHg\mercurial.ini
C:\Users\Jones\.hgrc

In the following example we use the -n flag to show those rcpath names that are not in use:

C:\>hg rcpath -n
C:\Users\Jones\mercurial.ini

In the next example we use the -a flag to show all rcpath names including both those in use and those not in use:

C:\>hg rcpath -a
C:\Program Files\TortoiseHg\mercurial.ini
C:\Users\Jones\mercurial.ini
C:\Users\Jones\.hgrc


CategoryExtensionsByOthers

RcpathExtension (last edited 2013-04-15 14:49:55 by fw-tnat)