Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 39568:4c807ec07888
commands: pass include and exclude options to hg.clone()
These arguments are defined by the narrow extension. Let's teach
core to recognize them so we can delete some code from the narrow
extension and start to exercise the in-core code for performing a
narrow clone.
We have no way of easily testing it, but this change should result in
.hg/requires having the narrow requirement from the time the file
is written rather than added as part of pull. We'll confirm this when
we delete some monkeypatched functions from the narrow extension in
later commits.
Test output changed because hg.clone() is now receiving patterns
and validation of those values is occurring sooner, before the exchange
code runs and prints the message that was deleted.
Differential Revision: https://phab.mercurial-scm.org/D4538
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 11 Sep 2018 17:20:14 -0700 |
parents | a80b8832720d |
children | 713085b45810 |
comparison
equal
deleted
inserted
replaced
39567:261f1e8dc300 | 39568:4c807ec07888 |
---|---|
41 hbisect, | 41 hbisect, |
42 help, | 42 help, |
43 hg, | 43 hg, |
44 logcmdutil, | 44 logcmdutil, |
45 merge as mergemod, | 45 merge as mergemod, |
46 narrowspec, | |
46 obsolete, | 47 obsolete, |
47 obsutil, | 48 obsutil, |
48 patch, | 49 patch, |
49 phases, | 50 phases, |
50 pycompat, | 51 pycompat, |
1464 """ | 1465 """ |
1465 opts = pycompat.byteskwargs(opts) | 1466 opts = pycompat.byteskwargs(opts) |
1466 if opts.get('noupdate') and opts.get('updaterev'): | 1467 if opts.get('noupdate') and opts.get('updaterev'): |
1467 raise error.Abort(_("cannot specify both --noupdate and --updaterev")) | 1468 raise error.Abort(_("cannot specify both --noupdate and --updaterev")) |
1468 | 1469 |
1470 # --include/--exclude can come from narrow or sparse. | |
1471 includepats, excludepats = None, None | |
1472 | |
1473 # hg.clone() differentiates between None and an empty set. So make sure | |
1474 # patterns are sets if narrow is requested without patterns. | |
1475 if opts.get('narrow'): | |
1476 includepats = set() | |
1477 excludepats = set() | |
1478 | |
1479 if opts.get('include'): | |
1480 includepats = narrowspec.parsepatterns(opts.get('include')) | |
1481 if opts.get('exclude'): | |
1482 excludepats = narrowspec.parsepatterns(opts.get('exclude')) | |
1483 | |
1469 r = hg.clone(ui, opts, source, dest, | 1484 r = hg.clone(ui, opts, source, dest, |
1470 pull=opts.get('pull'), | 1485 pull=opts.get('pull'), |
1471 stream=opts.get('stream') or opts.get('uncompressed'), | 1486 stream=opts.get('stream') or opts.get('uncompressed'), |
1472 revs=opts.get('rev'), | 1487 revs=opts.get('rev'), |
1473 update=opts.get('updaterev') or not opts.get('noupdate'), | 1488 update=opts.get('updaterev') or not opts.get('noupdate'), |
1474 branch=opts.get('branch'), | 1489 branch=opts.get('branch'), |
1475 shareopts=opts.get('shareopts')) | 1490 shareopts=opts.get('shareopts'), |
1491 storeincludepats=includepats, | |
1492 storeexcludepats=excludepats) | |
1476 | 1493 |
1477 return r is None | 1494 return r is None |
1478 | 1495 |
1479 @command('^commit|ci', | 1496 @command('^commit|ci', |
1480 [('A', 'addremove', None, | 1497 [('A', 'addremove', None, |