i18n: merge with main

This commit is contained in:
Martin Geisler 2011-06-28 09:42:45 +02:00
commit 9c81f22e34
10 changed files with 84 additions and 30 deletions

View File

@ -144,8 +144,11 @@ def _terminfosetup(ui, mode):
ui.debug("no terminfo entry for %s\n" % e) ui.debug("no terminfo entry for %s\n" % e)
del _terminfo_params[key] del _terminfo_params[key]
if not curses.tigetstr('setaf') or not curses.tigetstr('setab'): if not curses.tigetstr('setaf') or not curses.tigetstr('setab'):
ui.warn(_("no terminfo entry for setab/setaf: reverting to " # Only warn about missing terminfo entries if we explicitly asked for
"ECMA-48 color\n")) # terminfo mode.
if mode == "terminfo":
ui.warn(_("no terminfo entry for setab/setaf: reverting to "
"ECMA-48 color\n"))
_terminfo_params = {} _terminfo_params = {}
def _modesetup(ui, opts): def _modesetup(ui, opts):

View File

@ -4184,17 +4184,22 @@ def revert(ui, repo, *pats, **opts):
if not pats and not opts.get('all'): if not pats and not opts.get('all'):
msg = _("no files or directories specified") msg = _("no files or directories specified")
hint = _("use --all to discard all changes")
if p2 != nullid: if p2 != nullid:
hint = _("uncommitted merge, use --all to discard all changes," hint = _("uncommitted merge, use --all to discard all changes,"
" or 'hg update -C .' to abort the merge") " or 'hg update -C .' to abort the merge")
elif node != parent: raise util.Abort(msg, hint=hint)
if util.any(repo.status()): dirty = util.any(repo.status())
if node != parent:
if dirty:
hint = _("uncommitted changes, use --all to discard all" hint = _("uncommitted changes, use --all to discard all"
" changes, or 'hg update %s' to update") % ctx.rev() " changes, or 'hg update %s' to update") % ctx.rev()
else: else:
hint = _("use --all to revert all files," hint = _("use --all to revert all files,"
" or 'hg update %s' to update") % ctx.rev() " 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) raise util.Abort(msg, hint=hint)
mf = ctx.manifest() mf = ctx.manifest()

View File

@ -143,6 +143,7 @@ class server(object):
logfile = open(logpath, 'a') logfile = open(logpath, 'a')
self.repo = repo self.repo = repo
self.repoui = repo.ui
if mode == 'pipe': if mode == 'pipe':
self.cerr = channeledoutput(sys.stderr, sys.stdout, 'e') self.cerr = channeledoutput(sys.stderr, sys.stdout, 'e')
@ -176,8 +177,13 @@ class server(object):
else: else:
args = self._read(length).split('\0') args = self._read(length).split('\0')
# copy the ui so changes to it don't persist between requests # copy the uis so changes (e.g. --config or --verbose) don't
req = dispatch.request(args, self.ui.copy(), self.repo, self.cin, # 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) self.cout, self.cerr)
ret = dispatch.dispatch(req) or 0 # might return None ret = dispatch.dispatch(req) or 0 # might return None

View File

@ -398,6 +398,8 @@ def _parse(ui, args):
def _parseconfig(ui, config): def _parseconfig(ui, config):
"""parse the --config options from the command line""" """parse the --config options from the command line"""
configs = []
for cfg in config: for cfg in config:
try: try:
name, value = cfg.split('=', 1) name, value = cfg.split('=', 1)
@ -405,10 +407,13 @@ def _parseconfig(ui, config):
if not section or not name: if not section or not name:
raise IndexError raise IndexError
ui.setconfig(section, name, value) ui.setconfig(section, name, value)
configs.append((section, name, value))
except (IndexError, ValueError): except (IndexError, ValueError):
raise util.Abort(_('malformed --config option: %r ' raise util.Abort(_('malformed --config option: %r '
'(use --config section.name=value)') % cfg) '(use --config section.name=value)') % cfg)
return configs
def _earlygetopt(aliases, args): def _earlygetopt(aliases, args):
"""Return list of values for an option (or aliases). """Return list of values for an option (or aliases).
@ -525,7 +530,7 @@ def _dispatch(req):
# read --config before doing anything else # read --config before doing anything else
# (e.g. to change trust settings for reading .hg/hgrc) # (e.g. to change trust settings for reading .hg/hgrc)
_parseconfig(ui, _earlygetopt(['--config'], args)) cfgs = _parseconfig(ui, _earlygetopt(['--config'], args))
# check for cwd # check for cwd
cwd = _earlygetopt(['--cwd'], args) 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])) (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
atexit.register(print_time) atexit.register(print_time)
if options['verbose'] or options['debug'] or options['quiet']: uis = set([ui, lui])
for ui_ in (ui, lui):
ui_.setconfig('ui', 'verbose', str(bool(options['verbose']))) if req.repo:
ui_.setconfig('ui', 'debug', str(bool(options['debug']))) uis.add(req.repo.ui)
ui_.setconfig('ui', 'quiet', str(bool(options['quiet'])))
if options['traceback']: # copy configs that were passed on the cmdline (--config) to the repo ui
for ui_ in (ui, lui): for cfg in cfgs:
ui_.setconfig('ui', 'traceback', 'on') 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']: if options['noninteractive']:
for ui_ in (ui, lui): for ui_ in uis:
ui_.setconfig('ui', 'interactive', 'off') ui_.setconfig('ui', 'interactive', 'off')
if cmdoptions.get('insecure', False): if cmdoptions.get('insecure', False):
for ui_ in (ui, lui): for ui_ in uis:
ui_.setconfig('web', 'cacerts', '') ui_.setconfig('web', 'cacerts', '')
if options['help']: if options['help']:

View File

@ -233,7 +233,8 @@ def filemerge(repo, mynode, orig, fcd, fco, fca):
replace = dict(local=a, base=b, other=c, output=out) replace = dict(local=a, base=b, other=c, output=out)
args = util.interpolate(r'\$', replace, args, args = util.interpolate(r'\$', replace, args,
lambda s: '"%s"' % util.localpath(s)) 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 if not r and (_toolbool(ui, tool, "checkconflicts") or
'conflicts' in _toollist(ui, tool, "check")): 'conflicts' in _toollist(ui, tool, "check")):

View File

@ -1773,7 +1773,7 @@ class localrepository(repo.repository):
# process the files # process the files
self.ui.status(_("adding file changes\n")) self.ui.status(_("adding file changes\n"))
pr.step = 'files' pr.step = _('files')
pr.count = 1 pr.count = 1
pr.total = efiles pr.total = efiles
source.callback = None source.callback = None

27
tests/hgterm.ti Normal file
View 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,

View File

@ -54,6 +54,12 @@ issue1829: wrong indentation
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ unset FAKEPATH $ 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 username expansion
$ olduser=$HGUSER $ olduser=$HGUSER
@ -134,9 +140,7 @@ plain hgrc
$ hg showconfig --config ui.traceback=True --debug $ hg showconfig --config ui.traceback=True --debug
read config from: $TESTTMP/hgrc read config from: $TESTTMP/hgrc
none: ui.traceback=True none: ui.traceback=True
none: ui.verbose=False
none: ui.debug=True none: ui.debug=True
none: ui.quiet=False
plain mode with exceptions plain mode with exceptions
@ -152,24 +156,18 @@ plain mode with exceptions
read config from: $TESTTMP/hgrc read config from: $TESTTMP/hgrc
$TESTTMP/hgrc:15: extensions.plain=./plain.py $TESTTMP/hgrc:15: extensions.plain=./plain.py
none: ui.traceback=True none: ui.traceback=True
none: ui.verbose=False
none: ui.debug=True none: ui.debug=True
none: ui.quiet=False
$ unset HGPLAIN $ unset HGPLAIN
$ hg showconfig --config ui.traceback=True --debug $ hg showconfig --config ui.traceback=True --debug
plain: True plain: True
read config from: $TESTTMP/hgrc read config from: $TESTTMP/hgrc
$TESTTMP/hgrc:15: extensions.plain=./plain.py $TESTTMP/hgrc:15: extensions.plain=./plain.py
none: ui.traceback=True none: ui.traceback=True
none: ui.verbose=False
none: ui.debug=True none: ui.debug=True
none: ui.quiet=False
$ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT
$ hg showconfig --config ui.traceback=True --debug $ hg showconfig --config ui.traceback=True --debug
plain: True plain: True
read config from: $TESTTMP/hgrc read config from: $TESTTMP/hgrc
$TESTTMP/hgrc:15: extensions.plain=./plain.py $TESTTMP/hgrc:15: extensions.plain=./plain.py
none: ui.traceback=True none: ui.traceback=True
none: ui.verbose=False
none: ui.debug=True none: ui.debug=True
none: ui.quiet=False

View File

@ -10,7 +10,7 @@ nothing changed
$ hg revert $ hg revert
abort: no files or directories specified abort: no files or directories specified
(use --all to discard all changes) (use --all to revert all files)
[255] [255]
$ echo 123 > b $ echo 123 > b

View File

@ -167,7 +167,9 @@ hg status -A:
hg status -A (with terminfo color): 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 added\x1b[30m (esc)
\x1b[30m\x1b[32m\x1b[1mA copied\x1b[30m (esc) \x1b[30m\x1b[32m\x1b[1mA copied\x1b[30m (esc)
\x1b[30m\x1b[30m modified\x1b[30m (esc) \x1b[30m\x1b[30m modified\x1b[30m (esc)