Patchwork churn: split email aliases from the right

login
register
mail settings
Submitter Matthew Turk
Date July 17, 2013, 2:44 p.m.
Message ID <3d618c04106d3449b3b3.1374072249@localhost6.localdomain6>
Download mbox | patch
Permalink /patch/1911/
State Accepted
Commit 68f7129af6a84eeb0f22c24a4ee00f017f245bd3
Headers show

Comments

Matthew Turk - July 17, 2013, 2:44 p.m.
# HG changeset patch
# User Matthew Turk <matthewturk@gmail.com>
# Date 1374072040 14400
#      Wed Jul 17 10:40:40 2013 -0400
# Node ID 3d618c04106d3449b3b3d9224ee76e0ee3c9635e
# Parent  ea4342d0e6fea19c8c4b7651f36929cd682afae7
churn: split email aliases from the right

This splits churn email aliases from the right, to enable incorrectly-specified
addresses that include equal signs to be mapped to correct addresses.  This
will enable aliasing of bad addresses (typically typos) such as:

sername=myusername

that appear in the churn output through a churn alias such as:

sername=myusername = myusername

whereas previously splitting from the left would not enable this behavior.
Matt Mackall - July 19, 2013, 4:42 a.m.
On Wed, 2013-07-17 at 10:44 -0400, Matthew Turk wrote:
> # HG changeset patch
> # User Matthew Turk <matthewturk@gmail.com>
> # Date 1374072040 14400
> #      Wed Jul 17 10:40:40 2013 -0400
> # Node ID 3d618c04106d3449b3b3d9224ee76e0ee3c9635e
> # Parent  ea4342d0e6fea19c8c4b7651f36929cd682afae7
> churn: split email aliases from the right

Looks good, queued for default.

Patch

diff -r ea4342d0e6fe -r 3d618c04106d hgext/churn.py
--- a/hgext/churn.py	Tue Jul 16 17:10:26 2013 -0500
+++ b/hgext/churn.py	Wed Jul 17 10:40:40 2013 -0400
@@ -121,6 +121,7 @@ 
 
     Such a file may be specified with the --aliases option, otherwise
     a .hgchurn file will be looked for in the working directory root.
+    Aliases will be split from the rightmost "=".
     '''
     def pad(s, l):
         return (s + " " * l)[:l]
@@ -132,7 +133,7 @@ 
     if aliases:
         for l in open(aliases, "r"):
             try:
-                alias, actual = l.split('=' in l and '=' or None, 1)
+                alias, actual = l.rsplit('=' in l and '=' or None, 1)
                 amap[alias.strip()] = actual.strip()
             except ValueError:
                 l = l.strip()