[PATCH 1 of 2] churn: use .hgchurn as map file by default
Martin Geisler
mg at daimi.au.dk
Tue Apr 28 13:17:47 CDT 2009
# HG changeset patch
# User Martin Geisler <mg at lazybytes.net>
# Date 1240942083 -7200
# Node ID bddf20eea11e5fd01f1fdd6596158ca56622ed8a
# Parent f802b4706a53fd7c12e1a8f25ca07e909fda1a03
churn: use .hgchurn as map file by default
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 @@
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()
diff --git a/tests/test-churn b/tests/test-churn
--- a/tests/test-churn
+++ b/tests/test-churn
@@ -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
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 @@
alias3 3 **************************************************************
alias1 3 **************************************************************
user2 2 *****************************************
+% churn with .hgchurn
+alias3 3 **************************************************************
+alias1 3 **************************************************************
+user2 2 *****************************************
% churn with column specifier
user3 3 ***********************
user1 3 ***********************
More information about the Mercurial-devel
mailing list