# HG changeset patch # User Alexander Solovyov # Date 2010-06-02 12:28:45 # Node ID 30c620e48d1c78eb9a12c8500cb40faf74605f2d # Parent 1dd69d159e5c29366cfe5213934f2cfbb44fe372 churn: support spaces in aliases (issue2222) diff --git a/hgext/churn.py b/hgext/churn.py --- a/hgext/churn.py +++ b/hgext/churn.py @@ -115,7 +115,7 @@ def churn(ui, repo, *pats, **opts): 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 @@ def churn(ui, repo, *pats, **opts): 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 --git a/tests/test-churn b/tests/test-churn --- a/tests/test-churn +++ b/tests/test-churn @@ -59,6 +59,12 @@ hg --config extensions.color= churn --co 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 --git a/tests/test-churn.out b/tests/test-churn.out --- a/tests/test-churn.out +++ b/tests/test-churn.out @@ -40,5 +40,7 @@ user2 +2/-0 +++++++++++ user1 4 *************************************************************** user3 3 *********************************************** user2 2 ******************************** +% churn with space in alias +no-space 1 ************************************************************ adding foo test 0