##// END OF EJS Templates
sidedatacopies: only fetch information once for merge...
sidedatacopies: only fetch information once for merge Before this change, merge would result in reading the data from revlog twice. With this change, we keep the information in memory until we encounter the other parent. When looking at pypy, I see about 1/3 of the changesets with copy information being merge. Not doing duplicated fetch for them provide a significant speedup. revision: large amount; added files: large amount; rename small amount; c3b14617fbd7 9ba6ab77fd29 before: ! wall 0.767042 comb 0.760000 user 0.750000 sys 0.010000 (median of 11) after: ! wall 0.671162 comb 0.670000 user 0.650000 sys 0.020000 (median of 13) revision: large amount; added files: small amount; rename small amount; c3b14617fbd7 f650a9b140d2 before: ! wall 1.170169 comb 1.170000 user 1.130000 sys 0.040000 (median of 10) after: ! wall 1.030596 comb 1.040000 user 1.010000 sys 0.030000 (median of 10) revision: large amount; added files: large amount; rename large amount; 08ea3258278e d9fa043f30c0 before: ! wall 0.209846 comb 0.200000 user 0.200000 sys 0.000000 (median of 46) after: ! wall 0.170981 comb 0.170000 user 0.170000 sys 0.000000 (median of 56) revision: small amount; added files: large amount; rename large amount; df6f7a526b60 a83dc6a2d56f before: ! wall 0.013248 comb 0.010000 user 0.010000 sys 0.000000 (median of 223) after: ! wall 0.013295 comb 0.020000 user 0.020000 sys 0.000000 (median of 222) revision: small amount; added files: large amount; rename small amount; 4aa4e1f8e19a 169138063d63 before: ! wall 0.001672 comb 0.000000 user 0.000000 sys 0.000000 (median of 1000) after: ! wall 0.001666 comb 0.000000 user 0.000000 sys 0.000000 (median of 1000) revision: small amount; added files: small amount; rename small amount; 4bc173b045a6 964879152e2e before: ! wall 0.000119 comb 0.000000 user 0.000000 sys 0.000000 (median of 8010) after: ! wall 0.000119 comb 0.000000 user 0.000000 sys 0.000000 (median of 8007) revision: medium amount; added files: large amount; rename medium amount; c95f1ced15f2 2c68e87c3efe before: ! wall 0.168599 comb 0.160000 user 0.160000 sys 0.000000 (median of 58) after: ! wall 0.133316 comb 0.140000 user 0.140000 sys 0.000000 (median of 73) revision: medium amount; added files: medium amount; rename small amount; d343da0c55a8 d7746d32bf9d before: ! wall 0.036052 comb 0.030000 user 0.030000 sys 0.000000 (median of 100) after: ! wall 0.032558 comb 0.030000 user 0.030000 sys 0.000000 (median of 100) Differential Revision: https://phab.mercurial-scm.org/D7127

File last commit:

