##// END OF EJS Templates
bundle1: fix bundle1-denied reporting for push over ssh...
bundle1: fix bundle1-denied reporting for push over ssh Changeset b288fb2724bf introduced a config option to have the server deny push using bundle1. The original protocol has not really be design to allow such kind of error reporting so some hack was used. It turned the hack only works on HTTP and that ssh wire peer hangs forever when the same hack is used. After further digging, there is no way to report the error in a unified way. Using 'ooberror' freeze ssh and raising 'Abort' makes HTTP return a HTTP500 without further details. So with sadness we implement a version that dispatch according to the protocol used. We also add a test for pushing over ssh to make sure we won't regress in the future. That test show that the hint is missing, this is another bug fixed in the next changeset.

File last commit:

r30576:541949a1 default
r30909:d554e624 stable
Show More
simplemerge
67 lines | 2.1 KiB | text/plain | TextLexer
Alexis S. L. Carvalho
actually port simplemerge to hg...
r4363 #!/usr/bin/env python
Alexis S. L. Carvalho
Import 3-way merge code from bzr...
r4362
Alexis S. L. Carvalho
polish the simplemerge command; add a test
r4364 from mercurial import demandimport
demandimport.enable()
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
Alexis S. L. Carvalho
actually port simplemerge to hg...
r4363 from mercurial.i18n import _
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 from mercurial import error, simplemerge, fancyopts, util, ui
Alexis S. L. Carvalho
Import 3-way merge code from bzr...
r4362
Alexis S. L. Carvalho
polish the simplemerge command; add a test
r4364 options = [('L', 'label', [], _('labels to use on conflict markers')),
('a', 'text', None, _('treat all files as text')),
('p', 'print', None,
_('print results instead of overwriting LOCAL')),
Pierre-Yves David
simplemerge: burn "minimal" feature to the ground...
r22023 ('', 'no-minimal', None, _('no effect (DEPRECATED)')),
Alexis S. L. Carvalho
polish the simplemerge command; add a test
r4364 ('h', 'help', None, _('display help and exit')),
('q', 'quiet', None, _('suppress output'))]
usage = _('''simplemerge [OPTS] LOCAL BASE OTHER
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():
sys.stdout.write(usage)
sys.stdout.write('\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:
out_opts.append(('%2s%s' % (shortopt and '-%s' % shortopt,
longopt and ' --%s' % longopt),
'%s' % desc))
opts_len = max([len(opt[0]) for opt in out_opts])
for first, second in out_opts:
sys.stdout.write(' %-*s %s\n' % (opts_len, first, second))
Matt Mackall
merge: move the bulk of simplemerge into core...
r6002 try:
Patrick Mezard
tests: Windows compatibility fixes...
r7080 for fp in (sys.stdin, sys.stdout, sys.stderr):
Adrian Buehlmann
rename util.set_binary to setbinary
r14233 util.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:
Matt Mackall
merge: move the bulk of simplemerge into core...
r6002 args = fancyopts.fancyopts(sys.argv[1:], 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)
if opts['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:
raise ParseError(_('wrong number of arguments'))
Yuya Nishihara
ui: factor out ui.load() to create a ui without loading configs (API)...
r30559 sys.exit(simplemerge.simplemerge(ui.ui.load(), *args, **opts))
FUJIWARA Katsunori
misc: use modern exception syntax...
r28047 except ParseError as e:
Matt Mackall
merge: move the bulk of simplemerge into core...
r6002 sys.stdout.write("%s: %s\n" % (sys.argv[0], e))
showhelp()
sys.exit(1)
FUJIWARA Katsunori
misc: use modern exception syntax...
r28047 except error.Abort as e:
Matt Mackall
merge: move the bulk of simplemerge into core...
r6002 sys.stderr.write("abort: %s\n" % e)
sys.exit(255)
except KeyboardInterrupt:
sys.exit(255)