largefiles: minor code cleanup
authorMads Kiilerich <mads@kiilerich.com>
Mon, 27 Aug 2012 23:17:21 +0200
changeset 17430 e841ecc03765
parent 17429 72fa4ef2245f
child 17431 573e80049cad
largefiles: minor code cleanup Fix: * unnecessary use of map and lambda * comment instead of readable code * comparing None with 0 * and...or anti-pattern for 'ternary if' with very clever handling of i=None
hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py	Mon Aug 27 23:16:22 2012 +0200
+++ b/hgext/largefiles/lfcommands.py	Mon Aug 27 23:17:21 2012 +0200
@@ -444,11 +444,13 @@
             cachelfiles(ui, repo, '.', lfiles)
 
         updated, removed = 0, 0
-        for i in map(lambda f: _updatelfile(repo, lfdirstate, f), lfiles):
-            # increment the appropriate counter according to _updatelfile's
-            # return value
-            updated += i > 0 and i or 0
-            removed -= i < 0 and i or 0
+        for f in lfiles:
+            i = _updatelfile(repo, lfdirstate, f)
+            if i:
+                if i > 0:
+                    updated += i
+                else:
+                    removed -= i
             if printmessage and (removed or updated) and not printed:
                 ui.status(_('getting changed largefiles\n'))
                 printed = True