# HG changeset patch # User Gregory Szorc # Date 1536705633 25200 # Node ID 4afd2af36456659a8f36983772206abe13b090ef # Parent 10a8472f6662ab75f4b7c8861dcceb01034a9fce narrow: set opts['narrow'] instead of local variable This will allow the command function in core to infer the presence of the option without duplicating logic. Differential Revision: https://phab.mercurial-scm.org/D4532 diff -r 10a8472f6662 -r 4afd2af36456 hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py Tue Sep 11 15:53:12 2018 -0700 +++ b/hgext/narrow/narrowcommands.py Tue Sep 11 15:40:33 2018 -0700 @@ -66,7 +66,6 @@ """Wraps clone command, so 'hg clone' first wraps localrepo.clone().""" opts = pycompat.byteskwargs(opts) wrappedextraprepare = util.nullcontextmanager() - opts_narrow = opts['narrow'] narrowspecfile = opts['narrowspec'] if narrowspecfile: @@ -87,11 +86,11 @@ narrowspec.validatepatterns(excludes) # narrowspec is passed so we should assume that user wants narrow clone - opts_narrow = True + opts['narrow'] = True opts['include'].extend(includes) opts['exclude'].extend(excludes) - if opts_narrow: + if opts['narrow']: def pullbundle2extraprepare_widen(orig, pullop, kwargs): # Create narrow spec patterns from clone flags includepats = narrowspec.parsepatterns(opts['include']) @@ -114,7 +113,7 @@ '_pullbundle2extraprepare', pullbundle2extraprepare_widen) def pullnarrow(orig, repo, *args, **kwargs): - if opts_narrow: + if opts['narrow']: repo.requirements.add(repository.NARROW_REQUIREMENT) repo._writerequirements()