Difference between revisions of "Mercurial Tools"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with "{{OSWikiLearnBox}} The Mercurial repository https://bitbucket.org/lindenlab/hg-tools contains tools for working with Linden Lab repositories. '''You are strongly encourage…")
 
Line 22: Line 22:
Check changes against Linden Lab coding policy
Check changes against Linden Lab coding policy


   <nowiki>hg policy {[-f FILE] | [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]}</nowiki>
   <nowiki>hg policy [-p {opensource|proprietary}] {[-f FILE] | [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]}</nowiki>


With no arguments, check uncommitted changes in the working directory.
With no arguments, check uncommitted changes in the working directory.
Line 32: Line 32:
When given a remote repository, check changes that have been committed locally that are not present in the remote repository.  To check changes that would be pushed by default, specify "default-push" as the repository name.
When given a remote repository, check changes that have been committed locally that are not present in the remote repository.  To check changes that would be pushed by default, specify "default-push" as the repository name.


The checks may be against either of two policy sets: opensource or proprietary
'''options:'''
'''options:'''


-r --rev ''REVISION''[+]  a specific revision up to which you would like to check
;-p|--policy ''POLICY''
-f --file ''FILE''     a file to check
:The set of policies to check: POLICY may be either 'opensource' or 'proprietary' (the default depends on the repository)
;-r|--rev ''REVISION''
:a revision up to which you would like to check (may be specified more than once for a range)
;-f|--file ''FILE''
:a file to check (whether or not it has been modified)


=== Commit Hook ===
=== Commit Hook ===

Revision as of 06:24, 17 August 2011

The Mercurial repository

https://bitbucket.org/lindenlab/hg-tools

contains tools for working with Linden Lab repositories.

You are strongly encouraged to check out a copy of this repository and install the coding policy script there as described below, since anything you submit will have to pass those checks.

Coding Policy

The coding_policy.py file provides both a Mercurial command extension hg policy and a hook that you should install to check all files when they are committed.

To install the extension, add the following to your $HOME/.hgrc file (changing /path/to to the location where you checked out the hg-tools repository):

[extensions]
policy = /path/to/coding_policy.py

hg policy command

Check changes against Linden Lab coding policy

 hg policy [-p {opensource|proprietary}] {[-f FILE] | [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]}

With no arguments, check uncommitted changes in the working directory.

A specific file (whether or not it has been added to the repository or modified) can be checked by using the -f/--file file option.

When revisions are specified via -r/--rev, check the given committed changes in the local repository.

When given a remote repository, check changes that have been committed locally that are not present in the remote repository. To check changes that would be pushed by default, specify "default-push" as the repository name.

The checks may be against either of two policy sets: opensource or proprietary options:

-p|--policy POLICY
The set of policies to check: POLICY may be either 'opensource' or 'proprietary' (the default depends on the repository)
-r|--rev REVISION
a revision up to which you would like to check (may be specified more than once for a range)
-f|--file FILE
a file to check (whether or not it has been modified)

Commit Hook

All changes pulled to a Linden Lab repository will have to pass the checks enforced by the command above. This is enforced when the changes are pulled by the hook provided by coding_policy.py.

To make that check automatic when you are doing local commits, add the following to your $HOME/.hgrc file (changing /path/to to the location where you checked out the hg-tools repository):

[hooks]
pretxncommit.coding_policy = python:/path/to/coding_policy.py:hook

you can also check all changes you pull into your repository by adding this (also under \[hooks\]):

pretxnchangegroup.coding_policy = python:/path/to/coding_policy.py:hook