Mercurial > hg
view mercurial/diffutil.py @ 39270:37e56607cbb9
lfs: add a progress bar when searching for blobs to upload
The search itself can take an extreme amount of time if there are a lot of
revisions involved. I've got a local repo that took 6 minutes to push 1850
commits, and 60% of that time was spent here (there are ~70K files):
\ 58.1% wrapper.py: extractpointers line 297: pointers = extractpointers(...
| 57.7% wrapper.py: pointersfromctx line 352: for p in pointersfromctx(ct...
| 57.4% wrapper.py: pointerfromctx line 397: p = pointerfromctx(ctx, f, ...
\ 38.7% context.py: __contains__ line 368: if f not in ctx:
| 38.7% util.py: __get__ line 82: return key in self._manifest
| 38.7% context.py: _manifest line 1416: result = self.func(obj)
| 38.7% manifest.py: read line 472: return self._manifestctx.re...
\ 25.6% revlog.py: revision line 1562: text = rl.revision(self._node)
\ 12.8% revlog.py: _chunks line 2217: bins = self._chunks(chain, ...
| 12.0% revlog.py: decompressline 2112: ladd(decomp(buffer(data, ch...
\ 7.8% revlog.py: checkhash line 2232: self.checkhash(text, node, ...
| 7.8% revlog.py: hash line 2315: if node != self.hash(text, ...
| 7.8% revlog.py: hash line 2242: return hash(text, p1, p2)
\ 12.0% manifest.py: __init__ line 1565: self._data = manifestdict(t...
\ 16.8% context.py: filenode line 378: if not _islfs(fctx.filelog(...
| 15.7% util.py: __get__ line 706: return self._filelog
| 14.8% context.py: _filelog line 1416: result = self.func(obj)
| 14.8% localrepo.py: file line 629: return self._repo.file(self...
| 14.8% filelog.py: __init__ line 1134: return filelog.filelog(self...
| 14.5% revlog.py: __init__ line 24: censorable=True)
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 24 Aug 2018 17:45:46 -0400 |
parents | be441eb65f09 |
children | 78b270a55dc6 |
line wrap: on
line source
# diffutil.py - utility functions related to diff and patch # # Copyright 2006 Brendan Cully <brendan@kublai.com> # Copyright 2007 Chris Mason <chris.mason@oracle.com> # Copyright 2018 Octobus <octobus@octobus.net> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. from __future__ import absolute_import from .i18n import _ from . import ( mdiff, pycompat, ) def diffallopts(ui, opts=None, untrusted=False, section='diff'): '''return diffopts with all features supported and parsed''' return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section, git=True, whitespace=True, formatchanging=True) def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False, whitespace=False, formatchanging=False): '''return diffopts with only opted-in features parsed Features: - git: git-style diffs - whitespace: whitespace options like ignoreblanklines and ignorews - formatchanging: options that will likely break or cause correctness issues with most diff parsers ''' def get(key, name=None, getter=ui.configbool, forceplain=None): if opts: v = opts.get(key) # diffopts flags are either None-default (which is passed # through unchanged, so we can identify unset values), or # some other falsey default (eg --unified, which defaults # to an empty string). We only want to override the config # entries from hgrc with command line values if they # appear to have been set, which is any truthy value, # True, or False. if v or isinstance(v, bool): return v if forceplain is not None and ui.plain(): return forceplain return getter(section, name or key, untrusted=untrusted) # core options, expected to be understood by every diff parser buildopts = { 'nodates': get('nodates'), 'showfunc': get('show_function', 'showfunc'), 'context': get('unified', getter=ui.config), } buildopts['xdiff'] = ui.configbool('experimental', 'xdiff') if git: buildopts['git'] = get('git') # since this is in the experimental section, we need to call # ui.configbool directory buildopts['showsimilarity'] = ui.configbool('experimental', 'extendedheader.similarity') # need to inspect the ui object instead of using get() since we want to # test for an int hconf = ui.config('experimental', 'extendedheader.index') if hconf is not None: hlen = None try: # the hash config could be an integer (for length of hash) or a # word (e.g. short, full, none) hlen = int(hconf) if hlen < 0 or hlen > 40: msg = _("invalid length for extendedheader.index: '%d'\n") ui.warn(msg % hlen) except ValueError: # default value if hconf == 'short' or hconf == '': hlen = 12 elif hconf == 'full': hlen = 40 elif hconf != 'none': msg = _("invalid value for extendedheader.index: '%s'\n") ui.warn(msg % hconf) finally: buildopts['index'] = hlen if whitespace: buildopts['ignorews'] = get('ignore_all_space', 'ignorews') buildopts['ignorewsamount'] = get('ignore_space_change', 'ignorewsamount') buildopts['ignoreblanklines'] = get('ignore_blank_lines', 'ignoreblanklines') buildopts['ignorewseol'] = get('ignore_space_at_eol', 'ignorewseol') if formatchanging: buildopts['text'] = opts and opts.get('text') binary = None if opts is None else opts.get('binary') buildopts['nobinary'] = (not binary if binary is not None else get('nobinary', forceplain=False)) buildopts['noprefix'] = get('noprefix', forceplain=False) buildopts['worddiff'] = get('word_diff', 'word-diff', forceplain=False) return mdiff.diffopts(**pycompat.strkwargs(buildopts))