--- a/hgext/churn.py Sun Aug 29 10:54:22 2010 +0200
+++ b/hgext/churn.py Sun Aug 29 22:46:00 2010 +0200
@@ -129,10 +129,14 @@
aliases = repo.wjoin('.hgchurn')
if aliases:
for l in open(aliases, "r"):
- if not l.strip():
+ try:
+ alias, actual = l.split('=' in l and '=' or None, 1)
+ amap[alias.strip()] = actual.strip()
+ except ValueError:
+ l = l.strip()
+ if l:
+ ui.warn(_("skipping malformed alias: %s\n" % l))
continue
- alias, actual = l.split('=' in l and '=' or None, 1)
- amap[alias.strip()] = actual.strip()
rate = countrate(ui, repo, amap, *pats, **opts).items()
if not rate:
--- a/tests/test-churn Sun Aug 29 10:54:22 2010 +0200
+++ b/tests/test-churn Sun Aug 29 22:46:00 2010 +0200
@@ -40,6 +40,7 @@
user1 alias1
user3 alias3
+not-an-alias
EOF
hg churn --aliases ../aliases
echo % churn with .hgchurn
--- a/tests/test-churn.out Sun Aug 29 10:54:22 2010 +0200
+++ b/tests/test-churn.out Sun Aug 29 22:46:00 2010 +0200
@@ -16,10 +16,12 @@
user2 2 ***************************************************************
user1 1 ********************************
% churn with aliases
+skipping malformed alias: not-an-alias
alias3 3 **************************************************************
alias1 3 **************************************************************
user2 2 *****************************************
% churn with .hgchurn
+skipping malformed alias: not-an-alias
alias3 3 **************************************************************
alias1 3 **************************************************************
user2 2 *****************************************