##// END OF EJS Templates
churn: do not crash on malformed lines in alias file
Martin Geisler -
r12069:7c3c4441 stable
parent child Browse files
Show More
@@ -129,10 +129,14 b' def churn(ui, repo, *pats, **opts):'
129 129 aliases = repo.wjoin('.hgchurn')
130 130 if aliases:
131 131 for l in open(aliases, "r"):
132 if not l.strip():
132 try:
133 alias, actual = l.split('=' in l and '=' or None, 1)
134 amap[alias.strip()] = actual.strip()
135 except ValueError:
136 l = l.strip()
137 if l:
138 ui.warn(_("skipping malformed alias: %s\n" % l))
133 139 continue
134 alias, actual = l.split('=' in l and '=' or None, 1)
135 amap[alias.strip()] = actual.strip()
136 140
137 141 rate = countrate(ui, repo, amap, *pats, **opts).items()
138 142 if not rate:
@@ -40,6 +40,7 b' cat > ../aliases <<EOF'
40 40 user1 alias1
41 41
42 42 user3 alias3
43 not-an-alias
43 44 EOF
44 45 hg churn --aliases ../aliases
45 46 echo % churn with .hgchurn
@@ -16,10 +16,12 b' user1 2 ***************************'
16 16 user2 2 ***************************************************************
17 17 user1 1 ********************************
18 18 % churn with aliases
19 skipping malformed alias: not-an-alias
19 20 alias3 3 **************************************************************
20 21 alias1 3 **************************************************************
21 22 user2 2 *****************************************
22 23 % churn with .hgchurn
24 skipping malformed alias: not-an-alias
23 25 alias3 3 **************************************************************
24 26 alias1 3 **************************************************************
25 27 user2 2 *****************************************
General Comments 0
You need to be logged in to leave comments. Login now