filter() is a generator on Python 3, but these cases are used as lists.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
filter() is a generator on Python 3, but these cases are used as lists.
Lint Skipped |
Unit Tests Skipped |
if not files: | if not files: | ||||
return | return | ||||
store = storefactory.openstore(rsrc, rdst, put=True) | store = storefactory.openstore(rsrc, rdst, put=True) | ||||
at = 0 | at = 0 | ||||
ui.debug("sending statlfile command for %d largefiles\n" % len(files)) | ui.debug("sending statlfile command for %d largefiles\n" % len(files)) | ||||
retval = store.exists(files) | retval = store.exists(files) | ||||
files = filter(lambda h: not retval[h], files) | files = [h for h in files if not retval[h]] | ||||
ui.debug("%d largefiles need to be uploaded\n" % len(files)) | ui.debug("%d largefiles need to be uploaded\n" % len(files)) | ||||
for hash in files: | for hash in files: | ||||
ui.progress(_('uploading largefiles'), at, unit=_('files'), | ui.progress(_('uploading largefiles'), at, unit=_('files'), | ||||
total=len(files)) | total=len(files)) | ||||
source = lfutil.findfile(rsrc, hash) | source = lfutil.findfile(rsrc, hash) | ||||
if not source: | if not source: | ||||
raise error.Abort(_('largefile %s missing from store' | raise error.Abort(_('largefile %s missing from store' |
# -- Utility functions: commonly/repeatedly needed functionality --------------- | # -- Utility functions: commonly/repeatedly needed functionality --------------- | ||||
def composelargefilematcher(match, manifest): | def composelargefilematcher(match, manifest): | ||||
'''create a matcher that matches only the largefiles in the original | '''create a matcher that matches only the largefiles in the original | ||||
matcher''' | matcher''' | ||||
m = copy.copy(match) | m = copy.copy(match) | ||||
lfile = lambda f: lfutil.standin(f) in manifest | lfile = lambda f: lfutil.standin(f) in manifest | ||||
m._files = filter(lfile, m._files) | m._files = [lf for lf in m._files if lfile(lf)] | ||||
m._fileset = set(m._files) | m._fileset = set(m._files) | ||||
m.always = lambda: False | m.always = lambda: False | ||||
origmatchfn = m.matchfn | origmatchfn = m.matchfn | ||||
m.matchfn = lambda f: lfile(f) and origmatchfn(f) | m.matchfn = lambda f: lfile(f) and origmatchfn(f) | ||||
return m | return m | ||||
def composenormalfilematcher(match, manifest, exclude=None): | def composenormalfilematcher(match, manifest, exclude=None): | ||||
excluded = set() | excluded = set() | ||||
if exclude is not None: | if exclude is not None: | ||||
excluded.update(exclude) | excluded.update(exclude) | ||||
m = copy.copy(match) | m = copy.copy(match) | ||||
notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in | notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in | ||||
manifest or f in excluded) | manifest or f in excluded) | ||||
m._files = filter(notlfile, m._files) | m._files = [lf for lf in m._files if notlfile(lf)] | ||||
m._fileset = set(m._files) | m._fileset = set(m._files) | ||||
m.always = lambda: False | m.always = lambda: False | ||||
origmatchfn = m.matchfn | origmatchfn = m.matchfn | ||||
m.matchfn = lambda f: notlfile(f) and origmatchfn(f) | m.matchfn = lambda f: notlfile(f) and origmatchfn(f) | ||||
return m | return m | ||||
def installnormalfilesmatchfn(manifest): | def installnormalfilesmatchfn(manifest): | ||||
'''installmatchfn with a matchfn that ignores all largefiles''' | '''installmatchfn with a matchfn that ignores all largefiles''' |