Looks like a few patches have landed without having been blackened. I
strongly suspect I should write a patch for baymax that blackens
things on the way in...
- skip-blame automatic formatting
hg-reviewers |
Looks like a few patches have landed without having been blackened. I
strongly suspect I should write a patch for baymax that blackens
things on the way in...
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/branchmap.py (4 lines) | |||
M | mercurial/changegroup.py (4 lines) | |||
M | mercurial/cmdutil.py (11 lines) | |||
M | mercurial/commands.py (7 lines) | |||
M | mercurial/debugcommands.py (2 lines) | |||
M | mercurial/discovery.py (2 lines) | |||
M | mercurial/dispatch.py (2 lines) | |||
M | mercurial/help.py (12 lines) | |||
M | mercurial/posix.py (5 lines) | |||
M | mercurial/tags.py (4 lines) |
except Exception as inst: | except Exception as inst: | ||||
if repo.ui.debugflag: | if repo.ui.debugflag: | ||||
msg = b'invalid %s: %s\n' | msg = b'invalid %s: %s\n' | ||||
repo.ui.debug( | repo.ui.debug( | ||||
msg | msg | ||||
% ( | % ( | ||||
_branchcachedesc(repo), | _branchcachedesc(repo), | ||||
pycompat.bytestr( | pycompat.bytestr( | ||||
inst # pytype: disable=wrong-arg-types | inst | ||||
), | ), # pytype: disable=wrong-arg-types | ||||
) | ) | ||||
) | ) | ||||
bcache = None | bcache = None | ||||
finally: | finally: | ||||
if f: | if f: | ||||
f.close() | f.close() | ||||
# Callback for the manifest, used to collect linkrevs for filelog | # Callback for the manifest, used to collect linkrevs for filelog | ||||
# revisions. | # revisions. | ||||
# Returns the linkrev node (collected in lookupcl). | # Returns the linkrev node (collected in lookupcl). | ||||
def makelookupmflinknode(tree, nodes): | def makelookupmflinknode(tree, nodes): | ||||
if fastpathlinkrev: | if fastpathlinkrev: | ||||
assert not tree | assert not tree | ||||
return ( | return ( | ||||
manifests.__getitem__ # pytype: disable=unsupported-operands | manifests.__getitem__ | ||||
) | ) # pytype: disable=unsupported-operands | ||||
def lookupmflinknode(x): | def lookupmflinknode(x): | ||||
"""Callback for looking up the linknode for manifests. | """Callback for looking up the linknode for manifests. | ||||
Returns the linkrev node for the specified manifest. | Returns the linkrev node for the specified manifest. | ||||
SIDE EFFECT: | SIDE EFFECT: | ||||
(b'l', b'limit', b'', _(b'limit number of changes displayed'), _(b'NUM')), | (b'l', b'limit', b'', _(b'limit number of changes displayed'), _(b'NUM')), | ||||
(b'M', b'no-merges', None, _(b'do not show merges')), | (b'M', b'no-merges', None, _(b'do not show merges')), | ||||
(b'', b'stat', None, _(b'output diffstat-style summary of changes')), | (b'', b'stat', None, _(b'output diffstat-style summary of changes')), | ||||
(b'G', b'graph', None, _(b"show the revision DAG")), | (b'G', b'graph', None, _(b"show the revision DAG")), | ||||
] + templateopts | ] + templateopts | ||||
diffopts = [ | diffopts = [ | ||||
(b'a', b'text', None, _(b'treat all files as text')), | (b'a', b'text', None, _(b'treat all files as text')), | ||||
(b'g', b'git', None, _(b'use git extended diff format (DEFAULT: diff.git)')), | ( | ||||
b'g', | |||||
b'git', | |||||
None, | |||||
_(b'use git extended diff format (DEFAULT: diff.git)'), | |||||
), | |||||
(b'', b'binary', None, _(b'generate binary diffs in git mode (default)')), | (b'', b'binary', None, _(b'generate binary diffs in git mode (default)')), | ||||
(b'', b'nodates', None, _(b'omit dates from diff headers')), | (b'', b'nodates', None, _(b'omit dates from diff headers')), | ||||
] | ] | ||||
diffwsopts = [ | diffwsopts = [ | ||||
( | ( | ||||
b'w', | b'w', | ||||
b'ignore-all-space', | b'ignore-all-space', | ||||
diffopts2 = ( | diffopts2 = ( | ||||
[ | [ | ||||
(b'', b'noprefix', None, _(b'omit a/ and b/ prefixes from filenames')), | (b'', b'noprefix', None, _(b'omit a/ and b/ prefixes from filenames')), | ||||
( | ( | ||||
b'p', | b'p', | ||||
b'show-function', | b'show-function', | ||||
None, | None, | ||||
_(b'show which function each change is in (DEFAULT: diff.showfunc)'), | _( | ||||
b'show which function each change is in (DEFAULT: diff.showfunc)' | |||||
), | |||||
), | ), | ||||
(b'', b'reverse', None, _(b'produce a diff that undoes the changes')), | (b'', b'reverse', None, _(b'produce a diff that undoes the changes')), | ||||
] | ] | ||||
+ diffwsopts | + diffwsopts | ||||
+ [ | + [ | ||||
( | ( | ||||
b'U', | b'U', | ||||
b'unified', | b'unified', |
(b'a', b'added', None, _(b'show only added files')), | (b'a', b'added', None, _(b'show only added files')), | ||||
(b'r', b'removed', None, _(b'show only removed files')), | (b'r', b'removed', None, _(b'show only removed files')), | ||||
(b'd', b'deleted', None, _(b'show only deleted (but tracked) files')), | (b'd', b'deleted', None, _(b'show only deleted (but tracked) files')), | ||||
(b'c', b'clean', None, _(b'show only files without changes')), | (b'c', b'clean', None, _(b'show only files without changes')), | ||||
(b'u', b'unknown', None, _(b'show only unknown (not tracked) files')), | (b'u', b'unknown', None, _(b'show only unknown (not tracked) files')), | ||||
(b'i', b'ignored', None, _(b'show only ignored files')), | (b'i', b'ignored', None, _(b'show only ignored files')), | ||||
(b'n', b'no-status', None, _(b'hide status prefix')), | (b'n', b'no-status', None, _(b'hide status prefix')), | ||||
(b't', b'terse', _NOTTERSE, _(b'show the terse output (EXPERIMENTAL)')), | (b't', b'terse', _NOTTERSE, _(b'show the terse output (EXPERIMENTAL)')), | ||||
(b'C', b'copies', None, _(b'show source of copied files (DEFAULT: ui.statuscopies)')), | ( | ||||
b'C', | |||||
b'copies', | |||||
None, | |||||
_(b'show source of copied files (DEFAULT: ui.statuscopies)'), | |||||
), | |||||
( | ( | ||||
b'0', | b'0', | ||||
b'print0', | b'print0', | ||||
None, | None, | ||||
_(b'end filenames with NUL, for use with xargs'), | _(b'end filenames with NUL, for use with xargs'), | ||||
), | ), | ||||
(b'', b'rev', [], _(b'show difference from revision'), _(b'REV')), | (b'', b'rev', [], _(b'show difference from revision'), _(b'REV')), | ||||
( | ( |
if succsset: | if succsset: | ||||
ui.write(b' ') | ui.write(b' ') | ||||
ui.write(node2str(succsset[0])) | ui.write(node2str(succsset[0])) | ||||
for node in succsset[1:]: | for node in succsset[1:]: | ||||
ui.write(b' ') | ui.write(b' ') | ||||
ui.write(node2str(node)) | ui.write(node2str(node)) | ||||
ui.write(b'\n') | ui.write(b'\n') | ||||
@command(b'debugtagscache', []) | @command(b'debugtagscache', []) | ||||
def debugtagscache(ui, repo): | def debugtagscache(ui, repo): | ||||
"""display the contents of .hg/cache/hgtagsfnodes1""" | """display the contents of .hg/cache/hgtagsfnodes1""" | ||||
cache = tagsmod.hgtagsfnodescache(repo.unfiltered()) | cache = tagsmod.hgtagsfnodescache(repo.unfiltered()) | ||||
for r in repo: | for r in repo: | ||||
node = repo[r].node() | node = repo[r].node() | ||||
tagsnode = cache.getfnode(node, computemissing=False) | tagsnode = cache.getfnode(node, computemissing=False) | ||||
tagsnodedisplay = hex(tagsnode) if tagsnode else 'missing/invalid' | tagsnodedisplay = hex(tagsnode) if tagsnode else 'missing/invalid' | ||||
ui.write(b'%s %s %s\n' % (r, hex(node), tagsnodedisplay)) | ui.write(b'%s %s %s\n' % (r, hex(node), tagsnodedisplay)) | ||||
@command( | @command( | ||||
b'debugtemplate', | b'debugtemplate', | ||||
[ | [ | ||||
(b'r', b'rev', [], _(b'apply template on changesets'), _(b'REV')), | (b'r', b'rev', [], _(b'apply template on changesets'), _(b'REV')), | ||||
(b'D', b'define', [], _(b'define template keyword'), _(b'KEY=VALUE')), | (b'D', b'define', [], _(b'define template keyword'), _(b'KEY=VALUE')), | ||||
], | ], | ||||
_(b'[-r REV]... [-D KEY=VALUE]... TEMPLATE'), | _(b'[-r REV]... [-D KEY=VALUE]... TEMPLATE'), | ||||
optionalrepo=True, | optionalrepo=True, |
elif len(newhs) > len(oldhs): | elif len(newhs) > len(oldhs): | ||||
# remove bookmarked or existing remote heads from the new heads list | # remove bookmarked or existing remote heads from the new heads list | ||||
dhs = sorted(newhs - nowarnheads - oldhs) | dhs = sorted(newhs - nowarnheads - oldhs) | ||||
if dhs: | if dhs: | ||||
if errormsg is None: | if errormsg is None: | ||||
if branch not in (b'default', None): | if branch not in (b'default', None): | ||||
errormsg = _( | errormsg = _( | ||||
b"push creates new remote head %s on branch '%s'!" | b"push creates new remote head %s on branch '%s'!" | ||||
) % (short(dhs[0]), branch) | ) % (short(dhs[0]), branch,) | ||||
elif repo[dhs[0]].bookmarks(): | elif repo[dhs[0]].bookmarks(): | ||||
errormsg = _( | errormsg = _( | ||||
b"push creates new remote head %s " | b"push creates new remote head %s " | ||||
b"with bookmark '%s'!" | b"with bookmark '%s'!" | ||||
) % (short(dhs[0]), repo[dhs[0]].bookmarks()[0]) | ) % (short(dhs[0]), repo[dhs[0]].bookmarks()[0]) | ||||
else: | else: | ||||
errormsg = _(b"push creates new remote head %s!") % short( | errormsg = _(b"push creates new remote head %s!") % short( | ||||
dhs[0] | dhs[0] |
except error.UnknownCommand: | except error.UnknownCommand: | ||||
self.badalias = _( | self.badalias = _( | ||||
b"alias '%s' resolves to unknown command '%s'" | b"alias '%s' resolves to unknown command '%s'" | ||||
) % (self.name, cmd,) | ) % (self.name, cmd,) | ||||
self.unknowncmd = True | self.unknowncmd = True | ||||
except error.AmbiguousCommand: | except error.AmbiguousCommand: | ||||
self.badalias = _( | self.badalias = _( | ||||
b"alias '%s' resolves to ambiguous command '%s'" | b"alias '%s' resolves to ambiguous command '%s'" | ||||
) % (self.name, cmd) | ) % (self.name, cmd,) | ||||
def _populatehelp(self, ui, name, cmd, fn, defaulthelp=None): | def _populatehelp(self, ui, name, cmd, fn, defaulthelp=None): | ||||
# confine strings to be passed to i18n.gettext() | # confine strings to be passed to i18n.gettext() | ||||
cfg = {} | cfg = {} | ||||
for k in (b'doc', b'help', b'category'): | for k in (b'doc', b'help', b'category'): | ||||
v = ui.config(b'alias', b'%s:%s' % (name, k), None) | v = ui.config(b'alias', b'%s:%s' % (name, k), None) | ||||
if v is None: | if v is None: | ||||
continue | continue |
_(b'disabled extensions:'), | _(b'disabled extensions:'), | ||||
extensions.disabled(), | extensions.disabled(), | ||||
showdeprecated=ui.verbose, | showdeprecated=ui.verbose, | ||||
) | ) | ||||
) | ) | ||||
doc = b''.join(rst) | doc = b''.join(rst) | ||||
return doc | return doc | ||||
def parsedefaultmarker(text): | def parsedefaultmarker(text): | ||||
"""given a text 'abc (DEFAULT: def.ghi)', | """given a text 'abc (DEFAULT: def.ghi)', | ||||
returns (b'abc', (b'def', b'ghi')). Otherwise return None""" | returns (b'abc', (b'def', b'ghi')). Otherwise return None""" | ||||
if text[-1:] == b')': | if text[-1:] == b')': | ||||
marker = b' (DEFAULT: ' | marker = b' (DEFAULT: ' | ||||
pos = text.find(marker) | pos = text.find(marker) | ||||
if pos >= 0: | if pos >= 0: | ||||
item = text[pos + len(marker):-1] | item = text[pos + len(marker) : -1] | ||||
return text[:pos], item.split(b'.', 2) | return text[:pos], item.split(b'.', 2) | ||||
def optrst(header, options, verbose, ui): | def optrst(header, options, verbose, ui): | ||||
data = [] | data = [] | ||||
multioccur = False | multioccur = False | ||||
for option in options: | for option in options: | ||||
if len(option) == 5: | if len(option) == 5: | ||||
shortopt, longopt, default, desc, optlabel = option | shortopt, longopt, default, desc, optlabel = option | ||||
else: | else: | ||||
shortopt, longopt, default, desc = option | shortopt, longopt, default, desc = option | ||||
pass | pass | ||||
# options | # options | ||||
if not ui.quiet and entry[1]: | if not ui.quiet and entry[1]: | ||||
rst.append(optrst(_(b"options"), entry[1], ui.verbose, ui)) | rst.append(optrst(_(b"options"), entry[1], ui.verbose, ui)) | ||||
if ui.verbose: | if ui.verbose: | ||||
rst.append( | rst.append( | ||||
optrst(_(b"global options"), commands.globalopts, ui.verbose, ui) | optrst( | ||||
_(b"global options"), commands.globalopts, ui.verbose, ui | |||||
) | |||||
) | ) | ||||
if not ui.verbose: | if not ui.verbose: | ||||
if not full: | if not full: | ||||
rst.append(_(b"\n(use 'hg %s -h' to show more help)\n") % name) | rst.append(_(b"\n(use 'hg %s -h' to show more help)\n") % name) | ||||
elif not ui.quiet: | elif not ui.quiet: | ||||
rst.append( | rst.append( | ||||
_( | _( | ||||
for t, desc in topics: | for t, desc in topics: | ||||
rst.append(b" :%s: %s\n" % (t, desc)) | rst.append(b" :%s: %s\n" % (t, desc)) | ||||
if ui.quiet: | if ui.quiet: | ||||
pass | pass | ||||
elif ui.verbose: | elif ui.verbose: | ||||
rst.append( | rst.append( | ||||
b'\n%s\n' | b'\n%s\n' | ||||
% optrst(_(b"global options"), commands.globalopts, ui.verbose, ui) | % optrst( | ||||
_(b"global options"), commands.globalopts, ui.verbose, ui | |||||
) | |||||
) | ) | ||||
if name == b'shortlist': | if name == b'shortlist': | ||||
rst.append( | rst.append( | ||||
_(b"\n(use 'hg help' for the full list of commands)\n") | _(b"\n(use 'hg help' for the full list of commands)\n") | ||||
) | ) | ||||
else: | else: | ||||
if name == b'shortlist': | if name == b'shortlist': | ||||
rst.append( | rst.append( |
# create a fixed file to link to; doesn't matter if it | # create a fixed file to link to; doesn't matter if it | ||||
# already exists. | # already exists. | ||||
target = b'checklink-target' | target = b'checklink-target' | ||||
try: | try: | ||||
fullpath = os.path.join(cachedir, target) | fullpath = os.path.join(cachedir, target) | ||||
open(fullpath, b'w').close() | open(fullpath, b'w').close() | ||||
except IOError as inst: | except IOError as inst: | ||||
if ( | if ( | ||||
inst[0] # pytype: disable=unsupported-operands | inst[0] == errno.EACCES | ||||
== errno.EACCES | ): # pytype: disable=unsupported-operands | ||||
): | |||||
# If we can't write to cachedir, just pretend | # If we can't write to cachedir, just pretend | ||||
# that the fs is readonly and by association | # that the fs is readonly and by association | ||||
# that the fs won't support symlinks. This | # that the fs won't support symlinks. This | ||||
# seems like the least dangerous way to avoid | # seems like the least dangerous way to avoid | ||||
# data loss. | # data loss. | ||||
return False | return False | ||||
raise | raise | ||||
try: | try: |
# file. This offset is also adjusted when new entries are calculated | # file. This offset is also adjusted when new entries are calculated | ||||
# for array members. | # for array members. | ||||
cllen = len(repo.changelog) | cllen = len(repo.changelog) | ||||
wantedlen = cllen * _fnodesrecsize | wantedlen = cllen * _fnodesrecsize | ||||
rawlen = len(self._raw) | rawlen = len(self._raw) | ||||
self._dirtyoffset = None | self._dirtyoffset = None | ||||
rawlentokeep = min(wantedlen, (rawlen / _fnodesrecsize) * _fnodesrecsize) | rawlentokeep = min( | ||||
wantedlen, (rawlen / _fnodesrecsize) * _fnodesrecsize | |||||
) | |||||
if rawlen > rawlentokeep: | if rawlen > rawlentokeep: | ||||
# There's no easy way to truncate array instances. This seems | # There's no easy way to truncate array instances. This seems | ||||
# slightly less evil than copying a potentially large array slice. | # slightly less evil than copying a potentially large array slice. | ||||
for i in range(rawlen - rawlentokeep): | for i in range(rawlen - rawlentokeep): | ||||
self._raw.pop() | self._raw.pop() | ||||
rawlen = len(self._raw) | rawlen = len(self._raw) | ||||
self._dirtyoffset = rawlen | self._dirtyoffset = rawlen | ||||
if rawlen < wantedlen: | if rawlen < wantedlen: |