comparison hgext/narrow/narrowcommands.py @ 39555:cb675e95a2c2

hg: write narrow patterns after repo creation Now that hg.clone() knows when a narrow clone is requested, it makes sense to have it update the narrow patterns for the repo soon after the repo is created, before any exchange occurs. Previously, the narrow extension was monkeypatching an exchange function to do this. The old code is redundant and has been removed. Differential Revision: https://phab.mercurial-scm.org/D4541
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 11 Sep 2018 17:22:15 -0700
parents 841c82d1a973
children f1844a10ee19
comparison
equal deleted inserted replaced
39554:841c82d1a973 39555:cb675e95a2c2
90 opts['include'].extend(includes) 90 opts['include'].extend(includes)
91 opts['exclude'].extend(excludes) 91 opts['exclude'].extend(excludes)
92 92
93 if opts['narrow']: 93 if opts['narrow']:
94 def pullbundle2extraprepare_widen(orig, pullop, kwargs): 94 def pullbundle2extraprepare_widen(orig, pullop, kwargs):
95 # Create narrow spec patterns from clone flags
96 includepats = narrowspec.parsepatterns(opts['include'])
97 excludepats = narrowspec.parsepatterns(opts['exclude'])
98
99 if not includepats and excludepats:
100 # If nothing was included, we assume the user meant to include
101 # everything, except what they asked to exclude.
102 includepats = {'path:.'}
103
104 pullop.repo.setnarrowpats(includepats, excludepats)
105
106 # This will populate 'includepats' etc with the values from the
107 # narrowspec we just saved.
108 orig(pullop, kwargs) 95 orig(pullop, kwargs)
109 96
110 if opts.get('depth'): 97 if opts.get('depth'):
111 kwargs['depth'] = opts['depth'] 98 kwargs['depth'] = opts['depth']
112 wrappedextraprepare = extensions.wrappedfunction(exchange, 99 wrappedextraprepare = extensions.wrappedfunction(exchange,