# HG changeset patch # User Martin Geisler # Date 2010-08-29 20:46:00 # Node ID 7c3c44413bc1e66d13d318b3e52ac1efc8f475cd # Parent 2e7647d254582cb789679b28c9f7bd060707140b churn: do not crash on malformed lines in alias file diff --git a/hgext/churn.py b/hgext/churn.py --- a/hgext/churn.py +++ b/hgext/churn.py @@ -129,10 +129,14 @@ def churn(ui, repo, *pats, **opts): 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: diff --git a/tests/test-churn b/tests/test-churn --- a/tests/test-churn +++ b/tests/test-churn @@ -40,6 +40,7 @@ cat > ../aliases <