Mercurial > hg
changeset 14812:7ba7459875cb stable
merge with i18n
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 29 Jun 2011 16:05:41 -0500 |
parents | 2dbce40fcaea (diff) 68a697421a57 (current diff) |
children | 53ed7b560564 e0a55fc65e5d |
files | |
diffstat | 24 files changed, 289 insertions(+), 76 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/check-code.py Thu Jun 30 01:55:14 2011 +0900 +++ b/contrib/check-code.py Wed Jun 29 16:05:41 2011 -0500 @@ -128,7 +128,9 @@ # (r'\w*[a-z][A-Z]\w*\s*=', "don't use camelcase in identifiers"), (r'^\s*(if|while|def|class|except|try)\s[^[]*:\s*[^\]#\s]+', "linebreak after :"), - (r'class\s[^(]:', "old-style class, use class foo(object)"), + (r'class\s[^( ]+:', "old-style class, use class foo(object)"), + (r'class\s[^( ]+\(\):', + "class foo() not available in Python 2.4, use class foo(object)"), (r'\b(%s)\(' % '|'.join(keyword.kwlist), "Python keyword is not a function"), (r',]', "unneeded trailing ',' in list"),
--- a/contrib/wix/guids.wxi Thu Jun 30 01:55:14 2011 +0900 +++ b/contrib/wix/guids.wxi Wed Jun 29 16:05:41 2011 -0500 @@ -29,7 +29,7 @@ <?define templates.coal.guid = {B63CCAAB-4EAF-43b4-901E-4BD13F5B78FC} ?> <?define templates.gitweb.guid = {D8BFE3ED-06DD-4C4D-A00D-6D825955F922} ?> <?define templates.monoblue.guid = {A394B4D5-2AF7-4AAC-AEA8-E92176E5501E} ?> - <?define templates.paper.guid = {243CF61D-7028-4A25-93CC-7C402088EAE6} ?> + <?define templates.paper.guid = {D2591E56-709E-49F9-8A5F-1359E1CCD7E0} ?> <?define templates.raw.guid = {04DE03A2-FBFD-4c5f-8DEA-5436DDF4689D} ?> <?define templates.rss.guid = {A7D608DE-0CF6-44f4-AF1E-EE30CC237FDA} ?> <?define templates.spartan.guid = {80222625-FA8F-44b1-86CE-1781EF375D09} ?>
--- a/contrib/wix/templates.wxs Thu Jun 30 01:55:14 2011 +0900 +++ b/contrib/wix/templates.wxs Wed Jun 29 16:05:41 2011 -0500 @@ -114,6 +114,7 @@ <File Id="paper.branches.tmpl" Name="branches.tmpl" KeyPath="yes" /> <File Id="paper.bookmarks.tmpl" Name="bookmarks.tmpl" /> <File Id="paper.changeset.tmpl" Name="changeset.tmpl" /> + <File Id="paper.diffstat.tmpl" Name="diffstat.tmpl" /> <File Id="paper.error.tmpl" Name="error.tmpl" /> <File Id="paper.fileannotate.tmpl" Name="fileannotate.tmpl" /> <File Id="paper.filediff.tmpl" Name="filediff.tmpl" />
--- a/doc/hgmanpage.py Thu Jun 30 01:55:14 2011 +0900 +++ b/doc/hgmanpage.py Wed Jun 29 16:05:41 2011 -0500 @@ -104,7 +104,7 @@ self.output = visitor.astext() -class Table: +class Table(object): def __init__(self): self._rows = [] self._options = ['center'] @@ -300,7 +300,7 @@ pass def list_start(self, node): - class enum_char: + class enum_char(object): enum_style = { 'bullet' : '\\(bu', 'emdash' : '\\(em',
--- a/hgext/color.py Thu Jun 30 01:55:14 2011 +0900 +++ b/hgext/color.py Wed Jun 29 16:05:41 2011 -0500 @@ -75,6 +75,14 @@ Some may not be available for a given terminal type, and will be silently ignored. +Note that on some systems, terminfo mode may cause problems when using +color with the pager extension and less -R. less with the -R option +will only display ECMA-48 color codes, and terminfo mode may sometimes +emit codes that less doesn't understand. You can work around this by +either using ansi mode (or auto mode), or by using less -r (which will +pass through all terminal control codes, not just color control +codes). + Because there are only eight standard colors, this module allows you to define color names for other color slots which might be available for your terminal type, assuming terminfo mode. For instance:: @@ -89,15 +97,15 @@ defined colors may then be used as any of the pre-defined eight, including appending '_background' to set the background to that color. -The color extension will try to detect whether to use terminfo, ANSI -codes or Win32 console APIs, unless it is made explicit; e.g.:: +By default, the color extension will use ANSI mode (or win32 mode on +Windows) if it detects a terminal. To override auto mode (to enable +terminfo mode, for example), set the following configuration option:: [color] - mode = ansi + mode = terminfo Any value other than 'ansi', 'win32', 'terminfo', or 'auto' will disable color. - ''' import os @@ -168,15 +176,14 @@ if os.name == 'nt' and 'TERM' not in os.environ: # looks line a cmd.exe console, use win32 API or nothing realmode = 'win32' - elif not formatted: + else: realmode = 'ansi' - else: - realmode = 'terminfo' if realmode == 'win32': - if not w32effects and mode == 'win32': - # only warn if color.mode is explicitly set to win32 - ui.warn(_('warning: failed to set color mode to %s\n') % mode) + if not w32effects: + if mode == 'win32': + # only warn if color.mode is explicitly set to win32 + ui.warn(_('warning: failed to set color mode to %s\n') % mode) return None _effects.update(w32effects) elif realmode == 'ansi':
--- a/mercurial/byterange.py Thu Jun 30 01:55:14 2011 +0900 +++ b/mercurial/byterange.py Wed Jun 29 16:05:41 2011 -0500 @@ -64,7 +64,7 @@ # HTTP's Range Not Satisfiable error raise RangeError('Requested Range Not Satisfiable') -class RangeableFileObject: +class RangeableFileObject(object): """File object wrapper to enable raw range handling. This was implemented primarilary for handling range specifications for file:// urls. This object effectively makes
--- a/mercurial/dispatch.py Thu Jun 30 01:55:14 2011 +0900 +++ b/mercurial/dispatch.py Wed Jun 29 16:05:41 2011 -0500 @@ -125,6 +125,8 @@ commands.help_(ui, 'shortlist') except error.RepoError, inst: ui.warn(_("abort: %s!\n") % inst) + if inst.hint: + ui.warn(_("(%s)\n") % inst.hint) except error.ResponseError, inst: ui.warn(_("abort: %s") % inst.args[0]) if not isinstance(inst.args[1], basestring):
--- a/mercurial/error.py Thu Jun 30 01:55:14 2011 +0900 +++ b/mercurial/error.py Wed Jun 29 16:05:41 2011 -0500 @@ -43,7 +43,9 @@ 'Exception raised when parsing config files (msg[, pos])' class RepoError(Exception): - pass + def __init__(self, *args, **kw): + Exception.__init__(self, *args) + self.hint = kw.get('hint') class RepoLookupError(RepoError): pass
--- a/mercurial/hgweb/server.py Thu Jun 30 01:55:14 2011 +0900 +++ b/mercurial/hgweb/server.py Wed Jun 29 16:05:41 2011 -0500 @@ -251,7 +251,7 @@ if hasattr(os, "fork"): _mixin = SocketServer.ForkingMixIn else: - class _mixin: + class _mixin(object): pass def openlog(opt, default):
--- a/mercurial/hgweb/webcommands.py Thu Jun 30 01:55:14 2011 +0900 +++ b/mercurial/hgweb/webcommands.py Wed Jun 29 16:05:41 2011 -0500 @@ -432,10 +432,10 @@ if limit > 0 and count >= limit: return count += 1 - if ctx.node() not in heads: + if not web.repo.branchheads(ctx.branch()): + status = 'closed' + elif ctx.node() not in heads: status = 'inactive' - elif not web.repo.branchheads(ctx.branch()): - status = 'closed' else: status = 'open' yield {'parity': parity.next(),
--- a/mercurial/keepalive.py Thu Jun 30 01:55:14 2011 +0900 +++ b/mercurial/keepalive.py Wed Jun 29 16:05:41 2011 -0500 @@ -124,7 +124,7 @@ HANDLE_ERRORS = 1 else: HANDLE_ERRORS = 0 -class ConnectionManager: +class ConnectionManager(object): """ The connection manager must be able to: * keep track of all existing @@ -187,7 +187,7 @@ else: return dict(self._hostmap) -class KeepAliveHandler: +class KeepAliveHandler(object): def __init__(self): self._cm = ConnectionManager() @@ -705,7 +705,7 @@ def test_timeout(url): global DEBUG dbbackup = DEBUG - class FakeLogger: + class FakeLogger(object): def debug(self, msg, *args): print msg % args info = warning = error = debug
--- a/mercurial/patch.py Thu Jun 30 01:55:14 2011 +0900 +++ b/mercurial/patch.py Wed Jun 29 16:05:41 2011 -0500 @@ -1009,7 +1009,7 @@ def new(self, fuzz=0, toponly=False): return self.fuzzit(self.b, fuzz, toponly) -class binhunk: +class binhunk(object): 'A binary patch file. Only understands literals so far.' def __init__(self, lr): self.text = None
--- a/mercurial/subrepo.py Thu Jun 30 01:55:14 2011 +0900 +++ b/mercurial/subrepo.py Wed Jun 29 16:05:41 2011 -0500 @@ -198,9 +198,9 @@ or on the top repo config. Abort or return None if no source found.""" if hasattr(repo, '_subparent'): source = util.url(repo._subsource) + if source.isabs(): + return str(source) source.path = posixpath.normpath(source.path) - if posixpath.isabs(source.path) or source.scheme: - return str(source) parent = _abssource(repo._subparent, push, abort=False) if parent: parent = util.url(parent)
--- a/mercurial/util.py Thu Jun 30 01:55:14 2011 +0900 +++ b/mercurial/util.py Wed Jun 29 16:05:41 2011 -0500 @@ -1555,6 +1555,17 @@ return (s, (None, (str(self), self.host), self.user, self.passwd or '')) + def isabs(self): + if self.scheme and self.scheme != 'file': + return True # remote URL + if hasdriveletter(self.path): + return True # absolute for our purposes - can't be joined() + if self.path.startswith(r'\\'): + return True # Windows UNC path + if self.path.startswith('/'): + return True # POSIX-style + return False + def localpath(self): if self.scheme == 'file' or self.scheme == 'bundle': path = self.path or '/'
--- a/tests/test-batching.py Thu Jun 30 01:55:14 2011 +0900 +++ b/tests/test-batching.py Wed Jun 29 16:05:41 2011 -0500 @@ -85,7 +85,7 @@ # server side # equivalent of wireproto's global functions -class server: +class server(object): def __init__(self, local): self.local = local def _call(self, name, args):
--- a/tests/test-check-code.t Thu Jun 30 01:55:14 2011 +0900 +++ b/tests/test-check-code.t Wed Jun 29 16:05:41 2011 -0500 @@ -27,8 +27,21 @@ > def any(x): > pass > EOF + $ cat > classstyle.py <<EOF + > class newstyle_class(object): + > pass + > + > class oldstyle_class: + > pass + > + > class empty(): + > pass + > + > no_class = 1: + > pass + > EOF $ check_code="$TESTDIR"/../contrib/check-code.py - $ "$check_code" ./wrong.py ./correct.py ./quote.py ./non-py24.py + $ "$check_code" ./wrong.py ./correct.py ./quote.py ./non-py24.py ./classstyle.py ./wrong.py:1: > def toto( arg1, arg2): gratuitous whitespace in () or [] @@ -51,6 +64,12 @@ ./non-py24.py:4: > y = format(x) any/all/format not available in Python 2.4 + ./classstyle.py:4: + > class oldstyle_class: + old-style class, use class foo(object) + ./classstyle.py:7: + > class empty(): + class foo() not available in Python 2.4, use class foo(object) [1] $ cat > is-op.py <<EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-commandserver.py Wed Jun 29 16:05:41 2011 -0500 @@ -0,0 +1,130 @@ +import sys, os, struct, subprocess, cStringIO, re + +def connect(path=None): + cmdline = ['hg', 'serve', '--cmdserver', 'pipe'] + if path: + cmdline += ['-R', path] + + server = subprocess.Popen(cmdline, stdin=subprocess.PIPE, + stdout=subprocess.PIPE) + + return server + +def writeblock(server, data): + server.stdin.write(struct.pack('>I', len(data))) + server.stdin.write(data) + server.stdin.flush() + +def readchannel(server): + data = server.stdout.read(5) + if not data: + raise EOFError() + channel, length = struct.unpack('>cI', data) + if channel in 'IL': + return channel, length + else: + return channel, server.stdout.read(length) + +def runcommand(server, args, output=sys.stdout, error=sys.stderr, input=None): + server.stdin.write('runcommand\n') + writeblock(server, '\0'.join(args)) + + if not input: + input = cStringIO.StringIO() + + while True: + ch, data = readchannel(server) + if ch == 'o': + output.write(data) + output.flush() + elif ch == 'e': + error.write(data) + error.flush() + elif ch == 'I': + writeblock(server, input.read(data)) + elif ch == 'L': + writeblock(server, input.readline(data)) + elif ch == 'r': + return struct.unpack('>i', data)[0] + else: + print "unexpected channel %c: %r" % (ch, data) + if ch.isupper(): + return + +def check(func, repopath=None): + server = connect(repopath) + try: + return func(server) + finally: + server.stdin.close() + server.wait() + +def unknowncommand(server): + server.stdin.write('unknowncommand\n') + +def hellomessage(server): + ch, data = readchannel(server) + # escaping python tests output not supported + print '%c, %r' % (ch, re.sub('encoding: [a-zA-Z0-9-]+', 'encoding: ***', data)) + + # run an arbitrary command to make sure the next thing the server sends + # isn't part of the hello message + runcommand(server, ['id']) + +def checkruncommand(server): + # hello block + readchannel(server) + + # no args + runcommand(server, []) + + # global options + runcommand(server, ['id', '--quiet']) + + # make sure global options don't stick through requests + runcommand(server, ['id']) + + # --config + runcommand(server, ['id', '--config', 'ui.quiet=True']) + + # make sure --config doesn't stick + runcommand(server, ['id']) + +def inputeof(server): + readchannel(server) + server.stdin.write('runcommand\n') + # close stdin while server is waiting for input + server.stdin.close() + + # server exits with 1 if the pipe closed while reading the command + print 'server exit code =', server.wait() + +def serverinput(server): + readchannel(server) + + patch = """ +# HG changeset patch +# User test +# Date 0 0 +# Node ID c103a3dec114d882c98382d684d8af798d09d857 +# Parent 0000000000000000000000000000000000000000 +1 + +diff -r 000000000000 -r c103a3dec114 a +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/a Thu Jan 01 00:00:00 1970 +0000 +@@ -0,0 +1,1 @@ ++1 +""" + + runcommand(server, ['import', '-'], input=cStringIO.StringIO(patch)) + runcommand(server, ['log']) + +if __name__ == '__main__': + os.system('hg init') + + check(hellomessage) + check(unknowncommand) + check(checkruncommand) + check(inputeof) + check(serverinput)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-commandserver.py.out Wed Jun 29 16:05:41 2011 -0500 @@ -0,0 +1,38 @@ +o, 'capabilities: getencoding runcommand\nencoding: ***' +000000000000 tip +abort: unknown command unknowncommand +Mercurial Distributed SCM + +basic commands: + + add add the specified files on the next commit + annotate show changeset information by line for each file + clone make a copy of an existing repository + commit commit the specified files or all outstanding changes + diff diff repository (or selected files) + export dump the header and diffs for one or more changesets + forget forget the specified files on the next commit + init create a new repository in the given directory + log show revision history of entire repository or files + merge merge working directory with another revision + pull pull changes from the specified source + push push changes to the specified destination + remove remove the specified files on the next commit + serve start stand-alone webserver + status show changed files in the working directory + summary summarize working directory state + update update working directory (or switch revisions) + +use "hg help" for the full list of commands or "hg -v" for details +000000000000 +000000000000 tip +000000000000 +000000000000 tip +server exit code = 1 +applying patch from stdin +changeset: 0:eff892de26ec +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: 1 +
--- a/tests/test-duplicateoptions.py Thu Jun 30 01:55:14 2011 +0900 +++ b/tests/test-duplicateoptions.py Wed Jun 29 16:05:41 2011 -0500 @@ -1,7 +1,7 @@ import os from mercurial import ui, commands, extensions -ignore = set(['highlight', 'win32text']) +ignore = set(['highlight', 'inotify', 'win32text']) if os.name != 'nt': ignore.add('win32mbcs')
--- a/tests/test-revert.t Thu Jun 30 01:55:14 2011 +0900 +++ b/tests/test-revert.t Wed Jun 29 16:05:41 2011 -0500 @@ -12,6 +12,7 @@ abort: no files or directories specified (use --all to revert all files) [255] + $ hg revert --all $ echo 123 > b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-wireproto.py Wed Jun 29 16:05:41 2011 -0500 @@ -0,0 +1,45 @@ +from mercurial import wireproto + +class proto(object): + def __init__(self, args): + self.args = args + def getargs(self, spec): + args = self.args + args.setdefault('*', {}) + names = spec.split() + return [args[n] for n in names] + +class clientrepo(wireproto.wirerepository): + def __init__(self, serverrepo): + self.serverrepo = serverrepo + def _call(self, cmd, **args): + return wireproto.dispatch(self.serverrepo, proto(args), cmd) + + @wireproto.batchable + def greet(self, name): + f = wireproto.future() + yield wireproto.todict(name=mangle(name)), f + yield unmangle(f.value) + +class serverrepo(object): + def greet(self, name): + return "Hello, " + name + +def mangle(s): + return ''.join(chr(ord(c) + 1) for c in s) +def unmangle(s): + return ''.join(chr(ord(c) - 1) for c in s) + +def greet(repo, proto, name): + return mangle(repo.greet(unmangle(name))) + +wireproto.commands['greet'] = (greet, 'name',) + +srv = serverrepo() +clt = clientrepo(srv) + +print clt.greet("Foobar") +b = clt.batch() +fs = [b.greet(s) for s in ["Fo, =;o", "Bar"]] +b.submit() +print [f.value for f in fs]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-wireproto.py.out Wed Jun 29 16:05:41 2011 -0500 @@ -0,0 +1,2 @@ +Hello, Foobar +['Hello, Fo, =;o', 'Hello, Bar']
--- a/tests/test-wireprotocol.py Thu Jun 30 01:55:14 2011 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -from mercurial import wireproto - -class proto(): - def __init__(self, args): - self.args = args - def getargs(self, spec): - args = self.args - args.setdefault('*', {}) - names = spec.split() - return [args[n] for n in names] - -class clientrepo(wireproto.wirerepository): - def __init__(self, serverrepo): - self.serverrepo = serverrepo - def _call(self, cmd, **args): - return wireproto.dispatch(self.serverrepo, proto(args), cmd) - - @wireproto.batchable - def greet(self, name): - f = wireproto.future() - yield wireproto.todict(name=mangle(name)), f - yield unmangle(f.value) - -class serverrepo(): - def greet(self, name): - return "Hello, " + name - -def mangle(s): - return ''.join(chr(ord(c) + 1) for c in s) -def unmangle(s): - return ''.join(chr(ord(c) - 1) for c in s) - -def greet(repo, proto, name): - return mangle(repo.greet(unmangle(name))) - -wireproto.commands['greet'] = (greet, 'name',) - -srv = serverrepo() -clt = clientrepo(srv) - -print clt.greet("Foobar") -b = clt.batch() -fs = [b.greet(s) for s in ["Fo, =;o", "Bar"]] -b.submit() -print [f.value for f in fs]