r40301:d6b7c4e7 default
r43595:90213d02 default
Show More
simplemerge
87 lines | 2.7 KiB | text/plain | TextLexer
Alexis S. L. Carvalho
actually port simplemerge to hg...
r4363 #!/usr/bin/env python
Augie Fackler
simplemerge: update to conform with modern import conventions
r33896 from __future__ import absolute_import
Alexis S. L. Carvalho
Import 3-way merge code from bzr...
r4362
Pulkit Goyal
fancyopts: switch from fancyopts.getopt.* to getopt.*...
r30576 import getopt
Simon Heimberg
cleanup: drop unused variables and an unused import
r19378 import sys
Augie Fackler
simplemerge: update to conform with modern import conventions
r33896
import hgdemandimport
hgdemandimport.enable()
Alexis S. L. Carvalho
actually port simplemerge to hg...
r4363 from mercurial.i18n import _
Augie Fackler
simplemerge: update to conform with modern import conventions
r33896 from mercurial import (
Phil Cohen
context: add arbitraryfilectx, which can represent files outside the workdir...
r34053 context,
Augie Fackler
simplemerge: update to conform with modern import conventions
r33896 error,
fancyopts,
Pulkit Goyal
py3: use pycompat.strkwargs() in contrib/simplemerge...
r39827 pycompat,
Augie Fackler
simplemerge: update to conform with modern import conventions
r33896 simplemerge,
ui as uimod,
Yuya Nishihara
procutil: bulk-replace function calls to point to new module
r37138 )
from mercurial.utils import (
procutil,
Augie Fackler
simplemerge: update to conform with modern import conventions
r33896 )
Alexis S. L. Carvalho
Import 3-way merge code from bzr...
r4362
Pulkit Goyal
py3: add b'' prefixes in contrib/simplemerge...
r39826 options = [(b'L', b'label', [], _(b'labels to use on conflict markers')),
(b'a', b'text', None, _(b'treat all files as text')),
(b'p', b'print', None,
_(b'print results instead of overwriting LOCAL')),
(b'', b'no-minimal', None, _(b'no effect (DEPRECATED)')),
(b'h', b'help', None, _(b'display help and exit')),
(b'q', b'quiet', None, _(b'suppress output'))]
Alexis S. L. Carvalho
polish the simplemerge command; add a test
r4364
Yuya Nishihara
py3: convert "usage" literal to bytes...
r40301 usage = _(b'''simplemerge [OPTS] LOCAL BASE OTHER
Alexis S. L. Carvalho
polish the simplemerge command; add a test
r4364
Simple three-way file merge utility with a minimal feature set.
Thomas Arendsen Hein
Remove trailing spaces
r5081
Alexis S. L. Carvalho
polish the simplemerge command; add a test
r4364 Apply to LOCAL the changes necessary to go from BASE to OTHER.
Thomas Arendsen Hein
Remove trailing spaces
r5081
Alexis S. L. Carvalho
polish the simplemerge command; add a test
r4364 By default, LOCAL is overwritten with the results of this operation.
''')
Matt Mackall
merge: move the bulk of simplemerge into core...
r6002 class ParseError(Exception):
"""Exception raised on errors in parsing the command line."""
Alexis S. L. Carvalho
polish the simplemerge command; add a test
r4364 def showhelp():
Yuya Nishihara
py3: convert "usage" literal to bytes...
r40301 pycompat.stdout.write(usage)
Augie Fackler
simplemerge: port to Python 3...
r40296 pycompat.stdout.write(b'\noptions:\n')
Alexis S. L. Carvalho
Import 3-way merge code from bzr...
r4362
Alexis S. L. Carvalho
polish the simplemerge command; add a test
r4364 out_opts = []
for shortopt, longopt, default, desc in options:
Pulkit Goyal
py3: add b'' prefixes in contrib/simplemerge...
r39826 out_opts.append((b'%2s%s' % (shortopt and b'-%s' % shortopt,
longopt and b' --%s' % longopt),
b'%s' % desc))
Alexis S. L. Carvalho
polish the simplemerge command; add a test
r4364 opts_len = max([len(opt[0]) for opt in out_opts])
for first, second in out_opts:
Augie Fackler
simplemerge: port to Python 3...
r40296 pycompat.stdout.write(b' %-*s %s\n' % (opts_len, first, second))
Alexis S. L. Carvalho
polish the simplemerge command; add a test
r4364
Matt Mackall
merge: move the bulk of simplemerge into core...
r6002 try:
Augie Fackler
simplemerge: port to Python 3...
r40296 for fp in (sys.stdin, pycompat.stdout, sys.stderr):
Yuya Nishihara
procutil: bulk-replace function calls to point to new module
r37138 procutil.setbinary(fp)
Mads Kiilerich
tests: run check-code on Python files without .py extension
r19022
Matt Mackall
merge: move the bulk of simplemerge into core...
r6002 opts = {}
Alexis S. L. Carvalho
polish the simplemerge command; add a test
r4364 try:
Augie Fackler
simplemerge: port to Python 3...
r40296 bargv = [a.encode('utf8') for a in sys.argv[1:]]
args = fancyopts.fancyopts(bargv, options, opts)
Pulkit Goyal
fancyopts: switch from fancyopts.getopt.* to getopt.*...
r30576 except getopt.GetoptError as e:
Matt Mackall
merge: move the bulk of simplemerge into core...
r6002 raise ParseError(e)
Pulkit Goyal
py3: add b'' prefixes in contrib/simplemerge...
r39826 if opts[b'help']:
Alexis S. L. Carvalho
polish the simplemerge command; add a test
r4364 showhelp()
Matt Mackall
merge: move the bulk of simplemerge into core...
r6002 sys.exit(0)
if len(args) != 3:
Augie Fackler
simplemerge: port to Python 3...
r40296 raise ParseError(_(b'wrong number of arguments').decode('utf8'))
Phil Cohen
contrib: make simplemerge script pass context-like objects...
r33904 local, base, other = args
sys.exit(simplemerge.simplemerge(uimod.ui.load(),
Phil Cohen
context: add arbitraryfilectx, which can represent files outside the workdir...
r34053 context.arbitraryfilectx(local),
context.arbitraryfilectx(base),
context.arbitraryfilectx(other),
Pulkit Goyal
py3: use pycompat.strkwargs() in contrib/simplemerge...
r39827 **pycompat.strkwargs(opts)))
FUJIWARA Katsunori
misc: use modern exception syntax...
r28047 except ParseError as e:
Augie Fackler
simplemerge: port to Python 3...
r40296 if pycompat.ispy3:
e = str(e).encode('utf8')
pycompat.stdout.write(b"%s: %s\n" % (sys.argv[0].encode('utf8'), e))
Matt Mackall
merge: move the bulk of simplemerge into core...
r6002 showhelp()
sys.exit(1)
FUJIWARA Katsunori
misc: use modern exception syntax...
r28047 except error.Abort as e:
Augie Fackler
simplemerge: port to Python 3...
r40296 pycompat.stderr.write(b"abort: %s\n" % e)
Matt Mackall
merge: move the bulk of simplemerge into core...
r6002 sys.exit(255)
except KeyboardInterrupt:
sys.exit(255)