# HG changeset patch # User Renato Cunha # Date 1278023223 10800 # Node ID b782a7eb90373fdbd68cd84b2afe61d16823cead # Parent 324cd681fa478999b2cdfa6d8c38d85f1b73d416 record: removed 'reduce' calls (unsupported by py3k) Quoting python's documentation, "Note that sum(range(n), m) is equivalent to reduce(operator.add, range(n), m)". The "sum" function is a builtin from 2.3 on and there's no reason for not to use it. diff -r 324cd681fa47 -r b782a7eb9037 hgext/record.py --- a/hgext/record.py Thu Jul 01 19:27:03 2010 -0300 +++ b/hgext/record.py Thu Jul 01 19:27:03 2010 -0300 @@ -10,7 +10,7 @@ from mercurial.i18n import gettext, _ from mercurial import cmdutil, commands, extensions, hg, mdiff, patch from mercurial import util -import copy, cStringIO, errno, operator, os, re, tempfile +import copy, cStringIO, errno, os, re, tempfile lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)') @@ -355,8 +355,8 @@ applied[chunk.filename()].append(chunk) else: fixoffset += chunk.removed - chunk.added - return reduce(operator.add, [h for h in applied.itervalues() - if h[0].special() or len(h) > 1], []) + return sum([h for h in applied.itervalues() + if h[0].special() or len(h) > 1], []) def record(ui, repo, *pats, **opts): '''interactively select changes to commit