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