# HG changeset patch # User Josef "Jeff" Sipek # Date 1155635329 14400 # Node ID 2d35d7c6f2511c71d0b0b4ce9085e48e841f67c9 # Parent 45942bb491949fd9794915b6727ec3ee6e90c85f [churn] Trivial cleanup suggested by Thomas diff -r 45942bb49194 -r 2d35d7c6f251 hgext/churn.py --- a/hgext/churn.py Tue Aug 08 15:29:33 2006 -0400 +++ b/hgext/churn.py Tue Aug 15 05:48:49 2006 -0400 @@ -19,23 +19,19 @@ def dirtywork(f, mmap1, mmap2): lines = 0 - to = None - if mmap1: - to = repo.file(f).read(mmap1[f]) - tn = None - if mmap2: - tn = repo.file(f).read(mmap2[f]) + to = mmap1 and repo.file(f).read(mmap1[f]) or None + tn = mmap2 and repo.file(f).read(mmap2[f]) or None diff = mdiff.unidiff(to, "", tn, "", f).split("\n") for line in diff: - if len(line) <= 0: + if not len(line): continue # skip EOF - if line[0] == " ": + if line.startswith(" "): continue # context line - if line[0:4] == "--- " or line[0:4] == "+++ ": + if line.startswith("--- ") or line.startswith("+++ "): continue # begining of diff - if line[0:3] == "@@ ": + if line.startswith("@@ "): continue # info line # changed lines @@ -135,7 +131,7 @@ # make a list of tuples (name, lines) and sort it in descending order ordered = stats.items() - ordered.sort(cmp=lambda x,y:cmp(y[1], x[1])) + ordered.sort(cmp=lambda x, y: cmp(y[1], x[1])) maximum = ordered[0][1]