Show More
@@ -213,7 +213,7 b' def list_stdlib_modules():' | |||
|
213 | 213 | yield m |
|
214 | 214 | for m in ['cffi']: |
|
215 | 215 | yield m |
|
216 |
stdlib_prefixes = |
|
|
216 | stdlib_prefixes = {sys.prefix, sys.exec_prefix} | |
|
217 | 217 | # We need to supplement the list of prefixes for the search to work |
|
218 | 218 | # when run from within a virtualenv. |
|
219 | 219 | for mod in (BaseHTTPServer, zlib): |
@@ -71,7 +71,7 b" testedwith = 'ships-with-hg-core'" | |||
|
71 | 71 | cmdtable = {} |
|
72 | 72 | command = cmdutil.command(cmdtable) |
|
73 | 73 | |
|
74 |
newfile = |
|
|
74 | newfile = {'new fi', 'rename', 'copy f', 'copy t'} | |
|
75 | 75 | |
|
76 | 76 | def zerodict(): |
|
77 | 77 | return collections.defaultdict(lambda: 0) |
@@ -336,7 +336,7 b' def synthesize(ui, repo, descpath, **opt' | |||
|
336 | 336 | wlock = repo.wlock() |
|
337 | 337 | lock = repo.lock() |
|
338 | 338 | |
|
339 |
nevertouch = |
|
|
339 | nevertouch = {'.hgsub', '.hgignore', '.hgtags'} | |
|
340 | 340 | |
|
341 | 341 | progress = ui.progress |
|
342 | 342 | _synthesizing = _('synthesizing') |
@@ -310,7 +310,7 b' class filemap_source(common.converter_so' | |||
|
310 | 310 | # map to any revision in the restricted graph. Put SKIPREV |
|
311 | 311 | # in the set of wanted ancestors to simplify code elsewhere |
|
312 | 312 | self.parentmap[rev] = SKIPREV |
|
313 |
self.wantedancestors[rev] = |
|
|
313 | self.wantedancestors[rev] = {SKIPREV} | |
|
314 | 314 | return |
|
315 | 315 | |
|
316 | 316 | # Reuse the data from our parent. |
@@ -32,7 +32,7 b' class submodule(object):' | |||
|
32 | 32 | return "%s %s" % (self.node, self.path) |
|
33 | 33 | |
|
34 | 34 | # Keys in extra fields that should not be copied if the user requests. |
|
35 |
bannedextrakeys = |
|
|
35 | bannedextrakeys = { | |
|
36 | 36 | # Git commit object built-ins. |
|
37 | 37 | 'tree', |
|
38 | 38 | 'parent', |
@@ -41,7 +41,7 b' bannedextrakeys = set([' | |||
|
41 | 41 | # Mercurial built-ins. |
|
42 | 42 | 'branch', |
|
43 | 43 | 'close', |
|
44 | ]) | |
|
44 | } | |
|
45 | 45 | |
|
46 | 46 | class convert_git(common.converter_source, common.commandline): |
|
47 | 47 | # Windows does not support GIT_DIR= construct while other systems |
@@ -455,9 +455,9 b' class convert_git(common.converter_sourc' | |||
|
455 | 455 | ('refs/heads/', '') |
|
456 | 456 | ] |
|
457 | 457 | |
|
458 |
exclude = |
|
|
458 | exclude = { | |
|
459 | 459 | 'refs/remotes/origin/HEAD', |
|
460 |
|
|
|
460 | } | |
|
461 | 461 | |
|
462 | 462 | try: |
|
463 | 463 | output, status = self.gitrunlines('show-ref') |
@@ -1641,8 +1641,8 b' def stripwrapper(orig, ui, repo, nodelis' | |||
|
1641 | 1641 | if os.path.exists(os.path.join(repo.path, 'histedit-state')): |
|
1642 | 1642 | state = histeditstate(repo) |
|
1643 | 1643 | state.read() |
|
1644 |
histedit_nodes = |
|
|
1645 |
|
|
|
1644 | histedit_nodes = {action.node for action | |
|
1645 | in state.actions if action.node} | |
|
1646 | 1646 | common_nodes = histedit_nodes & set(nodelist) |
|
1647 | 1647 | if common_nodes: |
|
1648 | 1648 | raise error.Abort(_("histedit in progress, can't strip %s") |
@@ -158,7 +158,7 b' def unsharejournal(orig, ui, repo, repop' | |||
|
158 | 158 | util.safehasattr(repo, 'journal')): |
|
159 | 159 | sharedrepo = share._getsrcrepo(repo) |
|
160 | 160 | sharedfeatures = _readsharedfeatures(repo) |
|
161 |
if sharedrepo and sharedfeatures > |
|
|
161 | if sharedrepo and sharedfeatures > {'journal'}: | |
|
162 | 162 | # there is a shared repository and there are shared journal entries |
|
163 | 163 | # to copy. move shared date over from source to destination but |
|
164 | 164 | # move the local file first |
@@ -129,7 +129,7 b' reposetup = reposetup.reposetup' | |||
|
129 | 129 | |
|
130 | 130 | def featuresetup(ui, supported): |
|
131 | 131 | # don't die on seeing a repo with the largefiles requirement |
|
132 |
supported |= |
|
|
132 | supported |= {'largefiles'} | |
|
133 | 133 | |
|
134 | 134 | def uisetup(ui): |
|
135 | 135 | localrepo.localrepository.featuresetupfuncs.add(featuresetup) |
@@ -242,7 +242,7 b' class rebaseruntime(object):' | |||
|
242 | 242 | skipped = set() |
|
243 | 243 | # recompute the set of skipped revs |
|
244 | 244 | if not collapse: |
|
245 |
seen = |
|
|
245 | seen = {dest} | |
|
246 | 246 | for old, new in sorted(state.items()): |
|
247 | 247 | if new != revtodo and new in seen: |
|
248 | 248 | skipped.add(old) |
@@ -250,7 +250,7 b' class rebaseruntime(object):' | |||
|
250 | 250 | repo.ui.debug('computed skipped revs: %s\n' % |
|
251 | 251 | (' '.join(str(r) for r in sorted(skipped)) or None)) |
|
252 | 252 | repo.ui.debug('rebase status resumed\n') |
|
253 |
_setrebasesetvisibility(repo, set(state.keys()) | |
|
|
253 | _setrebasesetvisibility(repo, set(state.keys()) | {originalwd}) | |
|
254 | 254 | |
|
255 | 255 | self.originalwd = originalwd |
|
256 | 256 | self.dest = dest |
@@ -1235,7 +1235,7 b' def buildstate(repo, dest, rebaseset, co' | |||
|
1235 | 1235 | rebaseset: set of rev |
|
1236 | 1236 | ''' |
|
1237 | 1237 | originalwd = repo['.'].rev() |
|
1238 |
_setrebasesetvisibility(repo, set(rebaseset) | |
|
|
1238 | _setrebasesetvisibility(repo, set(rebaseset) | {originalwd}) | |
|
1239 | 1239 | |
|
1240 | 1240 | # This check isn't strictly necessary, since mq detects commits over an |
|
1241 | 1241 | # applied patch. But it prevents messing up the working directory when |
@@ -352,7 +352,7 b' def mutableancestors(ctx):' | |||
|
352 | 352 | """return all mutable ancestors for ctx (included) |
|
353 | 353 | |
|
354 | 354 | Much faster than the revset ancestors(ctx) & draft()""" |
|
355 |
seen = |
|
|
355 | seen = {nodemod.nullrev} | |
|
356 | 356 | visit = collections.deque() |
|
357 | 357 | visit.append(ctx) |
|
358 | 358 | while visit: |
@@ -1006,17 +1006,17 b' def shelvecmd(ui, repo, *pats, **opts):' | |||
|
1006 | 1006 | all shelved changes, use ``--cleanup``. |
|
1007 | 1007 | ''' |
|
1008 | 1008 | allowables = [ |
|
1009 |
('addremove', |
|
|
1010 |
('unknown', |
|
|
1011 |
('cleanup', |
|
|
1012 |
# ('date', |
|
|
1013 |
('delete', |
|
|
1014 |
('edit', |
|
|
1015 |
('list', |
|
|
1016 |
('message', |
|
|
1017 |
('name', |
|
|
1018 |
('patch', |
|
|
1019 |
('stat', |
|
|
1009 | ('addremove', {'create'}), # 'create' is pseudo action | |
|
1010 | ('unknown', {'create'}), | |
|
1011 | ('cleanup', {'cleanup'}), | |
|
1012 | # ('date', {'create'}), # ignored for passing '--date "0 0"' in tests | |
|
1013 | ('delete', {'delete'}), | |
|
1014 | ('edit', {'create'}), | |
|
1015 | ('list', {'list'}), | |
|
1016 | ('message', {'create'}), | |
|
1017 | ('name', {'create'}), | |
|
1018 | ('patch', {'patch', 'list'}), | |
|
1019 | ('stat', {'stat', 'list'}), | |
|
1020 | 1020 | ] |
|
1021 | 1021 | def checkopt(opt): |
|
1022 | 1022 | if opts.get(opt): |
@@ -185,7 +185,7 b' def underwayrevset(repo, subset, x):' | |||
|
185 | 185 | # Add working directory parent. |
|
186 | 186 | wdirrev = repo['.'].rev() |
|
187 | 187 | if wdirrev != nullrev: |
|
188 |
relevant += revset.baseset( |
|
|
188 | relevant += revset.baseset({wdirrev}) | |
|
189 | 189 | |
|
190 | 190 | return subset & relevant |
|
191 | 191 |
@@ -22,14 +22,14 b' modulepolicy = policy.policy' | |||
|
22 | 22 | |
|
23 | 23 | # Modules that have both Python and C implementations. See also the |
|
24 | 24 | # set of .py files under mercurial/pure/. |
|
25 |
_dualmodules = |
|
|
25 | _dualmodules = { | |
|
26 | 26 | 'mercurial.base85', |
|
27 | 27 | 'mercurial.bdiff', |
|
28 | 28 | 'mercurial.diffhelpers', |
|
29 | 29 | 'mercurial.mpatch', |
|
30 | 30 | 'mercurial.osutil', |
|
31 | 31 | 'mercurial.parsers', |
|
32 | ]) | |
|
32 | } | |
|
33 | 33 | |
|
34 | 34 | class hgimporter(object): |
|
35 | 35 | """Object that conforms to import hook interface defined in PEP-302.""" |
@@ -47,7 +47,7 b' def commonancestorsheads(pfunc, *nodes):' | |||
|
47 | 47 | sv |= poison |
|
48 | 48 | if v in nodes: |
|
49 | 49 | # history is linear |
|
50 |
return |
|
|
50 | return {v} | |
|
51 | 51 | if sv < poison: |
|
52 | 52 | for p in pfunc(v): |
|
53 | 53 | sp = seen[p] |
@@ -151,7 +151,7 b' class incrementalmissingancestors(object' | |||
|
151 | 151 | |
|
152 | 152 | def hasbases(self): |
|
153 | 153 | '''whether the common set has any non-trivial bases''' |
|
154 |
return self.bases and self.bases != |
|
|
154 | return self.bases and self.bases != {nullrev} | |
|
155 | 155 | |
|
156 | 156 | def addbases(self, newbases): |
|
157 | 157 | '''grow the ancestor set by adding new bases''' |
@@ -1693,7 +1693,7 b' def walkfilerevs(repo, match, follow, re' | |||
|
1693 | 1693 | last = filelog.rev(node) |
|
1694 | 1694 | |
|
1695 | 1695 | # keep track of all ancestors of the file |
|
1696 |
ancestors = |
|
|
1696 | ancestors = {filelog.linkrev(last)} | |
|
1697 | 1697 | |
|
1698 | 1698 | # iterate from latest to oldest revision |
|
1699 | 1699 | for rev, flparentlinkrevs, copied in filerevgen(filelog, last): |
@@ -442,10 +442,10 b" if pycompat.osname == 'nt':" | |||
|
442 | 442 | 'inverse': _COMMON_LVB_REVERSE_VIDEO, # double-byte charsets only |
|
443 | 443 | } |
|
444 | 444 | |
|
445 |
passthrough = |
|
|
446 |
|
|
|
447 |
|
|
|
448 |
|
|
|
445 | passthrough = {_FOREGROUND_INTENSITY, | |
|
446 | _BACKGROUND_INTENSITY, | |
|
447 | _COMMON_LVB_UNDERSCORE, | |
|
448 | _COMMON_LVB_REVERSE_VIDEO} | |
|
449 | 449 | |
|
450 | 450 | stdout = _kernel32.GetStdHandle( |
|
451 | 451 | _STD_OUTPUT_HANDLE) # don't close the handle returned |
@@ -637,7 +637,7 b' def _checkcopies(ctx, f, m1, m2, base, t' | |||
|
637 | 637 | return |
|
638 | 638 | |
|
639 | 639 | of = None |
|
640 |
seen = |
|
|
640 | seen = {f} | |
|
641 | 641 | for oc in getfctx(f, m1[f]).ancestors(): |
|
642 | 642 | ocr = oc.linkrev() |
|
643 | 643 | of = oc.path() |
@@ -254,7 +254,7 b' def _oldheadssummary(repo, remoteheads, ' | |||
|
254 | 254 | newheads = list(c.node() for c in r) |
|
255 | 255 | # set some unsynced head to issue the "unsynced changes" warning |
|
256 | 256 | if inc: |
|
257 |
unsynced = |
|
|
257 | unsynced = {None} | |
|
258 | 258 | else: |
|
259 | 259 | unsynced = set() |
|
260 | 260 | return {None: (oldheads, newheads, unsynced)} |
@@ -749,7 +749,7 b' def _dispatch(req):' | |||
|
749 | 749 | # imported and commands.table is populated. |
|
750 | 750 | debugcommands.command |
|
751 | 751 | |
|
752 |
uis = |
|
|
752 | uis = {ui, lui} | |
|
753 | 753 | |
|
754 | 754 | if req.repo: |
|
755 | 755 | uis.add(req.repo.ui) |
@@ -30,9 +30,9 b' if pycompat.ispy3:' | |||
|
30 | 30 | "206a 206b 206c 206d 206e 206f feff".split()] |
|
31 | 31 | # verify the next function will work |
|
32 | 32 | if pycompat.ispy3: |
|
33 |
assert set(i[0] for i in _ignore) == |
|
|
33 | assert set(i[0] for i in _ignore) == {ord(b'\xe2'), ord(b'\xef')} | |
|
34 | 34 | else: |
|
35 |
assert set(i[0] for i in _ignore) == |
|
|
35 | assert set(i[0] for i in _ignore) == {"\xe2", "\xef"} | |
|
36 | 36 | |
|
37 | 37 | def hfsignoreclean(s): |
|
38 | 38 | """Remove codepoints ignored by HFS+ from s. |
@@ -43,7 +43,7 b' urlreq = util.urlreq' | |||
|
43 | 43 | } |
|
44 | 44 | |
|
45 | 45 | # Compression engines allowed in version 1. THIS SHOULD NEVER CHANGE. |
|
46 |
_bundlespecv1compengines = |
|
|
46 | _bundlespecv1compengines = {'gzip', 'bzip2', 'none'} | |
|
47 | 47 | |
|
48 | 48 | def parsebundlespec(repo, spec, strict=True, externalnames=False): |
|
49 | 49 | """Parse a bundle string specification into parts. |
@@ -1522,7 +1522,7 b' def _pullobsolete(pullop):' | |||
|
1522 | 1522 | |
|
1523 | 1523 | def caps20to10(repo): |
|
1524 | 1524 | """return a set with appropriate options to use bundle20 during getbundle""" |
|
1525 |
caps = |
|
|
1525 | caps = {'HG20'} | |
|
1526 | 1526 | capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo)) |
|
1527 | 1527 | caps.add('bundle2=' + urlreq.quote(capsblob)) |
|
1528 | 1528 | return caps |
@@ -28,8 +28,8 b' from . import (' | |||
|
28 | 28 | _disabledextensions = {} |
|
29 | 29 | _aftercallbacks = {} |
|
30 | 30 | _order = [] |
|
31 |
_builtin = |
|
|
32 |
|
|
|
31 | _builtin = {'hbisect', 'bookmarks', 'parentrevspec', 'progress', 'interhg', | |
|
32 | 'inotify', 'hgcia'} | |
|
33 | 33 | |
|
34 | 34 | def extensions(ui=None): |
|
35 | 35 | if ui: |
@@ -14,7 +14,7 b' from . import (' | |||
|
14 | 14 | ) |
|
15 | 15 | |
|
16 | 16 | # Set of flags to not apply boolean negation logic on |
|
17 |
nevernegate = |
|
|
17 | nevernegate = { | |
|
18 | 18 | # avoid --no-noninteractive |
|
19 | 19 | 'noninteractive', |
|
20 | 20 | # These two flags are special because they cause hg to do one |
@@ -22,7 +22,7 b' nevernegate = set([' | |||
|
22 | 22 | # like aliases anyway. |
|
23 | 23 | 'help', |
|
24 | 24 | 'version', |
|
25 | ]) | |
|
25 | } | |
|
26 | 26 | |
|
27 | 27 | def gnugetopt(args, options, longoptions): |
|
28 | 28 | """Parse options mostly like getopt.gnu_getopt. |
@@ -37,7 +37,7 b' elements = {' | |||
|
37 | 37 | "end": (0, None, None, None, None), |
|
38 | 38 | } |
|
39 | 39 | |
|
40 |
keywords = |
|
|
40 | keywords = {'and', 'or', 'not'} | |
|
41 | 41 | |
|
42 | 42 | globchars = ".*{}[]?/\\_" |
|
43 | 43 |
@@ -34,7 +34,7 b' from .hgweb import (' | |||
|
34 | 34 | webcommands, |
|
35 | 35 | ) |
|
36 | 36 | |
|
37 |
_exclkeywords = |
|
|
37 | _exclkeywords = { | |
|
38 | 38 | "(ADVANCED)", |
|
39 | 39 | "(DEPRECATED)", |
|
40 | 40 | "(EXPERIMENTAL)", |
@@ -44,7 +44,7 b' from .hgweb import (' | |||
|
44 | 44 | _("(DEPRECATED)"), |
|
45 | 45 | # i18n: "(EXPERIMENTAL)" is a keyword, must be translated consistently |
|
46 | 46 | _("(EXPERIMENTAL)"), |
|
47 | ]) | |
|
47 | } | |
|
48 | 48 | |
|
49 | 49 | def listexts(header, exts, indent=1, showdeprecated=False): |
|
50 | 50 | '''return a text listing of the given extensions''' |
@@ -113,9 +113,9 b' def unfilteredmethod(orig):' | |||
|
113 | 113 | return orig(repo.unfiltered(), *args, **kwargs) |
|
114 | 114 | return wrapper |
|
115 | 115 | |
|
116 |
moderncaps = |
|
|
117 |
|
|
|
118 |
legacycaps = moderncaps.union( |
|
|
116 | moderncaps = {'lookup', 'branchmap', 'pushkey', 'known', 'getbundle', | |
|
117 | 'unbundle'} | |
|
118 | legacycaps = moderncaps.union({'changegroupsubset'}) | |
|
119 | 119 | |
|
120 | 120 | class localpeer(peer.peerrepository): |
|
121 | 121 | '''peer for a local repo; reflects only the most recent API''' |
@@ -247,11 +247,11 b' class locallegacypeer(localpeer):' | |||
|
247 | 247 | |
|
248 | 248 | class localrepository(object): |
|
249 | 249 | |
|
250 |
supportedformats = |
|
|
251 |
|
|
|
252 |
_basesupported = supportedformats | |
|
|
253 |
|
|
|
254 |
openerreqs = |
|
|
250 | supportedformats = {'revlogv1', 'generaldelta', 'treemanifest', | |
|
251 | 'manifestv2'} | |
|
252 | _basesupported = supportedformats | {'store', 'fncache', 'shared', | |
|
253 | 'relshared', 'dotencode'} | |
|
254 | openerreqs = {'revlogv1', 'generaldelta', 'treemanifest', 'manifestv2'} | |
|
255 | 255 | filtername = None |
|
256 | 256 | |
|
257 | 257 | # a list of (ui, featureset) functions. |
@@ -2020,7 +2020,7 b' def newreporequirements(repo):' | |||
|
2020 | 2020 | new repositories. |
|
2021 | 2021 | """ |
|
2022 | 2022 | ui = repo.ui |
|
2023 |
requirements = |
|
|
2023 | requirements = {'revlogv1'} | |
|
2024 | 2024 | if ui.configbool('format', 'usestore', True): |
|
2025 | 2025 | requirements.add('store') |
|
2026 | 2026 | if ui.configbool('format', 'usefncache', True): |
@@ -236,7 +236,7 b' class match(object):' | |||
|
236 | 236 | |
|
237 | 237 | @propertycache |
|
238 | 238 | def _dirs(self): |
|
239 |
return set(util.dirs(self._fileroots)) | |
|
|
239 | return set(util.dirs(self._fileroots)) | {'.'} | |
|
240 | 240 | |
|
241 | 241 | def visitdir(self, dir): |
|
242 | 242 | '''Decides whether a directory should be visited based on whether it |
@@ -46,7 +46,7 b' class namespaces(object):' | |||
|
46 | 46 | logfmt=_("tag: %s\n"), |
|
47 | 47 | listnames=tagnames, |
|
48 | 48 | namemap=tagnamemap, nodemap=tagnodemap, |
|
49 |
deprecated= |
|
|
49 | deprecated={'tip'}) | |
|
50 | 50 | self.addnamespace(n) |
|
51 | 51 | |
|
52 | 52 | bnames = lambda repo: repo.branchmap().keys() |
@@ -23,7 +23,7 b" newnodeid = '!' * 20" | |||
|
23 | 23 | addednodeid = ('0' * 15) + 'added' |
|
24 | 24 | modifiednodeid = ('0' * 12) + 'modified' |
|
25 | 25 | |
|
26 |
wdirnodes = |
|
|
26 | wdirnodes = {newnodeid, addednodeid, modifiednodeid} | |
|
27 | 27 | |
|
28 | 28 | # pseudo identifiers for working directory |
|
29 | 29 | # (they are experimental, so don't add too many dependencies on them) |
@@ -474,7 +474,7 b' def findexe(command):' | |||
|
474 | 474 | def setsignalhandler(): |
|
475 | 475 | pass |
|
476 | 476 | |
|
477 |
_wantedkinds = |
|
|
477 | _wantedkinds = {stat.S_IFREG, stat.S_IFLNK} | |
|
478 | 478 | |
|
479 | 479 | def statfiles(files): |
|
480 | 480 | '''Stat each file in files. Yield each stat, or None if a file does not |
@@ -913,8 +913,8 b' class revlog(object):' | |||
|
913 | 913 | stop = [] |
|
914 | 914 | stoprevs = set([self.rev(n) for n in stop]) |
|
915 | 915 | startrev = self.rev(start) |
|
916 |
reachable = |
|
|
917 |
heads = |
|
|
916 | reachable = {startrev} | |
|
917 | heads = {startrev} | |
|
918 | 918 | |
|
919 | 919 | parentrevs = self.parentrevs |
|
920 | 920 | for r in self.revs(start=startrev + 1): |
@@ -2039,7 +2039,7 b' class revlog(object):' | |||
|
2039 | 2039 | DELTAREUSESAMEREVS = 'samerevs' |
|
2040 | 2040 | DELTAREUSENEVER = 'never' |
|
2041 | 2041 | |
|
2042 |
DELTAREUSEALL = |
|
|
2042 | DELTAREUSEALL = {'always', 'samerevs', 'never'} | |
|
2043 | 2043 | |
|
2044 | 2044 | def clone(self, tr, destrevlog, addrevisioncb=None, |
|
2045 | 2045 | deltareuse=DELTAREUSESAMEREVS, aggressivemergedeltas=None): |
@@ -451,9 +451,8 b' def bookmark(repo, subset, x):' | |||
|
451 | 451 | for bmrev in matchrevs: |
|
452 | 452 | bms.add(repo[bmrev].rev()) |
|
453 | 453 | else: |
|
454 | bms = set([repo[r].rev() | |
|
455 | for r in repo._bookmarks.values()]) | |
|
456 | bms -= set([node.nullrev]) | |
|
454 | bms = {repo[r].rev() for r in repo._bookmarks.values()} | |
|
455 | bms -= {node.nullrev} | |
|
457 | 456 | return subset & bms |
|
458 | 457 | |
|
459 | 458 | @predicate('branch(string or set)', safe=True) |
@@ -1276,7 +1275,7 b' def named(repo, subset, x):' | |||
|
1276 | 1275 | if name not in ns.deprecated: |
|
1277 | 1276 | names.update(repo[n].rev() for n in ns.nodes(repo, name)) |
|
1278 | 1277 | |
|
1279 |
names -= |
|
|
1278 | names -= {node.nullrev} | |
|
1280 | 1279 | return subset & names |
|
1281 | 1280 | |
|
1282 | 1281 | @predicate('id(string)', safe=True) |
@@ -1363,8 +1362,8 b' def origin(repo, subset, x):' | |||
|
1363 | 1362 | return src |
|
1364 | 1363 | src = prev |
|
1365 | 1364 | |
|
1366 |
o = |
|
|
1367 |
o -= |
|
|
1365 | o = {_firstsrc(r) for r in dests} | |
|
1366 | o -= {None} | |
|
1368 | 1367 | # XXX we should turn this into a baseset instead of a set, smartset may do |
|
1369 | 1368 | # some optimizations from the fact this is a baseset. |
|
1370 | 1369 | return subset & o |
@@ -1393,7 +1392,7 b' def outgoing(repo, subset, x):' | |||
|
1393 | 1392 | outgoing = discovery.findcommonoutgoing(repo, other, onlyheads=revs) |
|
1394 | 1393 | repo.ui.popbuffer() |
|
1395 | 1394 | cl = repo.changelog |
|
1396 |
o = |
|
|
1395 | o = {cl.rev(r) for r in outgoing.missing} | |
|
1397 | 1396 | return subset & o |
|
1398 | 1397 | |
|
1399 | 1398 | @predicate('p1([set])', safe=True) |
@@ -1410,7 +1409,7 b' def p1(repo, subset, x):' | |||
|
1410 | 1409 | cl = repo.changelog |
|
1411 | 1410 | for r in getset(repo, fullreposet(repo), x): |
|
1412 | 1411 | ps.add(cl.parentrevs(r)[0]) |
|
1413 |
ps -= |
|
|
1412 | ps -= {node.nullrev} | |
|
1414 | 1413 | # XXX we should turn this into a baseset instead of a set, smartset may do |
|
1415 | 1414 | # some optimizations from the fact this is a baseset. |
|
1416 | 1415 | return subset & ps |
@@ -1433,7 +1432,7 b' def p2(repo, subset, x):' | |||
|
1433 | 1432 | cl = repo.changelog |
|
1434 | 1433 | for r in getset(repo, fullreposet(repo), x): |
|
1435 | 1434 | ps.add(cl.parentrevs(r)[1]) |
|
1436 |
ps -= |
|
|
1435 | ps -= {node.nullrev} | |
|
1437 | 1436 | # XXX we should turn this into a baseset instead of a set, smartset may do |
|
1438 | 1437 | # some optimizations from the fact this is a baseset. |
|
1439 | 1438 | return subset & ps |
@@ -1458,7 +1457,7 b' def parents(repo, subset, x):' | |||
|
1458 | 1457 | up(p.rev() for p in repo[r].parents()) |
|
1459 | 1458 | else: |
|
1460 | 1459 | up(parentrevs(r)) |
|
1461 |
ps -= |
|
|
1460 | ps -= {node.nullrev} | |
|
1462 | 1461 | return subset & ps |
|
1463 | 1462 | |
|
1464 | 1463 | def _phase(repo, subset, *targets): |
@@ -1965,7 +1964,7 b' def _toposort(revs, parentsfunc, firstbr' | |||
|
1965 | 1964 | else: |
|
1966 | 1965 | # This is a new head. We create a new subgroup for it. |
|
1967 | 1966 | targetidx = len(groups) |
|
1968 |
groups.append(([], |
|
|
1967 | groups.append(([], {rev})) | |
|
1969 | 1968 | |
|
1970 | 1969 | gr = groups[targetidx] |
|
1971 | 1970 | |
@@ -2098,11 +2097,11 b' def tag(repo, subset, x):' | |||
|
2098 | 2097 | if tn is None: |
|
2099 | 2098 | raise error.RepoLookupError(_("tag '%s' does not exist") |
|
2100 | 2099 | % pattern) |
|
2101 |
s = |
|
|
2100 | s = {repo[tn].rev()} | |
|
2102 | 2101 | else: |
|
2103 |
s = |
|
|
2102 | s = {cl.rev(n) for t, n in repo.tagslist() if matcher(t)} | |
|
2104 | 2103 | else: |
|
2105 |
s = |
|
|
2104 | s = {cl.rev(n) for t, n in repo.tagslist() if t != 'tip'} | |
|
2106 | 2105 | return subset & s |
|
2107 | 2106 | |
|
2108 | 2107 | @predicate('tagged', safe=True) |
@@ -44,9 +44,9 b' elements = {' | |||
|
44 | 44 | "end": (0, None, None, None, None), |
|
45 | 45 | } |
|
46 | 46 | |
|
47 |
keywords = |
|
|
47 | keywords = {'and', 'or', 'not'} | |
|
48 | 48 | |
|
49 |
_quoteletters = |
|
|
49 | _quoteletters = {'"', "'"} | |
|
50 | 50 | _simpleopletters = set(pycompat.iterbytestr("():=,-|&+!~^%")) |
|
51 | 51 | |
|
52 | 52 | # default set of valid characters for the initial letter of symbols |
@@ -123,7 +123,7 b' def _createhgwebservice(ui, repo, opts):' | |||
|
123 | 123 | if opts.get('port'): |
|
124 | 124 | opts['port'] = util.getport(opts.get('port')) |
|
125 | 125 | |
|
126 |
alluis = |
|
|
126 | alluis = {ui} | |
|
127 | 127 | if repo: |
|
128 | 128 | baseui = repo.baseui |
|
129 | 129 | alluis.update([repo.baseui, repo.ui]) |
@@ -243,7 +243,7 b' def findcommonheads(ui, local, remote,' | |||
|
243 | 243 | raise error.Abort(_("repository is unrelated")) |
|
244 | 244 | else: |
|
245 | 245 | ui.warn(_("warning: repository is unrelated\n")) |
|
246 |
return ( |
|
|
246 | return ({nullid}, True, srvheadhashes,) | |
|
247 | 247 | |
|
248 | 248 | anyincoming = (srvheadhashes != [nullid]) |
|
249 | 249 | return dag.externalizeall(result), anyincoming, srvheadhashes |
@@ -29,17 +29,17 b' from . import (' | |||
|
29 | 29 | # modern/secure or legacy/insecure. Many operations in this module have |
|
30 | 30 | # separate code paths depending on support in Python. |
|
31 | 31 | |
|
32 |
configprotocols = |
|
|
32 | configprotocols = { | |
|
33 | 33 | 'tls1.0', |
|
34 | 34 | 'tls1.1', |
|
35 | 35 | 'tls1.2', |
|
36 | ]) | |
|
36 | } | |
|
37 | 37 | |
|
38 | 38 | hassni = getattr(ssl, 'HAS_SNI', False) |
|
39 | 39 | |
|
40 | 40 | # TLS 1.1 and 1.2 may not be supported if the OpenSSL Python is compiled |
|
41 | 41 | # against doesn't support them. |
|
42 |
supportedprotocols = |
|
|
42 | supportedprotocols = {'tls1.0'} | |
|
43 | 43 | if util.safehasattr(ssl, 'PROTOCOL_TLSv1_1'): |
|
44 | 44 | supportedprotocols.add('tls1.1') |
|
45 | 45 | if util.safehasattr(ssl, 'PROTOCOL_TLSv1_2'): |
@@ -296,7 +296,7 b' def protocolsettings(protocol):' | |||
|
296 | 296 | # disable protocols via SSLContext.options and OP_NO_* constants. |
|
297 | 297 | # However, SSLContext.options doesn't work unless we have the |
|
298 | 298 | # full/real SSLContext available to us. |
|
299 |
if supportedprotocols == |
|
|
299 | if supportedprotocols == {'tls1.0'}: | |
|
300 | 300 | if protocol != 'tls1.0': |
|
301 | 301 | raise error.Abort(_('current Python does not support protocol ' |
|
302 | 302 | 'setting %s') % protocol, |
@@ -430,7 +430,7 b' def wrapsocket(sock, keyfile, certfile, ' | |||
|
430 | 430 | # is really old. (e.g. server doesn't support TLS 1.0+ or |
|
431 | 431 | # client doesn't support modern TLS versions introduced |
|
432 | 432 | # several years from when this comment was written). |
|
433 |
if supportedprotocols != |
|
|
433 | if supportedprotocols != {'tls1.0'}: | |
|
434 | 434 | ui.warn(_( |
|
435 | 435 | '(could not communicate with %s using security ' |
|
436 | 436 | 'protocols %s; if you are using a modern Mercurial ' |
@@ -126,14 +126,14 b' contextmanager = contextlib.contextmanag' | |||
|
126 | 126 | |
|
127 | 127 | __all__ = ['start', 'stop', 'reset', 'display', 'profile'] |
|
128 | 128 | |
|
129 |
skips = |
|
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
|
136 | ]) | |
|
129 | skips = {"util.py:check", "extensions.py:closure", | |
|
130 | "color.py:colorcmd", "dispatch.py:checkargs", | |
|
131 | "dispatch.py:<lambda>", "dispatch.py:_runcatch", | |
|
132 | "dispatch.py:_dispatch", "dispatch.py:_runcommand", | |
|
133 | "pager.py:pagecmd", "dispatch.py:run", | |
|
134 | "dispatch.py:dispatch", "dispatch.py:runcommand", | |
|
135 | "hg.py:<module>", "evolve.py:warnobserrors", | |
|
136 | } | |
|
137 | 137 | |
|
138 | 138 | ########################################################################### |
|
139 | 139 | ## Utils |
@@ -26,10 +26,10 b' version = 2' | |||
|
26 | 26 | # These are the file generators that should only be executed after the |
|
27 | 27 | # finalizers are done, since they rely on the output of the finalizers (like |
|
28 | 28 | # the changelog having been written). |
|
29 |
postfinalizegenerators = |
|
|
29 | postfinalizegenerators = { | |
|
30 | 30 | 'bookmarks', |
|
31 | 31 | 'dirstate' |
|
32 | ]) | |
|
32 | } | |
|
33 | 33 | |
|
34 | 34 | gengroupall='all' |
|
35 | 35 | gengroupprefinalize='prefinalize' |
@@ -28,12 +28,12 b' def requiredsourcerequirements(repo):' | |||
|
28 | 28 | An upgrade will not be allowed if the repository doesn't have the |
|
29 | 29 | requirements returned by this function. |
|
30 | 30 | """ |
|
31 |
return |
|
|
31 | return { | |
|
32 | 32 | # Introduced in Mercurial 0.9.2. |
|
33 | 33 | 'revlogv1', |
|
34 | 34 | # Introduced in Mercurial 0.9.2. |
|
35 | 35 | 'store', |
|
36 |
|
|
|
36 | } | |
|
37 | 37 | |
|
38 | 38 | def blocksourcerequirements(repo): |
|
39 | 39 | """Obtain requirements that will prevent an upgrade from occurring. |
@@ -41,7 +41,7 b' def blocksourcerequirements(repo):' | |||
|
41 | 41 | An upgrade cannot be performed if the source repository contains a |
|
42 | 42 | requirements in the returned set. |
|
43 | 43 | """ |
|
44 |
return |
|
|
44 | return { | |
|
45 | 45 | # The upgrade code does not yet support these experimental features. |
|
46 | 46 | # This is an artificial limitation. |
|
47 | 47 | 'manifestv2', |
@@ -51,7 +51,7 b' def blocksourcerequirements(repo):' | |||
|
51 | 51 | 'parentdelta', |
|
52 | 52 | # Upgrade should operate on the actual store, not the shared link. |
|
53 | 53 | 'shared', |
|
54 |
|
|
|
54 | } | |
|
55 | 55 | |
|
56 | 56 | def supportremovedrequirements(repo): |
|
57 | 57 | """Obtain requirements that can be removed during an upgrade. |
@@ -70,13 +70,13 b' def supporteddestrequirements(repo):' | |||
|
70 | 70 | |
|
71 | 71 | Extensions should monkeypatch this to add their custom requirements. |
|
72 | 72 | """ |
|
73 |
return |
|
|
73 | return { | |
|
74 | 74 | 'dotencode', |
|
75 | 75 | 'fncache', |
|
76 | 76 | 'generaldelta', |
|
77 | 77 | 'revlogv1', |
|
78 | 78 | 'store', |
|
79 |
|
|
|
79 | } | |
|
80 | 80 | |
|
81 | 81 | def allowednewrequirements(repo): |
|
82 | 82 | """Obtain requirements that can be added to a repository during upgrade. |
@@ -88,11 +88,11 b' def allowednewrequirements(repo):' | |||
|
88 | 88 | bad additions because the whitelist approach is safer and will prevent |
|
89 | 89 | future, unknown requirements from accidentally being added. |
|
90 | 90 | """ |
|
91 |
return |
|
|
91 | return { | |
|
92 | 92 | 'dotencode', |
|
93 | 93 | 'fncache', |
|
94 | 94 | 'generaldelta', |
|
95 |
|
|
|
95 | } | |
|
96 | 96 | |
|
97 | 97 | deficiency = 'deficiency' |
|
98 | 98 | optimisation = 'optimization' |
@@ -628,7 +628,7 b' def _upgraderepo(ui, srcrepo, dstrepo, r' | |||
|
628 | 628 | ui.write(_('marking source repository as being upgraded; clients will be ' |
|
629 | 629 | 'unable to read from repository\n')) |
|
630 | 630 | scmutil.writerequires(srcrepo.vfs, |
|
631 |
srcrepo.requirements | |
|
|
631 | srcrepo.requirements | {'upgradeinprogress'}) | |
|
632 | 632 | |
|
633 | 633 | ui.write(_('starting in-place swap of repository data\n')) |
|
634 | 634 | ui.write(_('replaced files will be backed up at %s\n') % |
@@ -1097,7 +1097,7 b' def checksignature(func):' | |||
|
1097 | 1097 | return check |
|
1098 | 1098 | |
|
1099 | 1099 | # a whilelist of known filesystems where hardlink works reliably |
|
1100 |
_hardlinkfswhitelist = |
|
|
1100 | _hardlinkfswhitelist = { | |
|
1101 | 1101 | 'btrfs', |
|
1102 | 1102 | 'ext2', |
|
1103 | 1103 | 'ext3', |
@@ -1109,7 +1109,7 b' def checksignature(func):' | |||
|
1109 | 1109 | 'ufs', |
|
1110 | 1110 | 'xfs', |
|
1111 | 1111 | 'zfs', |
|
1112 | ]) | |
|
1112 | } | |
|
1113 | 1113 | |
|
1114 | 1114 | def copyfile(src, dest, hardlink=False, copystat=False, checkambig=False): |
|
1115 | 1115 | '''copy a file, preserving mode and optionally other stat info like |
@@ -334,7 +334,7 b' def findexe(command):' | |||
|
334 | 334 | return executable |
|
335 | 335 | return findexisting(os.path.expanduser(os.path.expandvars(command))) |
|
336 | 336 | |
|
337 |
_wantedkinds = |
|
|
337 | _wantedkinds = {stat.S_IFREG, stat.S_IFLNK} | |
|
338 | 338 | |
|
339 | 339 | def statfiles(files): |
|
340 | 340 | '''Stat each file in files. Yield each stat, or None if a file |
@@ -759,7 +759,7 b' def _capabilities(repo, proto):' | |||
|
759 | 759 | caps.append('stream-preferred') |
|
760 | 760 | requiredformats = repo.requirements & repo.supportedformats |
|
761 | 761 | # if our local revlogs are just revlogv1, add 'stream' cap |
|
762 |
if not requiredformats - |
|
|
762 | if not requiredformats - {'revlogv1'}: | |
|
763 | 763 | caps.append('stream') |
|
764 | 764 | # otherwise, add 'streamreqs' detailing our local revlog format |
|
765 | 765 | else: |
@@ -26,7 +26,7 b' def modulewhitelist(names):' | |||
|
26 | 26 | replacement = [('.py', ''), ('.c', ''), # trim suffix |
|
27 | 27 | ('mercurial%s' % (os.sep), ''), # trim "mercurial/" path |
|
28 | 28 | ] |
|
29 |
ignored = |
|
|
29 | ignored = {'__init__'} | |
|
30 | 30 | modules = {} |
|
31 | 31 | |
|
32 | 32 | # convert from file name to module name, and count # of appearances |
@@ -145,7 +145,7 b' def _parseasciigraph(text):' | |||
|
145 | 145 | def parents(y, x): |
|
146 | 146 | """(int, int) -> [str]. follow the ASCII edges at given position, |
|
147 | 147 | return a list of parents""" |
|
148 |
visited = |
|
|
148 | visited = {(y, x)} | |
|
149 | 149 | visit = [] |
|
150 | 150 | result = [] |
|
151 | 151 |
@@ -47,7 +47,7 b' def generatestates(maxchangesets, parent' | |||
|
47 | 47 | content in parentcontents]) + "-" + tracked |
|
48 | 48 | yield (filename, parentcontents) |
|
49 | 49 | else: |
|
50 |
for content in ( |
|
|
50 | for content in ({None, 'content' + str(depth + 1)} | | |
|
51 | 51 | set(parentcontents)): |
|
52 | 52 | for combination in generatestates(maxchangesets, |
|
53 | 53 | parentcontents + [content]): |
@@ -49,7 +49,7 b' def buildgraph(rng, nodes=100, rootprob=' | |||
|
49 | 49 | def buildancestorsets(graph): |
|
50 | 50 | ancs = [None] * len(graph) |
|
51 | 51 | for i in xrange(len(graph)): |
|
52 |
ancs[i] = |
|
|
52 | ancs[i] = {i} | |
|
53 | 53 | if graph[i] == [nullrev]: |
|
54 | 54 | continue |
|
55 | 55 | for p in graph[i]: |
@@ -6,7 +6,7 b' from mercurial import (' | |||
|
6 | 6 | ui as uimod, |
|
7 | 7 | ) |
|
8 | 8 | |
|
9 |
ignore = |
|
|
9 | ignore = {'highlight', 'win32text', 'factotum'} | |
|
10 | 10 | |
|
11 | 11 | if os.name != 'nt': |
|
12 | 12 | ignore.add('win32mbcs') |
@@ -154,7 +154,7 b' check saving last-message.txt' | |||
|
154 | 154 | > from mercurial import util |
|
155 | 155 | > def abortfolding(ui, repo, hooktype, **kwargs): |
|
156 | 156 | > ctx = repo[kwargs.get('node')] |
|
157 |
> if set(ctx.files()) == |
|
|
157 | > if set(ctx.files()) == {'c', 'd', 'f'}: | |
|
158 | 158 | > return True # abort folding commit only |
|
159 | 159 | > ui.warn('allow non-folding commit\\n') |
|
160 | 160 | > EOF |
@@ -37,7 +37,7 b' another repository of push/pull/clone on' | |||
|
37 | 37 | > for name, module in extensions.extensions(ui): |
|
38 | 38 | > if __name__ == module.__name__: |
|
39 | 39 | > # support specific feature locally |
|
40 |
> supported |= |
|
|
40 | > supported |= {'featuresetup-test'} | |
|
41 | 41 | > return |
|
42 | 42 | > def uisetup(ui): |
|
43 | 43 | > localrepo.localrepository.featuresetupfuncs.add(featuresetup) |
General Comments 0
You need to be logged in to leave comments.
Login now