Mercurial > hg-stable
changeset 17430:e841ecc03765
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
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 27 Aug 2012 23:17:21 +0200 |
parents | 72fa4ef2245f |
children | 573e80049cad |
files | hgext/largefiles/lfcommands.py |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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