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.
--- 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