# HG changeset patch # User Alexander Solovyov # Date 1275481725 -7200 # Node ID 30c620e48d1c78eb9a12c8500cb40faf74605f2d # Parent 1dd69d159e5c29366cfe5213934f2cfbb44fe372 churn: support spaces in aliases (issue2222) diff -r 1dd69d159e5c -r 30c620e48d1c hgext/churn.py --- a/hgext/churn.py Tue Jun 01 10:55:11 2010 -0500 +++ b/hgext/churn.py Wed Jun 02 14:28:45 2010 +0200 @@ -115,7 +115,7 @@ It is possible to map alternate email addresses to a main address by providing a file using the following format:: - + = Such a file may be specified with the --aliases option, otherwise a .hgchurn file will be looked for in the working directory root. @@ -129,9 +129,8 @@ aliases = repo.wjoin('.hgchurn') if aliases: for l in open(aliases, "r"): - l = l.strip() - alias, actual = l.split() - amap[alias] = actual + 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: diff -r 1dd69d159e5c -r 30c620e48d1c tests/test-churn --- a/tests/test-churn Tue Jun 01 10:55:11 2010 -0500 +++ b/tests/test-churn Wed Jun 02 14:28:45 2010 +0200 @@ -59,6 +59,12 @@ echo % changeset number churn hg churn -c +echo 'with space = no-space' >> ../aliases +echo a >> a +hg commit -m a -u 'with space' -d 15:00 +echo % churn with space in alias +hg churn --aliases ../aliases -r tip + cd .. # issue 833: ZeroDivisionError diff -r 1dd69d159e5c -r 30c620e48d1c tests/test-churn.out --- a/tests/test-churn.out Tue Jun 01 10:55:11 2010 -0500 +++ b/tests/test-churn.out Wed Jun 02 14:28:45 2010 +0200 @@ -40,5 +40,7 @@ user1 4 *************************************************************** user3 3 *********************************************** user2 2 ******************************** +% churn with space in alias +no-space 1 ************************************************************ adding foo test 0