comparison tests/pullext.py @ 43076:2372284d9457

formatting: blacken the codebase This is using my patch to black (https://github.com/psf/black/pull/826) so we don't un-wrap collection literals. Done with: hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S # skip-blame mass-reformatting only # no-check-commit reformats foo_bar functions Differential Revision: https://phab.mercurial-scm.org/D6971
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:45:02 -0400
parents 268662aac075
children 9f70512ae2cf
comparison
equal deleted inserted replaced
43075:57875cf423c9 43076:2372284d9457
12 commands, 12 commands,
13 error, 13 error,
14 extensions, 14 extensions,
15 localrepo, 15 localrepo,
16 ) 16 )
17 from mercurial.interfaces import ( 17 from mercurial.interfaces import repository
18 repository, 18
19 )
20 19
21 def clonecommand(orig, ui, repo, *args, **kwargs): 20 def clonecommand(orig, ui, repo, *args, **kwargs):
22 if kwargs.get(r'include') or kwargs.get(r'exclude'): 21 if kwargs.get(r'include') or kwargs.get(r'exclude'):
23 kwargs[r'narrow'] = True 22 kwargs[r'narrow'] = True
24 23
28 except ValueError: 27 except ValueError:
29 raise error.Abort(_('--depth must be an integer')) 28 raise error.Abort(_('--depth must be an integer'))
30 29
31 return orig(ui, repo, *args, **kwargs) 30 return orig(ui, repo, *args, **kwargs)
32 31
32
33 def featuresetup(ui, features): 33 def featuresetup(ui, features):
34 features.add(repository.NARROW_REQUIREMENT) 34 features.add(repository.NARROW_REQUIREMENT)
35
35 36
36 def extsetup(ui): 37 def extsetup(ui):
37 entry = extensions.wrapcommand(commands.table, b'clone', clonecommand) 38 entry = extensions.wrapcommand(commands.table, b'clone', clonecommand)
38 39
39 hasinclude = any(x[1] == b'include' for x in entry[1]) 40 hasinclude = any(x[1] == b'include' for x in entry[1])
40 hasdepth = any(x[1] == b'depth' for x in entry[1]) 41 hasdepth = any(x[1] == b'depth' for x in entry[1])
41 42
42 if not hasinclude: 43 if not hasinclude:
43 entry[1].append((b'', b'include', [], 44 entry[1].append(
44 _(b'pattern of file/directory to clone'))) 45 (b'', b'include', [], _(b'pattern of file/directory to clone'))
45 entry[1].append((b'', b'exclude', [], 46 )
46 _(b'pattern of file/directory to not clone'))) 47 entry[1].append(
48 (b'', b'exclude', [], _(b'pattern of file/directory to not clone'))
49 )
47 50
48 if not hasdepth: 51 if not hasdepth:
49 entry[1].append((b'', b'depth', b'', 52 entry[1].append(
50 _(b'ancestry depth of changesets to fetch'))) 53 (b'', b'depth', b'', _(b'ancestry depth of changesets to fetch'))
54 )
51 55
52 localrepo.featuresetupfuncs.add(featuresetup) 56 localrepo.featuresetupfuncs.add(featuresetup)