Mercurial > hg
comparison hgext/largefiles/overrides.py @ 41760:1eb2fc21da12
cleanup: prefer nested context managers to \-continuations
I'd prefer Python accept a tuple of context managers, but alas it
isn't meant to be. This will have to suffice.
Differential Revision: https://phab.mercurial-scm.org/D5994
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 20 Feb 2019 18:02:28 -0500 |
parents | 0531dff73d0b |
children | 87a34c767384 |
comparison
equal
deleted
inserted
replaced
41759:aaad36b88298 | 41760:1eb2fc21da12 |
---|---|
662 if not opts['force'] and os.path.exists(destlfile): | 662 if not opts['force'] and os.path.exists(destlfile): |
663 raise IOError('', | 663 raise IOError('', |
664 _('destination largefile already exists')) | 664 _('destination largefile already exists')) |
665 copiedfiles.append((src, dest)) | 665 copiedfiles.append((src, dest)) |
666 orig(src, dest, *args, **kwargs) | 666 orig(src, dest, *args, **kwargs) |
667 with extensions.wrappedfunction(util, 'copyfile', overridecopyfile), \ | 667 with extensions.wrappedfunction(util, 'copyfile', overridecopyfile): |
668 extensions.wrappedfunction(scmutil, 'match', overridematch): | 668 with extensions.wrappedfunction(scmutil, 'match', overridematch): |
669 result += orig(ui, repo, listpats, opts, rename) | 669 result += orig(ui, repo, listpats, opts, rename) |
670 | 670 |
671 lfdirstate = lfutil.openlfdirstate(ui, repo) | 671 lfdirstate = lfutil.openlfdirstate(ui, repo) |
672 for (src, dest) in copiedfiles: | 672 for (src, dest) in copiedfiles: |
673 if (lfutil.shortname in src and | 673 if (lfutil.shortname in src and |
674 dest.startswith(repo.wjoin(lfutil.shortname))): | 674 dest.startswith(repo.wjoin(lfutil.shortname))): |