mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 23:38:50 +03:00
i18n: merge with main
This commit is contained in:
commit
9c81f22e34
@ -144,8 +144,11 @@ def _terminfosetup(ui, mode):
|
||||
ui.debug("no terminfo entry for %s\n" % e)
|
||||
del _terminfo_params[key]
|
||||
if not curses.tigetstr('setaf') or not curses.tigetstr('setab'):
|
||||
ui.warn(_("no terminfo entry for setab/setaf: reverting to "
|
||||
"ECMA-48 color\n"))
|
||||
# Only warn about missing terminfo entries if we explicitly asked for
|
||||
# terminfo mode.
|
||||
if mode == "terminfo":
|
||||
ui.warn(_("no terminfo entry for setab/setaf: reverting to "
|
||||
"ECMA-48 color\n"))
|
||||
_terminfo_params = {}
|
||||
|
||||
def _modesetup(ui, opts):
|
||||
|
@ -4184,17 +4184,22 @@ def revert(ui, repo, *pats, **opts):
|
||||
|
||||
if not pats and not opts.get('all'):
|
||||
msg = _("no files or directories specified")
|
||||
hint = _("use --all to discard all changes")
|
||||
if p2 != nullid:
|
||||
hint = _("uncommitted merge, use --all to discard all changes,"
|
||||
" or 'hg update -C .' to abort the merge")
|
||||
elif node != parent:
|
||||
if util.any(repo.status()):
|
||||
raise util.Abort(msg, hint=hint)
|
||||
dirty = util.any(repo.status())
|
||||
if node != parent:
|
||||
if dirty:
|
||||
hint = _("uncommitted changes, use --all to discard all"
|
||||
" changes, or 'hg update %s' to update") % ctx.rev()
|
||||
else:
|
||||
hint = _("use --all to revert all files,"
|
||||
" or 'hg update %s' to update") % ctx.rev()
|
||||
elif dirty:
|
||||
hint = _("uncommitted changes, use --all to discard all changes")
|
||||
else:
|
||||
hint = _("use --all to revert all files")
|
||||
raise util.Abort(msg, hint=hint)
|
||||
|
||||
mf = ctx.manifest()
|
||||
|
@ -143,6 +143,7 @@ class server(object):
|
||||
logfile = open(logpath, 'a')
|
||||
|
||||
self.repo = repo
|
||||
self.repoui = repo.ui
|
||||
|
||||
if mode == 'pipe':
|
||||
self.cerr = channeledoutput(sys.stderr, sys.stdout, 'e')
|
||||
@ -176,8 +177,13 @@ class server(object):
|
||||
else:
|
||||
args = self._read(length).split('\0')
|
||||
|
||||
# copy the ui so changes to it don't persist between requests
|
||||
req = dispatch.request(args, self.ui.copy(), self.repo, self.cin,
|
||||
# copy the uis so changes (e.g. --config or --verbose) don't
|
||||
# persist between requests
|
||||
copiedui = self.ui.copy()
|
||||
self.repo.baseui = copiedui
|
||||
self.repo.ui = self.repo.dirstate._ui = self.repoui.copy()
|
||||
|
||||
req = dispatch.request(args, copiedui, self.repo, self.cin,
|
||||
self.cout, self.cerr)
|
||||
|
||||
ret = dispatch.dispatch(req) or 0 # might return None
|
||||
|
@ -398,6 +398,8 @@ def _parse(ui, args):
|
||||
|
||||
def _parseconfig(ui, config):
|
||||
"""parse the --config options from the command line"""
|
||||
configs = []
|
||||
|
||||
for cfg in config:
|
||||
try:
|
||||
name, value = cfg.split('=', 1)
|
||||
@ -405,10 +407,13 @@ def _parseconfig(ui, config):
|
||||
if not section or not name:
|
||||
raise IndexError
|
||||
ui.setconfig(section, name, value)
|
||||
configs.append((section, name, value))
|
||||
except (IndexError, ValueError):
|
||||
raise util.Abort(_('malformed --config option: %r '
|
||||
'(use --config section.name=value)') % cfg)
|
||||
|
||||
return configs
|
||||
|
||||
def _earlygetopt(aliases, args):
|
||||
"""Return list of values for an option (or aliases).
|
||||
|
||||
@ -525,7 +530,7 @@ def _dispatch(req):
|
||||
|
||||
# read --config before doing anything else
|
||||
# (e.g. to change trust settings for reading .hg/hgrc)
|
||||
_parseconfig(ui, _earlygetopt(['--config'], args))
|
||||
cfgs = _parseconfig(ui, _earlygetopt(['--config'], args))
|
||||
|
||||
# check for cwd
|
||||
cwd = _earlygetopt(['--cwd'], args)
|
||||
@ -592,20 +597,27 @@ def _dispatch(req):
|
||||
(t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
|
||||
atexit.register(print_time)
|
||||
|
||||
if options['verbose'] or options['debug'] or options['quiet']:
|
||||
for ui_ in (ui, lui):
|
||||
ui_.setconfig('ui', 'verbose', str(bool(options['verbose'])))
|
||||
ui_.setconfig('ui', 'debug', str(bool(options['debug'])))
|
||||
ui_.setconfig('ui', 'quiet', str(bool(options['quiet'])))
|
||||
if options['traceback']:
|
||||
for ui_ in (ui, lui):
|
||||
ui_.setconfig('ui', 'traceback', 'on')
|
||||
uis = set([ui, lui])
|
||||
|
||||
if req.repo:
|
||||
uis.add(req.repo.ui)
|
||||
|
||||
# copy configs that were passed on the cmdline (--config) to the repo ui
|
||||
for cfg in cfgs:
|
||||
req.repo.ui.setconfig(*cfg)
|
||||
|
||||
for opt in ('verbose', 'debug', 'quiet', 'traceback'):
|
||||
val = bool(options[opt])
|
||||
if val:
|
||||
for ui_ in uis:
|
||||
ui_.setconfig('ui', opt, str(val))
|
||||
|
||||
if options['noninteractive']:
|
||||
for ui_ in (ui, lui):
|
||||
for ui_ in uis:
|
||||
ui_.setconfig('ui', 'interactive', 'off')
|
||||
|
||||
if cmdoptions.get('insecure', False):
|
||||
for ui_ in (ui, lui):
|
||||
for ui_ in uis:
|
||||
ui_.setconfig('web', 'cacerts', '')
|
||||
|
||||
if options['help']:
|
||||
|
@ -233,7 +233,8 @@ def filemerge(repo, mynode, orig, fcd, fco, fca):
|
||||
replace = dict(local=a, base=b, other=c, output=out)
|
||||
args = util.interpolate(r'\$', replace, args,
|
||||
lambda s: '"%s"' % util.localpath(s))
|
||||
r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env)
|
||||
r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env,
|
||||
out=ui.fout)
|
||||
|
||||
if not r and (_toolbool(ui, tool, "checkconflicts") or
|
||||
'conflicts' in _toollist(ui, tool, "check")):
|
||||
|
@ -1773,7 +1773,7 @@ class localrepository(repo.repository):
|
||||
|
||||
# process the files
|
||||
self.ui.status(_("adding file changes\n"))
|
||||
pr.step = 'files'
|
||||
pr.step = _('files')
|
||||
pr.count = 1
|
||||
pr.total = efiles
|
||||
source.callback = None
|
||||
|
27
tests/hgterm.ti
Normal file
27
tests/hgterm.ti
Normal file
@ -0,0 +1,27 @@
|
||||
hgterm,
|
||||
am, km, mir, msgr, xenl,
|
||||
colors#8, cols#80, it#8, lines#24, pairs#64,
|
||||
acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
|
||||
bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=\r,
|
||||
csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\b,
|
||||
cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C,
|
||||
cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
|
||||
dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M,
|
||||
ed=\E[J, el=\E[K, enacs=\E)0, home=\E[H, ht=\t,
|
||||
hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=\n,
|
||||
is2=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8, kbs=\b,
|
||||
kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
|
||||
kdch1=\E[3~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~,
|
||||
kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~,
|
||||
kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~,
|
||||
kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~,
|
||||
kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~,
|
||||
kf9=\E[20~, kfnd=\E[1~, kich1=\E[2~, kmous=\E[M,
|
||||
knp=\E[6~, kpp=\E[5~, kslt=\E[4~, op=\E[m, rc=\E8,
|
||||
rev=\E[7m, ri=\EM, rmacs=^O, rmcup=\E[2J\E[?47l\E8,
|
||||
rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m,
|
||||
rs2=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8, sc=\E7,
|
||||
setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[m,
|
||||
smacs=^N, smcup=\E7\E[?47h, smir=\E[4h,
|
||||
smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g,
|
||||
u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c,
|
@ -54,6 +54,12 @@ issue1829: wrong indentation
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
$ unset FAKEPATH
|
||||
|
||||
make sure unspecified global ui options don't override old values
|
||||
|
||||
$ hg showconfig --config ui.verbose=True --quiet
|
||||
ui.verbose=True
|
||||
ui.quiet=True
|
||||
|
||||
username expansion
|
||||
|
||||
$ olduser=$HGUSER
|
||||
@ -134,9 +140,7 @@ plain hgrc
|
||||
$ hg showconfig --config ui.traceback=True --debug
|
||||
read config from: $TESTTMP/hgrc
|
||||
none: ui.traceback=True
|
||||
none: ui.verbose=False
|
||||
none: ui.debug=True
|
||||
none: ui.quiet=False
|
||||
|
||||
plain mode with exceptions
|
||||
|
||||
@ -152,24 +156,18 @@ plain mode with exceptions
|
||||
read config from: $TESTTMP/hgrc
|
||||
$TESTTMP/hgrc:15: extensions.plain=./plain.py
|
||||
none: ui.traceback=True
|
||||
none: ui.verbose=False
|
||||
none: ui.debug=True
|
||||
none: ui.quiet=False
|
||||
$ unset HGPLAIN
|
||||
$ hg showconfig --config ui.traceback=True --debug
|
||||
plain: True
|
||||
read config from: $TESTTMP/hgrc
|
||||
$TESTTMP/hgrc:15: extensions.plain=./plain.py
|
||||
none: ui.traceback=True
|
||||
none: ui.verbose=False
|
||||
none: ui.debug=True
|
||||
none: ui.quiet=False
|
||||
$ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT
|
||||
$ hg showconfig --config ui.traceback=True --debug
|
||||
plain: True
|
||||
read config from: $TESTTMP/hgrc
|
||||
$TESTTMP/hgrc:15: extensions.plain=./plain.py
|
||||
none: ui.traceback=True
|
||||
none: ui.verbose=False
|
||||
none: ui.debug=True
|
||||
none: ui.quiet=False
|
||||
|
@ -10,7 +10,7 @@ nothing changed
|
||||
|
||||
$ hg revert
|
||||
abort: no files or directories specified
|
||||
(use --all to discard all changes)
|
||||
(use --all to revert all files)
|
||||
[255]
|
||||
|
||||
$ echo 123 > b
|
||||
|
@ -167,7 +167,9 @@ hg status -A:
|
||||
|
||||
hg status -A (with terminfo color):
|
||||
|
||||
$ TERM=xterm hg status --config color.mode=terminfo --color=always -A
|
||||
$ mkdir $TESTTMP/terminfo
|
||||
$ TERMINFO=$TESTTMP/terminfo tic $TESTDIR/hgterm.ti
|
||||
$ TERM=hgterm TERMINFO=$TESTTMP/terminfo hg status --config color.mode=terminfo --color=always -A
|
||||
\x1b[30m\x1b[32m\x1b[1mA added\x1b[30m (esc)
|
||||
\x1b[30m\x1b[32m\x1b[1mA copied\x1b[30m (esc)
|
||||
\x1b[30m\x1b[30m modified\x1b[30m (esc)
|
||||
|
Loading…
Reference in New Issue
Block a user