# HG changeset patch # User Martin Geisler # Date 2009-04-29 18:03:54 # Node ID f108e89400d817df302a81ef61e827f569f04e98 # Parent e553fe565c6126c4350fcb58f224fc29915cd043 churn: use .hgchurn in repo root as default map file diff --git a/hgext/churn.py b/hgext/churn.py --- a/hgext/churn.py +++ b/hgext/churn.py @@ -10,7 +10,7 @@ from mercurial.i18n import _ from mercurial import patch, cmdutil, util, templater -import sys +import sys, os import time, datetime def maketemplater(ui, repo, tmpl): @@ -116,12 +116,18 @@ def churn(ui, repo, *pats, **opts): The map file format used to specify aliases is fairly simple: - ''' + + + By default .hgchurn in the working directory root will be used, if + it exists. Use the --aliases option to override this. + ''' def pad(s, l): return (s + " " * l)[:l] amap = {} aliases = opts.get('aliases') + if not aliases and os.path.exists(repo.wjoin('.hgchurn')): + aliases = repo.wjoin('.hgchurn') if aliases: for l in open(aliases, "r"): l = l.strip() diff --git a/tests/test-churn b/tests/test-churn --- a/tests/test-churn +++ b/tests/test-churn @@ -39,6 +39,10 @@ user1 alias1 user3 alias3 EOF hg churn --aliases ../aliases +echo % churn with .hgchurn +mv ../aliases .hgchurn +hg churn +rm .hgchurn echo % churn with column specifier COLUMNS=40 hg churn echo % churn by hour diff --git a/tests/test-churn.out b/tests/test-churn.out --- a/tests/test-churn.out +++ b/tests/test-churn.out @@ -15,6 +15,10 @@ user1 1 *************************** alias3 3 ************************************************************** alias1 3 ************************************************************** user2 2 ***************************************** +% churn with .hgchurn +alias3 3 ************************************************************** +alias1 3 ************************************************************** +user2 2 ***************************************** % churn with column specifier user3 3 *********************** user1 3 ***********************