changeset 8254:f108e89400d8

churn: use .hgchurn in repo root as default map file
author Martin Geisler <mg@lazybytes.net>
date Wed, 29 Apr 2009 20:03:54 +0200
parents e553fe565c61
children e68e149f4d44
files hgext/churn.py tests/test-churn tests/test-churn.out
diffstat 3 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/churn.py	Sun Apr 26 01:49:12 2009 +0200
+++ b/hgext/churn.py	Wed Apr 29 20:03:54 2009 +0200
@@ -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 @@
 
     The map file format used to specify aliases is fairly simple:
 
-    <alias email> <actual email>'''
+    <alias email> <actual email>
+
+    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()
--- a/tests/test-churn	Sun Apr 26 01:49:12 2009 +0200
+++ b/tests/test-churn	Wed Apr 29 20:03:54 2009 +0200
@@ -39,6 +39,10 @@
 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
--- a/tests/test-churn.out	Sun Apr 26 01:49:12 2009 +0200
+++ b/tests/test-churn.out	Wed Apr 29 20:03:54 2009 +0200
@@ -15,6 +15,10 @@
 alias3      3 **************************************************************
 alias1      3 **************************************************************
 user2       2 *****************************************
+% churn with .hgchurn
+alias3      3 **************************************************************
+alias1      3 **************************************************************
+user2       2 *****************************************
 % churn with column specifier
 user3      3 ***********************
 user1      3 ***********************