From 921ced43c48c1d170452a7b251b94cc96ec8dd44 Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Sat, 1 Oct 2011 20:49:36 +0000 Subject: Imported from /srv/lorry/lorry-area/mercurial-tarball/mercurial-1.9.3.tar.gz. --- contrib/bash_completion | 1 - contrib/check-code.py | 202 +++++++++++++-------------------------- contrib/debugcmdserver.py | 47 --------- contrib/hg-ssh | 64 +++---------- contrib/hgfixes/fix_bytes.py | 2 +- contrib/hgweb.fcgi | 3 +- contrib/hgweb.wsgi | 3 +- contrib/mercurial.el | 3 +- contrib/mq.el | 3 +- contrib/perf.py | 100 ++----------------- contrib/plan9/9diff | 42 -------- contrib/plan9/README | 39 -------- contrib/plan9/hgrc.d/9diff.rc | 7 -- contrib/plan9/hgrc.d/factotum.rc | 4 - contrib/plan9/mkfile | 37 ------- contrib/plan9/proto | 24 ----- contrib/setup3k.py | 14 +-- contrib/shrink-revlog.py | 29 +++--- contrib/win32/ReadMe.html | 2 +- contrib/win32/hgwebdir_wsgi.py | 2 +- contrib/win32/mercurial.ini | 8 +- contrib/wix/COPYING.rtf | Bin 1686 -> 1755 bytes contrib/wix/README.txt | 2 +- contrib/wix/guids.wxi | 6 +- contrib/wix/help.wxs | 1 - contrib/wix/i18n.wxs | 2 +- contrib/wix/templates.wxs | 1 - contrib/zsh_completion | 69 +------------ 28 files changed, 127 insertions(+), 590 deletions(-) delete mode 100755 contrib/debugcmdserver.py delete mode 100755 contrib/plan9/9diff delete mode 100644 contrib/plan9/README delete mode 100644 contrib/plan9/hgrc.d/9diff.rc delete mode 100644 contrib/plan9/hgrc.d/factotum.rc delete mode 100644 contrib/plan9/mkfile delete mode 100644 contrib/plan9/proto (limited to 'contrib') diff --git a/contrib/bash_completion b/contrib/bash_completion index dfd149d..239da74 100644 --- a/contrib/bash_completion +++ b/contrib/bash_completion @@ -84,7 +84,6 @@ _hg_status() { local files="$(_hg_cmd status -n$1 .)" local IFS=$'\n' - compopt -o filenames 2>/dev/null COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$files' -- "$cur")) } diff --git a/contrib/check-code.py b/contrib/check-code.py index b8f714c..464659e 100755 --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -13,7 +13,7 @@ import optparse def repquote(m): t = re.sub(r"\w", "x", m.group('text')) - t = re.sub(r"[^\s\nx]", "o", t) + t = re.sub(r"[^\sx]", "o", t) return m.group('quote') + t + m.group('quote') def reppython(m): @@ -43,44 +43,35 @@ def rephere(m): testpats = [ [ - (r'pushd|popd', "don't use 'pushd' or 'popd', use 'cd'"), - (r'\W\$?\(\([^\)\n]*\)\)', "don't use (()) or $(()), use 'expr'"), + (r'(pushd|popd)', "don't use 'pushd' or 'popd', use 'cd'"), + (r'\W\$?\(\([^\)]*\)\)', "don't use (()) or $(()), use 'expr'"), + (r'^function', "don't use 'function', use old style"), (r'grep.*-q', "don't use 'grep -q', redirect to /dev/null"), - (r'sed.*-i', "don't use 'sed -i', use a temporary file"), - (r'\becho\b.*\\n', "don't use 'echo \\n', use printf"), + (r'echo.*\\n', "don't use 'echo \\n', use printf"), (r'echo -n', "don't use 'echo -n', use printf"), - (r'(^| )wc[^|]*$\n(?!.*\(re\))', "filter wc output"), + (r'^diff.*-\w*N', "don't use 'diff -N'"), + (r'(^| )wc[^|]*$', "filter wc output"), (r'head -c', "don't use 'head -c', use 'dd'"), - (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"), (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"), - (r'printf.*\\([1-9]|0\d)', "don't use 'printf \NNN', use Python"), + (r'printf.*\\\d\d\d', "don't use 'printf \NNN', use Python"), (r'printf.*\\x', "don't use printf \\x, use Python"), (r'\$\(.*\)', "don't use $(expr), use `expr`"), (r'rm -rf \*', "don't use naked rm -rf, target a directory"), (r'(^|\|\s*)grep (-\w\s+)*[^|]*[(|]\w', "use egrep for extended grep syntax"), (r'/bin/', "don't use explicit paths for tools"), + (r'\$PWD', "don't use $PWD, use `pwd`"), (r'[^\n]\Z', "no trailing newline"), (r'export.*=', "don't export and assign at once"), + ('^([^"\']|("[^"]*")|(\'[^\']*\'))*\\^', "^ must be quoted"), (r'^source\b', "don't use 'source', use '.'"), (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"), - (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"), - (r'[^>\n]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"), - (r'^stop\(\)', "don't use 'stop' as a shell function name"), - (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"), - (r'^alias\b.*=', "don't use alias, use a function"), - (r'if\s*!', "don't use '!' to negate exit status"), - (r'/dev/u?random', "don't use entropy, use /dev/zero"), - (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"), - (r'^( *)\t', "don't use tabs to indent"), + (r'ls\s+[^|-]+\s+-', "options to 'ls' must come before filenames"), + (r'[^>]>\s*\$HGRCPATH', "don't overwrite $HGRCPATH, append to it"), + (r'stop\(\)', "don't use 'stop' as a shell function name"), ], # warnings - [ - (r'^function', "don't use 'function', use old style"), - (r'^diff.*-\w*N', "don't use 'diff -N'"), - (r'\$PWD', "don't use $PWD, use `pwd`"), - (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\^', "^ must be quoted"), - ] + [] ] testfilters = [ @@ -89,19 +80,17 @@ testfilters = [ ] uprefix = r"^ \$ " +uprefixc = r"^ > " utestpats = [ [ - (r'^(\S| $ ).*(\S[ \t]+|^[ \t]+)\n', "trailing whitespace on non-output"), - (uprefix + r'.*\|\s*sed[^|>\n]*\n', - "use regex test output patterns instead of sed"), + (r'^(\S| $ ).*(\S\s+|^\s+)\n', "trailing whitespace on non-output"), + (uprefix + r'.*\|\s*sed', "use regex test output patterns instead of sed"), (uprefix + r'(true|exit 0)', "explicit zero exit unnecessary"), - (uprefix + r'.*(? for continued lines"), - (r'^ saved backup bundle to \$TESTTMP.*\.hg$', - "use (glob) to match Windows paths too"), + (uprefixc + r'( *)\t', "don't use tabs to indent"), ], # warnings [] @@ -109,10 +98,10 @@ utestpats = [ for i in [0, 1]: for p, m in testpats[i]: - if p.startswith(r'^'): - p = r"^ [$>] (%s)" % p[1:] + if p.startswith('^'): + p = uprefix + p[1:] else: - p = r"^ [$>] .*(%s)" % p + p = uprefix + p utestpats[i].append((p, m)) utestfilters = [ @@ -130,25 +119,18 @@ pypats = [ (r'\.has_key\b', "dict.has_key is not available in Python 3+"), (r'^\s*\t', "don't use tabs"), (r'\S;\s*\n', "semicolon"), - (r'[^_]_\("[^"]+"\s*%', "don't use % inside _()"), - (r"[^_]_\('[^']+'\s*%", "don't use % inside _()"), (r'\w,\w', "missing whitespace after ,"), (r'\w[+/*\-<>]\w', "missing whitespace in expression"), - (r'^\s+\w+=\w+[^,)\n]$', "missing whitespace in assignment"), - (r'(\s+)try:\n((?:\n|\1\s.*\n)+?)\1except.*?:\n' - r'((?:\n|\1\s.*\n)+?)\1finally:', 'no try/except/finally in Py2.4'), - (r'.{81}', "line too long"), - (r' x+[xo][\'"]\n\s+[\'"]x', 'string join across lines with no space'), + (r'^\s+\w+=\w+[^,)]$', "missing whitespace in assignment"), + (r'.{85}', "line too long"), (r'[^\n]\Z', "no trailing newline"), - (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"), -# (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', -# "don't use underbars in identifiers"), - (r'^\s+(self\.)?[A-za-z][a-z0-9]+[A-Z]\w* = ', - "don't use camelcase in identifiers"), - (r'^\s*(if|while|def|class|except|try)\s[^[\n]*:\s*[^\\n]#\s]+', + (r'(\S\s+|^\s+)\n', "trailing whitespace"), +# (r'^\s+[^_ ][^_. ]+_[^_]+\s*=', "don't use underbars in identifiers"), +# (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[^( \n]+:', "old-style class, use class foo(object)"), - (r'class\s[^( \n]+\(\):', + (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"), @@ -166,19 +148,19 @@ pypats = [ (r'(?< ](\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S', + (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\S', "missing whitespace around operator"), - (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\s', + (r'[^>< ](\+=|-=|!=|<>|<=|>=|<<=|>>=)\s', "missing whitespace around operator"), - (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=|%=)\S', + (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S', "missing whitespace around operator"), - (r'[^^+=*/!<>&| %-](\s=|=\s)[^= ]', + (r'[^+=*/!<>&| -](\s=|=\s)[^= ]', "wrong whitespace around ="), (r'raise Exception', "don't raise generic exceptions"), (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"), @@ -186,12 +168,8 @@ pypats = [ "comparison with singleton, use 'is' or 'is not' instead"), (r'^\s*(while|if) [01]:', "use True/False for constant Boolean expression"), - (r'(?:(?', p - - pos = 0 - n = 0 - for m in re.finditer(p, post, re.MULTILINE): - if prelines is None: - prelines = pre.splitlines() - postlines = post.splitlines(True) - - start = m.start() - while n < len(postlines): - step = len(postlines[n]) - if pos + step > start: - break - pos += step - n += 1 - l = prelines[n] - - if "check-code" + "-ignore" in l: - if debug: - print "Skipping %s for %s:%s (check-code -ignore)" % ( - name, f, n) - continue - elif ignore and re.search(ignore, l, re.MULTILINE): - continue - bd = "" - if blame: - bd = 'working directory' - if not blamecache: - blamecache = getblame(f) - if n < len(blamecache): - bl, bu, br = blamecache[n] - if bl == l: - bd = '%s@%s' % (bu, br) - errors.append((f, lineno and n + 1, l, msg, bd)) - result = False - - errors.sort() - for e in errors: - logfunc(*e) - fc += 1 - if maxerr and fc >= maxerr: + for n, l in z: + if "check-code" + "-ignore" in l[0]: + if debug: + print "Skipping %s for %s:%s (check-code -ignore)" % ( + name, f, n) + continue + for p, msg in pats: + if re.search(p, l[1]): + bd = "" + if blame: + bd = 'working directory' + if not blamecache: + blamecache = getblame(f) + if n < len(blamecache): + bl, bu, br = blamecache[n] + if bl == l[0]: + bd = '%s@%s' % (bu, br) + logfunc(f, n + 1, l[0], msg, bd) + fc += 1 + result = False + if maxerr is not None and fc >= maxerr: print " (too many errors, giving up)" break - return result if __name__ == "__main__": @@ -429,11 +367,8 @@ if __name__ == "__main__": help="use annotate to generate blame info") parser.add_option("", "--debug", action="store_true", help="show debug information") - parser.add_option("", "--nolineno", action="store_false", - dest='lineno', help="don't show line numbers") - parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False, - lineno=True) + parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False) (options, args) = parser.parse_args() if len(args) == 0: @@ -441,10 +376,9 @@ if __name__ == "__main__": else: check = args - ret = 0 for f in check: + ret = 0 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings, - blame=options.blame, debug=options.debug, - lineno=options.lineno): + blame=options.blame, debug=options.debug): ret = 1 sys.exit(ret) diff --git a/contrib/debugcmdserver.py b/contrib/debugcmdserver.py deleted file mode 100755 index 859ee9a..0000000 --- a/contrib/debugcmdserver.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python -# -# Dumps output generated by Mercurial's command server in a formatted style to a -# given file or stderr if '-' is specified. Output is also written in its raw -# format to stdout. -# -# $ ./hg serve --cmds pipe | ./contrib/debugcmdserver.py - -# o, 52 -> 'capabilities: getencoding runcommand\nencoding: UTF-8' - -import sys, struct - -if len(sys.argv) != 2: - print 'usage: debugcmdserver.py FILE' - sys.exit(1) - -outputfmt = '>cI' -outputfmtsize = struct.calcsize(outputfmt) - -if sys.argv[1] == '-': - log = sys.stderr -else: - log = open(sys.argv[1], 'a') - -def read(size): - data = sys.stdin.read(size) - if not data: - raise EOFError - sys.stdout.write(data) - sys.stdout.flush() - return data - -try: - while True: - header = read(outputfmtsize) - channel, length = struct.unpack(outputfmt, header) - log.write('%s, %-4d' % (channel, length)) - if channel in 'IL': - log.write(' -> waiting for input\n') - else: - data = read(length) - log.write(' -> %r\n' % data) - log.flush() -except EOFError: - pass -finally: - if log != sys.stderr: - log.close() diff --git a/contrib/hg-ssh b/contrib/hg-ssh index 5021958..abf7a7d 100755 --- a/contrib/hg-ssh +++ b/contrib/hg-ssh @@ -24,9 +24,6 @@ command="cd path/to/my/repositories && hg-ssh repo1 subdir/repo2" You can use pattern matching of your normal shell, e.g.: command="cd repos && hg-ssh user/thomas/* projects/{mercurial,foo}" - -You can also add a --read-only flag to allow read-only access to a key, e.g.: -command="hg-ssh --read-only repos/*" """ # enable importing on demand to reduce startup time @@ -34,53 +31,22 @@ from mercurial import demandimport; demandimport.enable() from mercurial import dispatch -import sys, os, shlex +import sys, os -def main(): - cwd = os.getcwd() - readonly = False - args = sys.argv[1:] - while len(args): - if args[0] == '--read-only': - readonly = True - args.pop(0) - else: - break - allowed_paths = [os.path.normpath(os.path.join(cwd, - os.path.expanduser(path))) - for path in args] - orig_cmd = os.getenv('SSH_ORIGINAL_COMMAND', '?') - try: - cmdargv = shlex.split(orig_cmd) - except ValueError, e: - sys.stderr.write('Illegal command "%s": %s\n' % (orig_cmd, e)) - sys.exit(255) +cwd = os.getcwd() +allowed_paths = [os.path.normpath(os.path.join(cwd, os.path.expanduser(path))) + for path in sys.argv[1:]] +orig_cmd = os.getenv('SSH_ORIGINAL_COMMAND', '?') - if cmdargv[:2] == ['hg', '-R'] and cmdargv[3:] == ['serve', '--stdio']: - path = cmdargv[2] - repo = os.path.normpath(os.path.join(cwd, os.path.expanduser(path))) - if repo in allowed_paths: - cmd = ['-R', repo, 'serve', '--stdio'] - if readonly: - cmd += [ - '--config', - 'hooks.prechangegroup.hg-ssh=python:__main__.rejectpush', - '--config', - 'hooks.prepushkey.hg-ssh=python:__main__.rejectpush' - ] - dispatch.dispatch(dispatch.request(cmd)) - else: - sys.stderr.write('Illegal repository "%s"\n' % repo) - sys.exit(255) +if orig_cmd.startswith('hg -R ') and orig_cmd.endswith(' serve --stdio'): + path = orig_cmd[6:-14] + repo = os.path.normpath(os.path.join(cwd, os.path.expanduser(path))) + if repo in allowed_paths: + dispatch.dispatch(dispatch.request(['-R', repo, 'serve', '--stdio'])) else: - sys.stderr.write('Illegal command "%s"\n' % orig_cmd) - sys.exit(255) - -def rejectpush(ui, **kwargs): - ui.warn("Permission denied\n") - # mercurial hooks use unix process conventions for hook return values - # so a truthy return means failure - return True + sys.stderr.write("Illegal repository %r\n" % repo) + sys.exit(-1) +else: + sys.stderr.write("Illegal command %r\n" % orig_cmd) + sys.exit(-1) -if __name__ == '__main__': - main() diff --git a/contrib/hgfixes/fix_bytes.py b/contrib/hgfixes/fix_bytes.py index 0890c21..ddd22b2 100644 --- a/contrib/hgfixes/fix_bytes.py +++ b/contrib/hgfixes/fix_bytes.py @@ -74,7 +74,7 @@ def shouldtransform(node): 'setattr' in sggparent or \ 'encode' in sggparent or \ 'decode' in sggparent: - return False + return False return True diff --git a/contrib/hgweb.fcgi b/contrib/hgweb.fcgi index dc62e71..39ea438 100755 --- a/contrib/hgweb.fcgi +++ b/contrib/hgweb.fcgi @@ -5,8 +5,7 @@ # Path to repo or hgweb config to serve (see 'hg help hgweb') config = "/path/to/repo/or/config" -# Uncomment and adjust if Mercurial is not installed system-wide -# (consult "installed modules" path from 'hg debuginstall'): +# Uncomment and adjust if Mercurial is not installed system-wide: #import sys; sys.path.insert(0, "/path/to/python/lib") # Uncomment to send python tracebacks to the browser if an error occurs: diff --git a/contrib/hgweb.wsgi b/contrib/hgweb.wsgi index c2baf84..8323628 100644 --- a/contrib/hgweb.wsgi +++ b/contrib/hgweb.wsgi @@ -4,8 +4,7 @@ # Path to repo or hgweb config to serve (see 'hg help hgweb') config = "/path/to/repo/or/config" -# Uncomment and adjust if Mercurial is not installed system-wide -# (consult "installed modules" path from 'hg debuginstall'): +# Uncomment and adjust if Mercurial is not installed system-wide: #import sys; sys.path.insert(0, "/path/to/python/lib") # Uncomment to send python tracebacks to the browser if an error occurs: diff --git a/contrib/mercurial.el b/contrib/mercurial.el index c3ad538..df1623f 100644 --- a/contrib/mercurial.el +++ b/contrib/mercurial.el @@ -15,7 +15,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with mercurial.el, GNU Emacs, or XEmacs; see the file COPYING -;; (`C-h C-l'). If not, see . +;; (`C-h C-l'). If not, write to the Free Software Foundation, Inc., +;; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ;;; Commentary: diff --git a/contrib/mq.el b/contrib/mq.el index dbc9165..ef585aa 100644 --- a/contrib/mq.el +++ b/contrib/mq.el @@ -15,7 +15,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with mq.el, GNU Emacs, or XEmacs; see the file COPYING (`C-h -;; C-l'). If not, see . +;; C-l'). If not, write to the Free Software Foundation, Inc., 59 +;; Temple Place - Suite 330, Boston, MA 02111-1307, USA. (eval-when-compile (require 'cl)) (require 'mercurial) diff --git a/contrib/perf.py b/contrib/perf.py index 574e899..3b70601 100644 --- a/contrib/perf.py +++ b/contrib/perf.py @@ -1,7 +1,7 @@ # perf.py - performance test routines '''helper extension to measure performance''' -from mercurial import cmdutil, scmutil, util, match, commands +from mercurial import cmdutil, scmutil, match, commands import time, os, sys def timer(func, title=None): @@ -33,34 +33,20 @@ def perfwalk(ui, repo, *pats): try: m = scmutil.match(repo[None], pats, {}) timer(lambda: len(list(repo.dirstate.walk(m, [], True, False)))) - except Exception: + except: try: m = scmutil.match(repo[None], pats, {}) timer(lambda: len([b for a, b, c in repo.dirstate.statwalk([], m)])) - except Exception: + except: timer(lambda: len(list(cmdutil.walk(repo, pats, {})))) def perfstatus(ui, repo, *pats): #m = match.always(repo.root, repo.getcwd()) - #timer(lambda: sum(map(len, repo.dirstate.status(m, [], False, False, - # False)))) + #timer(lambda: sum(map(len, repo.dirstate.status(m, [], False, False, False)))) timer(lambda: sum(map(len, repo.status()))) -def clearcaches(cl): - # behave somewhat consistently across internal API changes - if util.safehasattr(cl, 'clearcaches'): - cl.clearcaches() - elif util.safehasattr(cl, '_nodecache'): - from mercurial.node import nullid, nullrev - cl._nodecache = {nullid: nullrev} - cl._nodepos = None - def perfheads(ui, repo): - cl = repo.changelog - def d(): - len(cl.headrevs()) - clearcaches(cl) - timer(d) + timer(lambda: len(repo.changelog.heads())) def perftags(ui, repo): import mercurial.changelog, mercurial.manifest @@ -71,13 +57,6 @@ def perftags(ui, repo): return len(repo.tags()) timer(t) -def perfancestors(ui, repo): - heads = repo.changelog.headrevs() - def d(): - for a in repo.changelog.ancestors(heads): - pass - timer(d) - def perfdirstate(ui, repo): "a" in repo.dirstate def d(): @@ -92,14 +71,6 @@ def perfdirstatedirs(ui, repo): del repo.dirstate._dirs timer(d) -def perfdirstatewrite(ui, repo): - ds = repo.dirstate - "a" in ds - def d(): - ds._dirty = True - ds.write() - timer(d) - def perfmanifest(ui, repo): def d(): t = repo.manifest.tip() @@ -108,20 +79,13 @@ def perfmanifest(ui, repo): repo.manifest._cache = None timer(d) -def perfchangeset(ui, repo, rev): - n = repo[rev].node() - def d(): - c = repo.changelog.read(n) - #repo.changelog._cache = None - timer(d) - def perfindex(ui, repo): import mercurial.revlog mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg n = repo["tip"].node() def d(): - cl = mercurial.revlog.revlog(repo.sopener, "00changelog.i") - cl.rev(n) + repo.invalidate() + repo[n] timer(d) def perfstartup(ui, repo): @@ -140,29 +104,6 @@ def perfparents(ui, repo): def perflookup(ui, repo, rev): timer(lambda: len(repo.lookup(rev))) -def perfrevrange(ui, repo, *specs): - revrange = scmutil.revrange - timer(lambda: len(revrange(repo, specs))) - -def perfnodelookup(ui, repo, rev): - import mercurial.revlog - mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg - n = repo[rev].node() - def d(): - cl = mercurial.revlog.revlog(repo.sopener, "00changelog.i") - cl.rev(n) - timer(d) - -def perfnodelookup(ui, repo, rev): - import mercurial.revlog - mercurial.revlog._prereadsize = 2**24 # disable lazy parser in old hg - n = repo[rev].node() - cl = mercurial.revlog.revlog(repo.sopener, "00changelog.i") - def d(): - cl.rev(n) - clearcaches(cl) - timer(d) - def perflog(ui, repo, **opts): ui.pushbuffer() timer(lambda: commands.log(ui, repo, rev=[], date='', user='', @@ -176,25 +117,6 @@ def perftemplating(ui, repo): ' {author|person}: {desc|firstline}\n')) ui.popbuffer() -def perfcca(ui, repo): - timer(lambda: scmutil.casecollisionauditor(ui, False, repo.dirstate)) - -def perffncacheload(ui, repo): - from mercurial import scmutil, store - s = store.store(set(['store','fncache']), repo.path, scmutil.opener) - def d(): - s.fncache._load() - timer(d) - -def perffncachewrite(ui, repo): - from mercurial import scmutil, store - s = store.store(set(['store','fncache']), repo.path, scmutil.opener) - s.fncache._load() - def d(): - s.fncache._dirty = True - s.fncache.write() - timer(d) - def perfdiffwd(ui, repo): """Profile diff of working directory changes""" options = { @@ -223,25 +145,17 @@ def perfrevlog(ui, repo, file_, **opts): timer(d) cmdtable = { - 'perfcca': (perfcca, []), - 'perffncacheload': (perffncacheload, []), - 'perffncachewrite': (perffncachewrite, []), 'perflookup': (perflookup, []), - 'perfrevrange': (perfrevrange, []), - 'perfnodelookup': (perfnodelookup, []), 'perfparents': (perfparents, []), 'perfstartup': (perfstartup, []), 'perfstatus': (perfstatus, []), 'perfwalk': (perfwalk, []), 'perfmanifest': (perfmanifest, []), - 'perfchangeset': (perfchangeset, []), 'perfindex': (perfindex, []), 'perfheads': (perfheads, []), 'perftags': (perftags, []), - 'perfancestors': (perfancestors, []), 'perfdirstate': (perfdirstate, []), 'perfdirstatedirs': (perfdirstate, []), - 'perfdirstatewrite': (perfdirstatewrite, []), 'perflog': (perflog, [('', 'rename', False, 'ask log to follow renames')]), 'perftemplating': (perftemplating, []), diff --git a/contrib/plan9/9diff b/contrib/plan9/9diff deleted file mode 100755 index 02af2a9..0000000 --- a/contrib/plan9/9diff +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/rc -# 9diff - Mercurial extdiff wrapper for diff(1) - -rfork e - -fn getfiles { - cd $1 && - for(f in `{du -as | awk '{print $2}'}) - test -f $f && echo `{cleanname $f} -} - -fn usage { - echo >[1=2] usage: 9diff [diff options] parent child root - exit usage -} - -opts=() -while(~ $1 -*){ - opts=($opts $1) - shift -} -if(! ~ $#* 3) - usage - -# extdiff will set the parent and child to a single file if there is -# only one change. If there are multiple changes, directories will be -# set. diff(1) does not cope particularly with directories; instead we -# do the recursion ourselves and diff each file individually. -if(test -f $1) - diff $opts $1 $2 -if not{ - # extdiff will create a snapshot of the working copy to prevent - # conflicts during the diff. We circumvent this behavior by - # diffing against the repository root to produce plumbable - # output. This is antisocial. - for(f in `{sort -u <{getfiles $1} <{getfiles $2}}){ - file1=$1/$f; test -f $file1 || file1=/dev/null - file2=$3/$f; test -f $file2 || file2=/dev/null - diff $opts $file1 $file2 - } -} -exit '' diff --git a/contrib/plan9/README b/contrib/plan9/README deleted file mode 100644 index 6adbf53..0000000 --- a/contrib/plan9/README +++ /dev/null @@ -1,39 +0,0 @@ -Mercurial for Plan 9 from Bell Labs -=================================== - -This directory contains support for Mercurial on Plan 9 from Bell Labs -platforms. It is assumed that the version of Python running on these -systems supports the ANSI/POSIX Environment (APE). At the time of this -writing, the bichued/python port is the most commonly installed version -of Python on these platforms. If a native port of Python is ever made, -some minor modification will need to be made to support some of the more -esoteric requirements of the platform rather than those currently made -(cf. posix.py). - -By default, installations will have the factotum extension enabled; this -extension permits factotum(4) to act as an authentication agent for -HTTP repositories. Additionally, an extdiff command named 9diff is -enabled which generates diff(1) compatible output suitable for use with -the plumber(4). - -Commit messages are plumbed using E if no editor is defined; users must -update the plumbed file to continue, otherwise the hg process must be -interrupted. - -Some work remains with regard to documentation. Section 5 manual page -references for hgignore and hgrc need to be re-numbered to section 6 (file -formats) and a new man page writer should be written to support the -Plan 9 man macro set. Until these issues can be resolved, manual pages -are elided from the installation. - -Basic install: - - % mk install # do a system-wide install - % hg debuginstall # sanity-check setup - % hg # see help - -A proto(2) file is included in this directory as an example of how a -binary distribution could be packaged, ostensibly with contrib(1). - -See http://mercurial.selenic.com/ for detailed installation -instructions, platform-specific notes, and Mercurial user information. diff --git a/contrib/plan9/hgrc.d/9diff.rc b/contrib/plan9/hgrc.d/9diff.rc deleted file mode 100644 index 757e24c..0000000 --- a/contrib/plan9/hgrc.d/9diff.rc +++ /dev/null @@ -1,7 +0,0 @@ -# The 9diff extdiff command generates diff(1) compatible output -# suitable for use with the plumber(4). -[extensions] -extdiff = - -[extdiff] -9diff = 9diff -cm $parent $child $root diff --git a/contrib/plan9/hgrc.d/factotum.rc b/contrib/plan9/hgrc.d/factotum.rc deleted file mode 100644 index 0fa2334..0000000 --- a/contrib/plan9/hgrc.d/factotum.rc +++ /dev/null @@ -1,4 +0,0 @@ -# The factotum extension permits factotum(4) to act as an -# authentication agent for HTTP repositories. -[extensions] -factotum = diff --git a/contrib/plan9/mkfile b/contrib/plan9/mkfile deleted file mode 100644 index 6d8e8c2..0000000 --- a/contrib/plan9/mkfile +++ /dev/null @@ -1,37 +0,0 @@ -APE=/sys/src/ape -<$APE/config - -PYTHON=python -PYTHONBIN=/rc/bin -SH=ape/psh - -PURE=--pure -ROOT=../.. - -# This is slightly underhanded; Plan 9 does not support GNU gettext nor -# does it support dynamically loaded extension modules. We work around -# this by calling build_py and build_scripts directly; this avoids -# additional platform hacks in setup.py. -build:VQ: - @{ - cd $ROOT - $SH -c '$PYTHON setup.py $PURE build_py build_scripts' - } - -clean:VQ: - @{ - cd $ROOT - $SH -c '$PYTHON setup.py $PURE clean --all' - } - -install:VQ: build - @{ - cd $ROOT - $SH -c '$PYTHON setup.py $PURE install \ - --install-scripts $PYTHONBIN \ - --skip-build \ - --force' - } - mkdir -p /lib/mercurial/hgrc.d - dircp hgrc.d /lib/mercurial/hgrc.d/ - cp 9diff /rc/bin/ diff --git a/contrib/plan9/proto b/contrib/plan9/proto deleted file mode 100644 index 4355209..0000000 --- a/contrib/plan9/proto +++ /dev/null @@ -1,24 +0,0 @@ -lib - sys sys - mercurial - sys sys - hgrc.d - sys sys - 9diff.rc - sys sys - factotum.rc - sys sys -rc - sys sys - bin - sys sys - 9diff - sys sys - hg - sys sys -sys - sys sys - lib - sys sys - python - sys sys - lib - sys sys - python2.5 - sys sys - site-packages - sys sys - hgext - sys sys - + - sys sys - mercurial - sys sys - + - sys sys - mercurial-VERSION-py2.5.egg-info - sys sys - src - sys sys - cmd - sys sys - hg - sys sys - + - sys sys diff --git a/contrib/setup3k.py b/contrib/setup3k.py index 55cf36f..6957908 100644 --- a/contrib/setup3k.py +++ b/contrib/setup3k.py @@ -8,7 +8,7 @@ from distutils.command.build_py import build_py_2to3 from lib2to3.refactor import get_fixers_from_package as getfixers import sys -if getattr(sys, 'version_info', (0, 0, 0)) < (2, 4, 0, 'final'): +if not hasattr(sys, 'version_info') or sys.version_info < (2, 4, 0, 'final'): raise SystemExit("Mercurial requires Python 2.4 or later.") if sys.version_info[0] >= 3: @@ -26,22 +26,22 @@ else: try: import hashlib sha = hashlib.sha1() -except ImportError: +except: try: import sha - except ImportError: + except: raise SystemExit( "Couldn't import standard hashlib (incomplete Python install).") try: import zlib -except ImportError: +except: raise SystemExit( "Couldn't import standard zlib (incomplete Python install).") try: import bz2 -except ImportError: +except: raise SystemExit( "Couldn't import standard bz2 (incomplete Python install).") @@ -84,7 +84,7 @@ def hasfunction(cc, funcname): os.dup2(devnull.fileno(), sys.stderr.fileno()) objects = cc.compile([fname], output_dir=tmpdir) cc.link_executable(objects, os.path.join(tmpdir, "a.out")) - except Exception: + except: return False return True finally: @@ -236,7 +236,7 @@ class hgbuildext(build_ext): try: build_ext.build_extension(self, ext) except CCompilerError: - if getattr(ext, 'optional', False): + if not hasattr(ext, 'optional') or not ext.optional: raise log.warn("Failed to build optional extension '%s' (skipping)", ext.name) diff --git a/contrib/shrink-revlog.py b/contrib/shrink-revlog.py index 6bd006d..18c0de7 100644 --- a/contrib/shrink-revlog.py +++ b/contrib/shrink-revlog.py @@ -16,7 +16,7 @@ This is *not* safe to run on a changelog. # e.g. by comparing "before" and "after" states of random changesets # (maybe: export before, shrink, export after, diff). -import os, errno +import os, tempfile, errno from mercurial import revlog, transaction, node, util, scmutil from mercurial import changegroup from mercurial.i18n import _ @@ -191,6 +191,7 @@ def shrink(ui, repo, **opts): 'will corrupt your repository')) ui.write(_('shrinking %s\n') % indexfn) + prefix = os.path.basename(indexfn)[:-1] tmpindexfn = util.mktempcopy(indexfn, emptyok=True) r1 = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), indexfn) @@ -240,7 +241,7 @@ def shrink(ui, repo, **opts): writerevs(ui, r1, r2, order, tr) report(ui, r1, r2) tr.close() - except: # re-raises + except: # Abort transaction first, so we truncate the files before # deleting them. tr.abort() @@ -269,23 +270,19 @@ def shrink(ui, repo, **opts): lock.release() if not opts.get('dry_run'): - ui.write( - _('note: old revlog saved in:\n' - ' %s\n' - ' %s\n' - '(You can delete those files when you are satisfied that your\n' - 'repository is still sane. ' - 'Running \'hg verify\' is strongly recommended.)\n') - % (oldindexfn, olddatafn)) + ui.write(_('note: old revlog saved in:\n' + ' %s\n' + ' %s\n' + '(You can delete those files when you are satisfied that your\n' + 'repository is still sane. ' + 'Running \'hg verify\' is strongly recommended.)\n') + % (oldindexfn, olddatafn)) cmdtable = { 'shrink': (shrink, - [('', 'revlog', '', - _('the revlog to shrink (.i)')), - ('n', 'dry-run', None, - _('do not shrink, simulate only')), - ('', 'sort', 'reversepostorder', - _('name of sort algorithm to use')), + [('', 'revlog', '', _('index (.i) file of the revlog to shrink')), + ('n', 'dry-run', None, _('do not shrink, simulate only')), + ('', 'sort', 'reversepostorder', 'name of sort algorithm to use'), ], _('hg shrink [--revlog PATH]')) } diff --git a/contrib/win32/ReadMe.html b/contrib/win32/ReadMe.html index d5d30cc..c777211 100644 --- a/contrib/win32/ReadMe.html +++ b/contrib/win32/ReadMe.html @@ -140,7 +140,7 @@ editor = whatever

- Mercurial is Copyright 2005-2012 Matt Mackall and others. See + Mercurial is Copyright 2005-2010 Matt Mackall and others. See the Contributors.txt file for a list of contributors.

diff --git a/contrib/win32/hgwebdir_wsgi.py b/contrib/win32/hgwebdir_wsgi.py index efa866e..b82678e 100644 --- a/contrib/win32/hgwebdir_wsgi.py +++ b/contrib/win32/hgwebdir_wsgi.py @@ -50,7 +50,7 @@ import sys #sys.path.insert(0, r'c:\path\to\python\lib') # Enable tracing. Run 'python -m win32traceutil' to debug -if getattr(sys, 'isapidllhandle', None) is not None: +if hasattr(sys, 'isapidllhandle'): import win32traceutil # To serve pages in local charset instead of UTF-8, remove the two lines below diff --git a/contrib/win32/mercurial.ini b/contrib/win32/mercurial.ini index b8eac56..db81645 100644 --- a/contrib/win32/mercurial.ini +++ b/contrib/win32/mercurial.ini @@ -36,6 +36,7 @@ editor = notepad ; [extensions] ;acl = +;alias = ;bugzilla = ;children = ;churn = @@ -49,9 +50,7 @@ editor = notepad ;hgcia = ;hgk = ;highlight = -;histedit = ;interhg = -;largefiles = ;keyword = ;mq = ;notify = @@ -61,9 +60,6 @@ editor = notepad ;purge = ;rebase = ;record = -;relink = -;schemes = -;share = ;transplant = ;win32mbcs = ;zeroconf = @@ -75,7 +71,7 @@ editor = notepad ;cmd.bc3diff = C:\Program Files\Beyond Compare 3\BCompare.exe ;cmd.vdiff = C:\Progra~1\TortoiseSVN\bin\TortoiseMerge.exe ;cmd.vimdiff = gvim.exe -;opts.vimdiff = -f "+next" "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" +;opts.vimdiff = -f '+next' '+execute "DirDiff ".argv(0)." ".argv(1)' [hgk] diff --git a/contrib/wix/COPYING.rtf b/contrib/wix/COPYING.rtf index 3174226..3418a97 100644 Binary files a/contrib/wix/COPYING.rtf and b/contrib/wix/COPYING.rtf differ diff --git a/contrib/wix/README.txt b/contrib/wix/README.txt index 8d9ec37..0e43807 100644 --- a/contrib/wix/README.txt +++ b/contrib/wix/README.txt @@ -7,7 +7,7 @@ are versioned within the Mercurial source tree because the WXS files must kept up to date with distribution changes within their branch. In other words, the default branch WXS files are expected to diverge from the stable branch WXS files. Storing them within the same repository is -the only sane way to keep the source tree and the installer in sync. +the only sane way to keep the the source tree and the installer in sync. The MSI installer builder uses only the mercurial.ini file from the contrib/win32 folder, the contents of which have been historically used diff --git a/contrib/wix/guids.wxi b/contrib/wix/guids.wxi index d4360a4..867ad27 100644 --- a/contrib/wix/guids.wxi +++ b/contrib/wix/guids.wxi @@ -18,13 +18,13 @@ - + - + - + diff --git a/contrib/wix/help.wxs b/contrib/wix/help.wxs index 601ecdc..7dc3dd4 100644 --- a/contrib/wix/help.wxs +++ b/contrib/wix/help.wxs @@ -20,7 +20,6 @@ - diff --git a/contrib/wix/i18n.wxs b/contrib/wix/i18n.wxs index 4c97ca4..60090cd 100644 --- a/contrib/wix/i18n.wxs +++ b/contrib/wix/i18n.wxs @@ -5,7 +5,7 @@ diff --git a/contrib/wix/templates.wxs b/contrib/wix/templates.wxs index ac2eacc..6b832a5 100644 --- a/contrib/wix/templates.wxs +++ b/contrib/wix/templates.wxs @@ -31,7 +31,6 @@ - diff --git a/contrib/zsh_completion b/contrib/zsh_completion index 6cbafb2..0490e16 100644 --- a/contrib/zsh_completion +++ b/contrib/zsh_completion @@ -165,7 +165,6 @@ _hg_revrange() { _hg_labels() { _hg_tags "$@" _hg_bookmarks "$@" - _hg_branches "$@" } _hg_tags() { @@ -192,17 +191,6 @@ _hg_bookmarks() { (( $#bookmarks )) && _describe -t bookmarks 'bookmarks' bookmarks } -_hg_branches() { - typeset -a branches - local branch - - _hg_cmd branches | while read branch - do - branches+=(${branch/ # [0-9]#:*}) - done - (( $#branches )) && _describe -t branches 'branches' branches -} - # likely merge candidates _hg_mergerevs() { typeset -a heads @@ -514,7 +502,6 @@ _hg_cmd_commit() { '(--logfile -l)'{-l+,--logfile}'[read commit message from ]:log file:_files -g \*.txt' \ '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ - '--amend[amend the parent of the working dir]' \ '*:file:_hg_files' } @@ -553,20 +540,6 @@ _hg_cmd_export() { '*:revision:_hg_labels' } -_hg_cmd_graft() { - _arguments -s -w : $_hg_global_opts \ - '(--continue -c)'{-c,--continue}'[resume interrupted graft]' \ - '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \ - '--log[append graft info to log message]' \ - '(--currentdate -D)'{-D,--currentdate}'[record the current date as commit date]' \ - '(--currentuser -U)'{-U,--currentuser}'[record the current user as committer]' \ - '(--date -d)'{-d,--date}'[record the specified date as commit date]' \ - '(--user -u)'{-u,--user}'[record the specified user as committer]' \ - '(--tool -t)'{-t,--tool}'[specify merge tool]' \ - '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]' \ - '*:revision:_hg_labels' -} - _hg_cmd_grep() { _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \ @@ -605,7 +578,6 @@ _hg_cmd_import() { '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \ '(--message -m)'{-m+,--message}'[use as commit message]:text:' \ '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \ - '--bypass[apply patch without touching the working directory]' \ '*:patch:_files' } @@ -645,13 +617,11 @@ _hg_cmd_log() { '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \ '(--patch -p)'{-p,--patch}'[show patch]' \ '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_labels' \ - '(--branch -b)'{-b+,--branch}'[show changesets within the given named branch]:branch:_hg_branches' \ '*:files:_hg_files' } _hg_cmd_manifest() { _arguments -s -w : $_hg_global_opts \ - '--all[list files from all revisions]' \ ':revision:_hg_labels' } @@ -660,7 +630,6 @@ _hg_cmd_merge() { '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \ '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_mergerevs' \ '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \ - '(--tool -t)'{-t,--tool}'[specify merge tool]' \ ':revision:_hg_mergerevs' } @@ -685,16 +654,6 @@ _hg_cmd_paths() { ':path:_hg_paths' } -_hg_cmd_phase() { - _arguments -s -w : $_hg_global_opts \ - '(--public -p)'{-p,--public}'[set changeset phase to public]' \ - '(--draft -d)'{-d,--draft}'[set changeset phase to draft]' \ - '(--secret -s)'{-s,--secret}'[set changeset phase to secret]' \ - '(--force -f)'{-f,--force}'[allow to move boundary backward]' \ - '(--rev -r)'{-r+,--rev}'[target revision]:revision:_hg_labels' \ - ':revision:_hg_labels' -} - _hg_cmd_pull() { _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ @@ -748,7 +707,7 @@ _hg_cmd_revert() { _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \ '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_labels' \ - '(--no-backup -C)'{-C,--no-backup}'[do not save backup copies of files]' \ + '--no-backup[do not save backup copies of files]' \ '*:file:->diff_files' if [[ $state == 'diff_files' ]] @@ -908,12 +867,6 @@ _hg_cmd_qdiff() { '*:pattern:_hg_files' } -_hg_cmd_qfinish() { - _arguments -s -w : $_hg_global_opts \ - '(--applied -a)'{-a,--applied}'[finish all applied patches]' \ - '*:patch:_hg_qapplied' -} - _hg_cmd_qfold() { _arguments -s -w : $_hg_global_opts $_h_commit_opts \ '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \ @@ -977,7 +930,6 @@ _hg_cmd_qpush() { '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \ '(--name -n)'{-n+,--name}'[merge queue name]:' \ '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \ - '(--exact -e)'{-e,--exact}'[apply the target patch to its recorded parent]' \ '--move[reorder patch series and apply only the patch]' \ ':patch:_hg_qunapplied' } @@ -1030,7 +982,6 @@ _hg_cmd_email() { _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ '(--git -g)'{-g,--git}'[use git extended diff format]' \ '--plain[omit hg patch header]' \ - '--body[send patches as inline message text (default)]' \ '(--outgoing -o)'{-o,--outgoing}'[send changes not found in the target repository]' \ '(--bundle -b)'{-b,--bundle}'[send changes not in target as a binary bundle]' \ '--bundlename[name of the bundle attachment file (default: bundle)]:' \ @@ -1056,22 +1007,4 @@ _hg_cmd_email() { ':revision:_hg_revrange' } -# Rebase -_hg_cmd_rebase() { - _arguments -s -w : $_hg_global_opts \ - '*'{-r,--rev}'[rebase these revisions]:revision:_hg_revrange' \ - '(--source -s)'{-s,--source}'[rebase from the specified changeset]:revision:_hg_labels' \ - '(--base -b)'{-b,--base}'[rebase from the base of the specified changeset]:revision:_hg_labels' \ - '(--dest -d)'{-d,--dest}'[rebase onto the specified changeset]' \ - '--collapse[collapse the rebased changeset]' \ - '(--message -m)'{-m+,--message}'[use as collapse commit message]:text:' \ - '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \ - '(--logfile -l)'{-l+,--logfile}'[read collapse commit message from ]:log file:_files -g \*.txt' \ - '--keep[keep original changeset]' \ - '--keepbranches[keep original branch name]' \ - '(--tool -t)'{-t,--tool}'[specify merge tool]' \ - '(--continue -c)'{-c,--continue}'[continue an interrupted rebase]' \ - '(--abort -a)'{-a,--abort}'[abort an interrupted rebase]' \ -} - _hg "$@" -- cgit v1.2.1