# HG changeset patch # User Jens Bäckman # Date 1271696342 -7200 # Node ID 5172261b92af5ee12b67af995500a6ca34fc567b # Parent 5f10634f9e68873eade54bc0a5408ee9e26b55d8# Parent 8227a631c6b417bb5997f20d8107af928c557235 Merge with stable diff -r 8227a631c6b4 -r 5172261b92af contrib/check-code.py --- a/contrib/check-code.py Mon Apr 19 18:57:16 2010 +0200 +++ b/contrib/check-code.py Mon Apr 19 18:59:02 2010 +0200 @@ -7,12 +7,19 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import sys, re, glob +import re, glob +import optparse def repquote(m): - t = re.sub(r"\w", "x", m.group(2)) + t = re.sub(r"\w", "x", m.group('text')) t = re.sub(r"[^\sx]", "o", t) - return m.group(1) + t + m.group(1) + return m.group('quote') + t + m.group('quote') + +def reppython(m): + comment = m.group('comment') + if comment: + return "#" * len(comment) + return repquote(m) def repcomment(m): return m.group(1) + "#" * len(m.group(2)) @@ -84,6 +91,7 @@ (r'[\x80-\xff]', "non-ASCII character literal"), (r'("\')\.format\(', "str.format() not available in Python 2.4"), (r'^\s*with\s+', "with not available in Python 2.4"), + (r'^\s*(any|all)\(', "any/all not available in Python 2.4"), (r'if\s.*\selse', "if ... else form not available in Python 2.4"), (r'([\(\[]\s\S)|(\S\s[\)\]])', "gratuitous whitespace in () or []"), # (r'\s\s=', "gratuitous whitespace before ="), @@ -92,15 +100,15 @@ (r'\s(\+=|-=|!=|<>|<=|>=|<<=|>>=)\S', "missing whitespace around operator"), (r'[^+=*!<>&| -](\s=|=\s)[^= ]', "wrong whitespace around ="), (r'raise Exception', "don't raise generic exceptions"), - (r'ui\.(status|progress|write|note)\([\'\"]x', "unwrapped ui message"), + (r'ui\.(status|progress|write|note)\([\'\"]x', + "warning: unwrapped ui message"), ] pyfilters = [ - (r"""(''')(([^']|\\'|'{1,2}(?!'))*)'''""", repquote), - (r'''(""")(([^"]|\\"|"{1,2}(?!"))*)"""''', repquote), - (r'''(?\#.*?$)| + ((?P('''|\"\"\"|(?(([^\\]|\\.)*?)) + (?P=quote))""", reppython), ] cpats = [ @@ -123,7 +131,7 @@ cfilters = [ (r'(/\*)(((\*(?!/))|[^*])*)\*/', repccomment), - (r'''(?(?([^"]|\\")+)"(?!")''', repquote), (r'''(#\s*include\s+<)([^>]+)>''', repinclude), (r'(\()([^)]+\))', repcallspaces), ] @@ -134,12 +142,42 @@ ('c', r'.*\.c$', cfilters, cpats), ] -if len(sys.argv) == 1: - check = glob.glob("*") -else: - check = sys.argv[1:] +class norepeatlogger(object): + def __init__(self): + self._lastseen = None + + def log(self, fname, lineno, line, msg): + """print error related a to given line of a given file. + + The faulty line will also be printed but only once in the case + of multiple errors. -for f in check: + :fname: filename + :lineno: line number + :line: actual content of the line + :msg: error message + """ + msgid = fname, lineno, line + if msgid != self._lastseen: + print "%s:%d:" % (fname, lineno) + print " > %s" % line + self._lastseen = msgid + print " " + msg + +_defaultlogger = norepeatlogger() + +def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False): + """checks style and portability of a given file + + :f: filepath + :logfunc: function used to report error + logfunc(filename, linenumber, linecontent, errormessage) + :maxerr: number of error to display before arborting. + Set to None (default) to report all errors + + return True if no error is found, False otherwise. + """ + result = True for name, match, filters, pats in checks: fc = 0 if not re.match(match, f): @@ -154,16 +192,34 @@ for n, l in z: if "check-code" + "-ignore" in l[0]: continue - lc = 0 for p, msg in pats: + if not warnings and msg.startswith("warning"): + continue if re.search(p, l[1]): - if not lc: - print "%s:%d:" % (f, n + 1) - print " > %s" % l[0] - print " %s" % msg - lc += 1 + logfunc(f, n + 1, l[0], msg) fc += 1 - if fc == 15: + result = False + if maxerr is not None and fc >= maxerr: print " (too many errors, giving up)" break break + return result + + +if __name__ == "__main__": + parser = optparse.OptionParser("%prog [options] [files]") + parser.add_option("-w", "--warnings", action="store_true", + help="include warning-level checks") + parser.add_option("-p", "--per-file", type="int", + help="max warnings per file") + + parser.set_defaults(per_file=15, warnings=False) + (options, args) = parser.parse_args() + + if len(args) == 0: + check = glob.glob("*") + else: + check = args + + for f in check: + checkfile(f, maxerr=options.per_file, warnings=options.warnings) diff -r 8227a631c6b4 -r 5172261b92af contrib/git-viz/git-cat-file --- a/contrib/git-viz/git-cat-file Mon Apr 19 18:57:16 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -#!/bin/sh - -op=`basename $0 | sed -e 's/^git-//'` -exec hgit $op "$@" - diff -r 8227a631c6b4 -r 5172261b92af contrib/git-viz/git-diff-tree --- a/contrib/git-viz/git-diff-tree Mon Apr 19 18:57:16 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -#!/bin/sh - -op=`basename $0 | sed -e 's/^git-//'` -exec hgit $op "$@" - diff -r 8227a631c6b4 -r 5172261b92af contrib/git-viz/git-rev-list --- a/contrib/git-viz/git-rev-list Mon Apr 19 18:57:16 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -#!/bin/sh - -op=`basename $0 | sed -e 's/^git-//'` -exec hgit $op "$@" - diff -r 8227a631c6b4 -r 5172261b92af contrib/git-viz/git-rev-tree --- a/contrib/git-viz/git-rev-tree Mon Apr 19 18:57:16 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -#!/bin/sh - -op=`basename $0 | sed -e 's/^git-//'` -exec hgit $op "$@" - diff -r 8227a631c6b4 -r 5172261b92af contrib/git-viz/hg-viz --- a/contrib/git-viz/hg-viz Mon Apr 19 18:57:16 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -#!/bin/sh - -set -e - -if test x"$1" != x ; then - cd $1 -fi - -if [ ! -d ".hg" ]; then - echo "${1:-.} is not a mercurial repository" 1>&2 - echo "Aborting" 1>&2 - exit 1 -fi -if [ ! -d ".git" ]; then - mkdir -v ".git" -fi -if [ -e ".git/HEAD" ]; then - if [ ! -e ".git/HEAD.hg-viz-save" ]; then - mv -v ".git/HEAD" ".git/HEAD.hg-viz-save" - else - rm -vf ".git/HEAD" - fi -fi -hg history | head -1 | awk -F: '{print $3}' > .git/HEAD -git-viz - diff -r 8227a631c6b4 -r 5172261b92af contrib/hgdiff --- a/contrib/hgdiff Mon Apr 19 18:57:16 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -#!/usr/bin/env python - -import os, sys, struct, stat -import difflib -import re -from optparse import OptionParser -from mercurial.bdiff import bdiff, blocks -from mercurial.mdiff import bunidiff, diffopts - -VERSION="0.3" -usage = "usage: %prog [options] file1 file2" -parser = OptionParser(usage=usage) - -parser.add_option("-d", "--difflib", action="store_true", default=False) -parser.add_option('-x', '--count', default=1) -parser.add_option('-c', '--context', type="int", default=3) -parser.add_option('-p', '--show-c-function', action="store_true", default=False) -parser.add_option('-w', '--ignore-all-space', action="store_true", - default=False) - -(options, args) = parser.parse_args() - -if not args: - parser.print_help() - sys.exit(1) - -# simple utility function to put all the -# files from a directory tree into a dict -def buildlist(names, top): - tlen = len(top) - for root, dirs, files in os.walk(top): - l = root[tlen + 1:] - for x in files: - p = os.path.join(root, x) - st = os.lstat(p) - if stat.S_ISREG(st.st_mode): - names[os.path.join(l, x)] = (st.st_dev, st.st_ino) - -def diff_files(file1, file2): - if file1 is None: - b = file(file2).read().splitlines(True) - l1 = "--- %s\n" % (file2) - l2 = "+++ %s\n" % (file2) - l3 = "@@ -0,0 +1,%d @@\n" % len(b) - l = [l1, l2, l3] + ["+" + e for e in b] - elif file2 is None: - a = file(file1).read().splitlines(True) - l1 = "--- %s\n" % (file1) - l2 = "+++ %s\n" % (file1) - l3 = "@@ -1,%d +0,0 @@\n" % len(a) - l = [l1, l2, l3] + ["-" + e for e in a] - else: - t1 = file(file1).read() - t2 = file(file2).read() - l1 = t1.splitlines(True) - l2 = t2.splitlines(True) - if options.difflib: - l = difflib.unified_diff(l1, l2, file1, file2) - else: - l = bunidiff(t1, t2, l1, l2, file1, file2, - diffopts(context=options.context, - showfunc=options.show_c_function, - ignorews=options.ignore_all_space)) - for x in l: - if x[-1] != '\n': - x += "\n\ No newline at end of file\n" - print x, - -file1 = args[0] -file2 = args[1] - -if os.path.isfile(file1) and os.path.isfile(file2): - diff_files(file1, file2) -elif os.path.isdir(file1): - if not os.path.isdir(file2): - sys.stderr.write("file types don't match\n") - sys.exit(1) - - d1 = {} - d2 = {} - - buildlist(d1, file1) - buildlist(d2, file2) - keys = d1.keys() - keys.sort() - for x in keys: - if x not in d2: - f2 = None - else: - f2 = os.path.join(file2, x) - st1 = d1[x] - st2 = d2[x] - del d2[x] - if st1[0] == st2[0] and st1[1] == st2[1]: - sys.stderr.write("%s is a hard link\n" % x) - continue - x = os.path.join(file1, x) - diff_files(x, f2) - keys = d2.keys() - keys.sort() - for x in keys: - f1 = None - x = os.path.join(file2, x) - diff_files(f1, x) - diff -r 8227a631c6b4 -r 5172261b92af contrib/logo-droplets.svg --- a/contrib/logo-droplets.svg Mon Apr 19 18:57:16 2010 +0200 +++ b/contrib/logo-droplets.svg Mon Apr 19 18:59:02 2010 +0200 @@ -1,624 +1,5 @@ -image/svg+xmlMercurial "droplets" logoCali Mastny and Matt MackallFeb 12 2008 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file +image/svg+xmlMercurial "droplets" logoCali Mastny and Matt MackallFeb 12 2008 + + diff -r 8227a631c6b4 -r 5172261b92af contrib/rewrite-log --- a/contrib/rewrite-log Mon Apr 19 18:57:16 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -#!/usr/bin/env python -import sys, os -from mercurial import revlog, transaction, node, util - -f = sys.argv[1] - -r1 = revlog.revlog(util.opener(os.getcwd(), audit=False), f + ".i", f + ".d") -r2 = revlog.revlog(util.opener(os.getcwd(), audit=False), f + ".i2", f + ".d2") - -tr = transaction.transaction(sys.stderr.write, open, "journal") - -for i in xrange(r1.count()): - n = r1.node(i) - p1, p2 = r1.parents(n) - l = r1.linkrev(n) - t = r1.revision(n) - n2 = r2.addrevision(t, tr, l, p1, p2) -tr.close() - -os.rename(f + ".i", f + ".i.old") -os.rename(f + ".d", f + ".d.old") -os.rename(f + ".i2", f + ".i") -os.rename(f + ".d2", f + ".d") diff -r 8227a631c6b4 -r 5172261b92af contrib/shrink-revlog.py --- a/contrib/shrink-revlog.py Mon Apr 19 18:57:16 2010 +0200 +++ b/contrib/shrink-revlog.py Mon Apr 19 18:59:02 2010 +0200 @@ -24,50 +24,81 @@ from mercurial import changegroup from mercurial.i18n import _ -def toposort(ui, rl): + +def postorder(start, edges): + result = [] + visit = list(start) + finished = set() - children = {} - root = [] - # build children and roots + while visit: + cur = visit[-1] + for p in edges[cur]: + if p not in finished: + visit.append(p) + break + else: + result.append(cur) + finished.add(cur) + visit.pop() + + return result + +def toposort_reversepostorder(ui, rl): + # postorder of the reverse directed graph + + # map rev to list of parent revs (p2 first) + parents = {} + heads = set() ui.status(_('reading revs\n')) try: - for i in rl: - ui.progress(_('reading'), i, total=len(rl)) - children[i] = [] - parents = [p for p in rl.parentrevs(i) if p != node.nullrev] - # in case of duplicate parents - if len(parents) == 2 and parents[0] == parents[1]: - del parents[1] - for p in parents: - assert p in children - children[p].append(i) + for rev in rl: + ui.progress(_('reading'), rev, total=len(rl)) + (p1, p2) = rl.parentrevs(rev) + if p1 == p2 == node.nullrev: + parents[rev] = () # root node + elif p1 == p2 or p2 == node.nullrev: + parents[rev] = (p1,) # normal node + else: + parents[rev] = (p2, p1) # merge node + heads.add(rev) + for p in parents[rev]: + heads.discard(p) + finally: + ui.progress(_('reading'), None) - if len(parents) == 0: - root.append(i) - finally: - ui.progress(_('reading'), None, total=len(rl)) + heads = list(heads) + heads.sort(reverse=True) + + ui.status(_('sorting revs\n')) + return postorder(heads, parents) + +def toposort_postorderreverse(ui, rl): + # reverse-postorder of the reverse directed graph - # XXX this is a reimplementation of the 'branchsort' topo sort - # algorithm in hgext.convert.convcmd... would be nice not to duplicate - # the algorithm + children = {} + roots = set() + ui.status(_('reading revs\n')) + try: + for rev in rl: + ui.progress(_('reading'), rev, total=len(rl)) + (p1, p2) = rl.parentrevs(rev) + if p1 == p2 == node.nullrev: + roots.add(rev) + children[rev] = [] + if p1 != node.nullrev: + children[p1].append(rev) + if p2 != node.nullrev: + children[p2].append(rev) + finally: + ui.progress(_('reading'), None) + + root = list(roots) + roots.sort() + ui.status(_('sorting revs\n')) - visit = root - ret = [] - while visit: - i = visit.pop(0) - ret.append(i) - if i not in children: - # This only happens if some node's p1 == p2, which can - # happen in the manifest in certain circumstances. - continue - next = [] - for c in children.pop(i): - parents_unseen = [p for p in rl.parentrevs(c) - if p != node.nullrev and p in children] - if len(parents_unseen) == 0: - next.append(c) - visit = next + visit - return ret + result = postorder(roots, children) + result.reverse() + return result def writerevs(ui, r1, r2, order, tr): @@ -89,7 +120,7 @@ chunkiter = changegroup.chunkiter(group) r2.addgroup(chunkiter, unlookup, tr) finally: - ui.progress(_('writing'), None, len(order)) + ui.progress(_('writing'), None) def report(ui, r1, r2): def getsize(r): @@ -118,9 +149,15 @@ % (shrink_percent, shrink_factor)) def shrink(ui, repo, **opts): + """shrink a revlog by reordering revisions + + Rewrites all the entries in some revlog of the current repository + (by default, the manifest log) to save space. + + Different sort algorithms have different performance + characteristics. Use ``--sort`` to select a sort algorithm so you + can determine which works best for your data. """ - Shrink revlog by re-ordering revisions. Will operate on manifest for - the given repository if no other revlog is specified.""" if not repo.local(): raise util.Abort(_('not a local repository: %s') % repo.root) @@ -139,6 +176,12 @@ raise util.Abort(_('--revlog option must specify a revlog in %s, ' 'not %s') % (store, indexfn)) + sortname = opts['sort'] + try: + toposort = globals()['toposort_' + sortname] + except KeyError: + raise util.Abort(_('no such toposort algorithm: %s') % sortname) + if not os.path.exists(indexfn): raise util.Abort(_('no such file: %s') % indexfn) if '00changelog' in indexfn: @@ -187,6 +230,15 @@ try: try: order = toposort(ui, r1) + + suboptimal = 0 + for i in xrange(1, len(order)): + parents = [p for p in r1.parentrevs(order[i]) + if p != node.nullrev] + if parents and order[i - 1] not in parents: + suboptimal += 1 + ui.note(_('%d suboptimal nodes\n') % suboptimal) + writerevs(ui, r1, r2, order, tr) report(ui, r1, r2) tr.close() @@ -229,6 +281,7 @@ 'shrink': (shrink, [('', '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 -r 8227a631c6b4 -r 5172261b92af contrib/wix/contrib.wxs --- a/contrib/wix/contrib.wxs Mon Apr 19 18:57:16 2010 +0200 +++ b/contrib/wix/contrib.wxs Mon Apr 19 18:59:02 2010 +0200 @@ -1,218 +1,42 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 8227a631c6b4 -r 5172261b92af contrib/wix/doc.wxs --- a/contrib/wix/doc.wxs Mon Apr 19 18:57:16 2010 +0200 +++ b/contrib/wix/doc.wxs Mon Apr 19 18:59:02 2010 +0200 @@ -1,33 +1,49 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 8227a631c6b4 -r 5172261b92af contrib/wix/guids.wxi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/wix/guids.wxi Mon Apr 19 18:59:02 2010 +0200 @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 8227a631c6b4 -r 5172261b92af contrib/wix/help.wxs --- a/contrib/wix/help.wxs Mon Apr 19 18:57:16 2010 +0200 +++ b/contrib/wix/help.wxs Mon Apr 19 18:59:02 2010 +0200 @@ -1,72 +1,25 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff -r 8227a631c6b4 -r 5172261b92af contrib/wix/i18n.wxs --- a/contrib/wix/i18n.wxs Mon Apr 19 18:57:16 2010 +0200 +++ b/contrib/wix/i18n.wxs Mon Apr 19 18:59:02 2010 +0200 @@ -1,78 +1,25 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff -r 8227a631c6b4 -r 5172261b92af contrib/wix/locale.wxs --- a/contrib/wix/locale.wxs Mon Apr 19 18:57:16 2010 +0200 +++ b/contrib/wix/locale.wxs Mon Apr 19 18:59:02 2010 +0200 @@ -1,172 +1,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 8227a631c6b4 -r 5172261b92af contrib/wix/mercurial.wxs --- a/contrib/wix/mercurial.wxs Mon Apr 19 18:57:16 2010 +0200 +++ b/contrib/wix/mercurial.wxs Mon Apr 19 18:59:02 2010 +0200 @@ -6,24 +6,31 @@ This software may be used and distributed according to the terms of the GNU General Public License version 2 or any later version. --> - - + - + Language='1033' Codepage='1252' Version='$(var.Version)' + Manufacturer='Matt Mackall and others'> - - + - VersionNT >= 501 + VersionNT >= 501 - + @@ -37,30 +44,35 @@ amus + + 1 + - - - + + + - - + + - - + + - - + + - - + + @@ -68,17 +80,16 @@ - + - + - - + - + diff -r 8227a631c6b4 -r 5172261b92af contrib/wix/templates.wxs --- a/contrib/wix/templates.wxs Mon Apr 19 18:57:16 2010 +0200 +++ b/contrib/wix/templates.wxs Mon Apr 19 18:59:02 2010 +0200 @@ -1,801 +1,206 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 8227a631c6b4 -r 5172261b92af doc/rst2man.py --- a/doc/rst2man.py Mon Apr 19 18:57:16 2010 +0200 +++ b/doc/rst2man.py Mon Apr 19 18:59:02 2010 +0200 @@ -45,14 +45,9 @@ __docformat__ = 'reStructuredText' -import sys -import os -import time import re -from types import ListType -import docutils -from docutils import nodes, utils, writers, languages +from docutils import nodes, writers, languages import roman FIELD_LIST_INDENT = 7 diff -r 8227a631c6b4 -r 5172261b92af hgext/bookmarks.py --- a/hgext/bookmarks.py Mon Apr 19 18:57:16 2010 +0200 +++ b/hgext/bookmarks.py Mon Apr 19 18:59:02 2010 +0200 @@ -152,15 +152,22 @@ for bmark, n in marks.iteritems(): if ui.configbool('bookmarks', 'track.current'): current = repo._bookmarkcurrent - prefix = (bmark == current and n == cur) and '*' or ' ' + if bmark == current and n == cur: + prefix, label = '*', 'bookmarks.current' + else: + prefix, label = ' ', '' else: - prefix = (n == cur) and '*' or ' ' + if n == cur: + prefix, label = '*', 'bookmarks.current' + else: + prefix, label = ' ', '' if ui.quiet: - ui.write("%s\n" % bmark) + ui.write("%s\n" % bmark, label=label) else: ui.write(" %s %-25s %d:%s\n" % ( - prefix, bmark, repo.changelog.rev(n), hexfn(n))) + prefix, bmark, repo.changelog.rev(n), hexfn(n)), + label=label) return def _revstostrip(changelog, node): @@ -234,10 +241,10 @@ file.close() return mark - def rollback(self): + def rollback(self, *args): if os.path.exists(self.join('undo.bookmarks')): util.rename(self.join('undo.bookmarks'), self.join('bookmarks')) - return super(bookmark_repo, self).rollback() + return super(bookmark_repo, self).rollback(*args) def lookup(self, key): if key in self._bookmarks: @@ -332,3 +339,5 @@ ('m', 'rename', '', _('rename a given bookmark'))], _('hg bookmarks [-f] [-d] [-m NAME] [-r REV] [NAME]')), } + +colortable = {'bookmarks.current': 'green'} diff -r 8227a631c6b4 -r 5172261b92af hgext/churn.py --- a/hgext/churn.py Mon Apr 19 18:57:16 2010 +0200 +++ b/hgext/churn.py Mon Apr 19 18:59:02 2010 +0200 @@ -10,7 +10,7 @@ from mercurial.i18n import _ from mercurial import patch, cmdutil, util, templater -import sys, os +import os import time, datetime def maketemplater(ui, repo, tmpl): @@ -48,7 +48,7 @@ tmpl.show(ctx) return ui.popbuffer() - state = {'count': 0, 'pct': 0} + state = {'count': 0} rate = {} df = False if opts.get('date'): @@ -74,20 +74,13 @@ lines = changedlines(ui, repo, ctx1, ctx, fns) rate[key] = [r + l for r, l in zip(rate.get(key, (0, 0)), lines)] - if opts.get('progress'): - state['count'] += 1 - newpct = int(100.0 * state['count'] / max(len(repo), 1)) - if state['pct'] < newpct: - state['pct'] = newpct - ui.write("\r" + _("generating stats: %d%%") % state['pct']) - sys.stdout.flush() + state['count'] += 1 + ui.progress(_('analyzing'), state['count'], total=len(repo)) for ctx in cmdutil.walkchangerevs(repo, m, opts, prep): continue - if opts.get('progress'): - ui.write("\r") - sys.stdout.flush() + ui.progress(_('analyzing'), None) return rate @@ -160,8 +153,10 @@ def format(name, (added, removed)): return "%s %15s %s%s\n" % (pad(name, maxname), '+%d/-%d' % (added, removed), - '+' * charnum(added), - '-' * charnum(removed)) + ui.label('+' * charnum(added), + 'diffstat.inserted'), + ui.label('-' * charnum(removed), + 'diffstat.deleted')) else: width -= 6 def format(name, count): @@ -188,6 +183,6 @@ ('s', 'sort', False, _('sort by key (default: sort by count)')), ('', 'diffstat', False, _('display added/removed lines separately')), ('', 'aliases', '', _('file with email aliases')), - ('', 'progress', None, _('show progress'))], - _("hg churn [-d DATE] [-r REV] [--aliases FILE] [--progress] [FILE]")), + ], + _("hg churn [-d DATE] [-r REV] [--aliases FILE] [FILE]")), } diff -r 8227a631c6b4 -r 5172261b92af hgext/color.py --- a/hgext/color.py Mon Apr 19 18:57:16 2010 +0200 +++ b/hgext/color.py Mon Apr 19 18:59:02 2010 +0200 @@ -61,314 +61,218 @@ resolve.resolved = green bold bookmarks.current = green + +The color extension will try to detect whether to use ANSI codes or +Win32 console APIs, unless it is made explicit:: + + [color] + mode = ansi + +Any value other than 'ansi', 'win32', or 'auto' will disable color. + ''' import os, sys -from mercurial import cmdutil, commands, extensions +from mercurial import commands, dispatch, extensions from mercurial.i18n import _ # start and stop parameters for effects -_effect_params = {'none': 0, - 'black': 30, - 'red': 31, - 'green': 32, - 'yellow': 33, - 'blue': 34, - 'magenta': 35, - 'cyan': 36, - 'white': 37, - 'bold': 1, - 'italic': 3, - 'underline': 4, - 'inverse': 7, - 'black_background': 40, - 'red_background': 41, - 'green_background': 42, - 'yellow_background': 43, - 'blue_background': 44, - 'purple_background': 45, - 'cyan_background': 46, - 'white_background': 47} +_effects = {'none': 0, 'black': 30, 'red': 31, 'green': 32, 'yellow': 33, + 'blue': 34, 'magenta': 35, 'cyan': 36, 'white': 37, 'bold': 1, + 'italic': 3, 'underline': 4, 'inverse': 7, + 'black_background': 40, 'red_background': 41, + 'green_background': 42, 'yellow_background': 43, + 'blue_background': 44, 'purple_background': 45, + 'cyan_background': 46, 'white_background': 47} + +_styles = {'grep.match': 'red bold', + 'diff.changed': 'white', + 'diff.deleted': 'red', + 'diff.diffline': 'bold', + 'diff.extended': 'cyan bold', + 'diff.file_a': 'red bold', + 'diff.file_b': 'green bold', + 'diff.hunk': 'magenta', + 'diff.inserted': 'green', + 'diff.trailingwhitespace': 'bold red_background', + 'diffstat.deleted': 'red', + 'diffstat.inserted': 'green', + 'log.changeset': 'yellow', + 'resolve.resolved': 'green bold', + 'resolve.unresolved': 'red bold', + 'status.added': 'green bold', + 'status.clean': 'none', + 'status.copied': 'none', + 'status.deleted': 'cyan bold underline', + 'status.ignored': 'black bold', + 'status.modified': 'blue bold', + 'status.removed': 'red bold', + 'status.unknown': 'magenta bold underline'} + def render_effects(text, effects): 'Wrap text in commands to turn on each effect.' - start = [str(_effect_params[e]) for e in ['none'] + effects] + if not text: + return text + start = [str(_effects[e]) for e in ['none'] + effects.split()] start = '\033[' + ';'.join(start) + 'm' - stop = '\033[' + str(_effect_params['none']) + 'm' + stop = '\033[' + str(_effects['none']) + 'm' return ''.join([start, text, stop]) -def _colorstatuslike(abbreviations, effectdefs, orig, ui, repo, *pats, **opts): - '''run a status-like command with colorized output''' - delimiter = opts.get('print0') and '\0' or '\n' - - nostatus = opts.get('no_status') - opts['no_status'] = False - # run original command and capture its output - ui.pushbuffer() - retval = orig(ui, repo, *pats, **opts) - # filter out empty strings - lines_with_status = [line for line in ui.popbuffer().split(delimiter) if line] - - if nostatus: - lines = [l[2:] for l in lines_with_status] - else: - lines = lines_with_status - - # apply color to output and display it - for i in xrange(len(lines)): - try: - status = abbreviations[lines_with_status[i][0]] - except KeyError: - # Ignore lines with invalid codes, especially in the case of - # of unknown filenames containing newlines (issue2036). - pass - else: - effects = effectdefs[status] - if effects: - lines[i] = render_effects(lines[i], effects) - ui.write(lines[i] + delimiter) - return retval - - -_status_abbreviations = { 'M': 'modified', - 'A': 'added', - 'R': 'removed', - '!': 'deleted', - '?': 'unknown', - 'I': 'ignored', - 'C': 'clean', - ' ': 'copied', } - -_status_effects = { 'modified': ['blue', 'bold'], - 'added': ['green', 'bold'], - 'removed': ['red', 'bold'], - 'deleted': ['cyan', 'bold', 'underline'], - 'unknown': ['magenta', 'bold', 'underline'], - 'ignored': ['black', 'bold'], - 'clean': ['none'], - 'copied': ['none'], } - -def colorstatus(orig, ui, repo, *pats, **opts): - '''run the status command with colored output''' - return _colorstatuslike(_status_abbreviations, _status_effects, - orig, ui, repo, *pats, **opts) - - -_resolve_abbreviations = { 'U': 'unresolved', - 'R': 'resolved', } - -_resolve_effects = { 'unresolved': ['red', 'bold'], - 'resolved': ['green', 'bold'], } - -def colorresolve(orig, ui, repo, *pats, **opts): - '''run the resolve command with colored output''' - if not opts.get('list'): - # only colorize for resolve -l - return orig(ui, repo, *pats, **opts) - return _colorstatuslike(_resolve_abbreviations, _resolve_effects, - orig, ui, repo, *pats, **opts) - - -_bookmark_effects = { 'current': ['green'] } - -def colorbookmarks(orig, ui, repo, *pats, **opts): - def colorize(orig, s): - lines = s.split('\n') - for i, line in enumerate(lines): - if line.startswith(" *"): - lines[i] = render_effects(line, _bookmark_effects['current']) - orig('\n'.join(lines)) - oldwrite = extensions.wrapfunction(ui, 'write', colorize) - try: - orig(ui, repo, *pats, **opts) - finally: - ui.write = oldwrite - -def colorqseries(orig, ui, repo, *dummy, **opts): - '''run the qseries command with colored output''' - ui.pushbuffer() - retval = orig(ui, repo, **opts) - patchlines = ui.popbuffer().splitlines() - patchnames = repo.mq.series - - for patch, patchname in zip(patchlines, patchnames): - if opts['missing']: - effects = _patch_effects['missing'] - # Determine if patch is applied. - elif [applied for applied in repo.mq.applied - if patchname == applied.name]: - effects = _patch_effects['applied'] - else: - effects = _patch_effects['unapplied'] - - patch = patch.replace(patchname, render_effects(patchname, effects), 1) - ui.write(patch + '\n') - return retval - -_patch_effects = { 'applied': ['blue', 'bold', 'underline'], - 'missing': ['red', 'bold'], - 'unapplied': ['black', 'bold'], } -def colorwrap(orig, *args): - '''wrap ui.write for colored diff output''' - def _colorize(s): - lines = s.split('\n') - for i, line in enumerate(lines): - stripline = line - if line and line[0] in '+-': - # highlight trailing whitespace, but only in changed lines - stripline = line.rstrip() - for prefix, style in _diff_prefixes: - if stripline.startswith(prefix): - lines[i] = render_effects(stripline, _diff_effects[style]) - break - if line != stripline: - lines[i] += render_effects( - line[len(stripline):], _diff_effects['trailingwhitespace']) - return '\n'.join(lines) - orig(*[_colorize(s) for s in args]) +def extstyles(): + for name, ext in extensions.extensions(): + _styles.update(getattr(ext, 'colortable', {})) -def colorshowpatch(orig, self, node): - '''wrap cmdutil.changeset_printer.showpatch with colored output''' - oldwrite = extensions.wrapfunction(self.ui, 'write', colorwrap) - try: - orig(self, node) - finally: - self.ui.write = oldwrite - -def colordiffstat(orig, s): - lines = s.split('\n') - for i, line in enumerate(lines): - if line and line[-1] in '+-': - name, graph = line.rsplit(' ', 1) - graph = graph.replace('-', - render_effects('-', _diff_effects['deleted'])) - graph = graph.replace('+', - render_effects('+', _diff_effects['inserted'])) - lines[i] = ' '.join([name, graph]) - orig('\n'.join(lines)) - -def colordiff(orig, ui, repo, *pats, **opts): - '''run the diff command with colored output''' - if opts.get('stat'): - wrapper = colordiffstat - else: - wrapper = colorwrap - oldwrite = extensions.wrapfunction(ui, 'write', wrapper) - try: - orig(ui, repo, *pats, **opts) - finally: - ui.write = oldwrite - -def colorchurn(orig, ui, repo, *pats, **opts): - '''run the churn command with colored output''' - if not opts.get('diffstat'): - return orig(ui, repo, *pats, **opts) - oldwrite = extensions.wrapfunction(ui, 'write', colordiffstat) - try: - orig(ui, repo, *pats, **opts) - finally: - ui.write = oldwrite - -_diff_prefixes = [('diff', 'diffline'), - ('copy', 'extended'), - ('rename', 'extended'), - ('old', 'extended'), - ('new', 'extended'), - ('deleted', 'extended'), - ('---', 'file_a'), - ('+++', 'file_b'), - ('@', 'hunk'), - ('-', 'deleted'), - ('+', 'inserted')] - -_diff_effects = {'diffline': ['bold'], - 'extended': ['cyan', 'bold'], - 'file_a': ['red', 'bold'], - 'file_b': ['green', 'bold'], - 'hunk': ['magenta'], - 'deleted': ['red'], - 'inserted': ['green'], - 'changed': ['white'], - 'trailingwhitespace': ['bold', 'red_background']} - -def extsetup(ui): - '''Initialize the extension.''' - _setupcmd(ui, 'diff', commands.table, colordiff, _diff_effects) - _setupcmd(ui, 'incoming', commands.table, None, _diff_effects) - _setupcmd(ui, 'log', commands.table, None, _diff_effects) - _setupcmd(ui, 'outgoing', commands.table, None, _diff_effects) - _setupcmd(ui, 'tip', commands.table, None, _diff_effects) - _setupcmd(ui, 'status', commands.table, colorstatus, _status_effects) - _setupcmd(ui, 'resolve', commands.table, colorresolve, _resolve_effects) - - try: - mq = extensions.find('mq') - _setupcmd(ui, 'qdiff', mq.cmdtable, colordiff, _diff_effects) - _setupcmd(ui, 'qseries', mq.cmdtable, colorqseries, _patch_effects) - except KeyError: - mq = None - - try: - rec = extensions.find('record') - _setupcmd(ui, 'record', rec.cmdtable, colordiff, _diff_effects) - except KeyError: - rec = None - - if mq and rec: - _setupcmd(ui, 'qrecord', rec.cmdtable, colordiff, _diff_effects) - try: - churn = extensions.find('churn') - _setupcmd(ui, 'churn', churn.cmdtable, colorchurn, _diff_effects) - except KeyError: - churn = None - - try: - bookmarks = extensions.find('bookmarks') - _setupcmd(ui, 'bookmarks', bookmarks.cmdtable, colorbookmarks, - _bookmark_effects) - except KeyError: - # The bookmarks extension is not enabled - pass - -def _setupcmd(ui, cmd, table, func, effectsmap): - '''patch in command to command table and load effect map''' - def nocolor(orig, *args, **opts): - - if (opts['no_color'] or opts['color'] == 'never' or - (opts['color'] == 'auto' and (os.environ.get('TERM') == 'dumb' - or not sys.__stdout__.isatty()))): - del opts['no_color'] - del opts['color'] - return orig(*args, **opts) - - oldshowpatch = extensions.wrapfunction(cmdutil.changeset_printer, - 'showpatch', colorshowpatch) - del opts['no_color'] - del opts['color'] - try: - if func is not None: - return func(orig, *args, **opts) - return orig(*args, **opts) - finally: - cmdutil.changeset_printer.showpatch = oldshowpatch - - entry = extensions.wrapcommand(table, cmd, nocolor) - entry[1].extend([ - ('', 'color', 'auto', _("when to colorize (always, auto, or never)")), - ('', 'no-color', None, _("don't colorize output (DEPRECATED)")), - ]) - - for status in effectsmap: - configkey = cmd + '.' + status - effects = ui.configlist('color', configkey) - if effects: +def configstyles(ui): + for status, cfgeffects in ui.configitems('color'): + if '.' not in status: + continue + cfgeffects = ui.configlist('color', status) + if cfgeffects: good = [] - for e in effects: - if e in _effect_params: + for e in cfgeffects: + if e in _effects: good.append(e) else: ui.warn(_("ignoring unknown color/effect %r " "(configured in color.%s)\n") - % (e, configkey)) - effectsmap[status] = good + % (e, status)) + _styles[status] = ' '.join(good) + +_buffers = None +def style(msg, label): + effects = [] + for l in label.split(): + s = _styles.get(l, '') + if s: + effects.append(s) + effects = ''.join(effects) + if effects: + return '\n'.join([render_effects(s, effects) + for s in msg.split('\n')]) + return msg + +def popbuffer(orig, labeled=False): + global _buffers + if labeled: + return ''.join(style(a, label) for a, label in _buffers.pop()) + return ''.join(a for a, label in _buffers.pop()) + +mode = 'ansi' +def write(orig, *args, **opts): + label = opts.get('label', '') + global _buffers + if _buffers: + _buffers[-1].extend([(str(a), label) for a in args]) + elif mode == 'win32': + for a in args: + win32print(a, orig, **opts) + else: + return orig(*[style(str(a), label) for a in args], **opts) + +def write_err(orig, *args, **opts): + label = opts.get('label', '') + if mode == 'win32': + for a in args: + win32print(a, orig, **opts) + else: + return orig(*[style(str(a), label) for a in args], **opts) + +def uisetup(ui): + if ui.plain(): + return + global mode + mode = ui.config('color', 'mode', 'auto') + if mode == 'auto': + if os.name == 'nt' and 'TERM' not in os.environ: + # looks line a cmd.exe console, use win32 API or nothing + mode = w32effects and 'win32' or 'none' + else: + mode = 'ansi' + if mode == 'win32': + if w32effects is None: + # only warn if color.mode is explicitly set to win32 + ui.warn(_('win32console not found, please install pywin32\n')) + return + _effects.update(w32effects) + elif mode != 'ansi': + return + def colorcmd(orig, ui_, opts, cmd, cmdfunc): + if (opts['color'] == 'always' or + (opts['color'] == 'auto' and (os.environ.get('TERM') != 'dumb' + and sys.__stdout__.isatty()))): + global _buffers + _buffers = ui_._buffers + extensions.wrapfunction(ui_, 'popbuffer', popbuffer) + extensions.wrapfunction(ui_, 'write', write) + extensions.wrapfunction(ui_, 'write_err', write_err) + ui_.label = style + extstyles() + configstyles(ui) + return orig(ui_, opts, cmd, cmdfunc) + extensions.wrapfunction(dispatch, '_runcommand', colorcmd) + +commands.globalopts.append(('', 'color', 'auto', + _("when to colorize (always, auto, or never)"))) + +try: + import re + from win32console import * + + # http://msdn.microsoft.com/en-us/library/ms682088%28VS.85%29.aspx + w32effects = { + 'none': 0, + 'black': 0, + 'red': FOREGROUND_RED, + 'green': FOREGROUND_GREEN, + 'yellow': FOREGROUND_RED | FOREGROUND_GREEN, + 'blue': FOREGROUND_BLUE, + 'magenta': FOREGROUND_BLUE | FOREGROUND_RED, + 'cyan': FOREGROUND_BLUE | FOREGROUND_GREEN, + 'white': FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE, + 'bold': FOREGROUND_INTENSITY, + 'black_background': 0, + 'red_background': BACKGROUND_RED, + 'green_background': BACKGROUND_GREEN, + 'blue_background': BACKGROUND_BLUE, + 'cyan_background': BACKGROUND_BLUE | BACKGROUND_GREEN, + 'bold_background': FOREGROUND_INTENSITY, + 'underline': COMMON_LVB_UNDERSCORE, # double-byte charsets only + 'inverse': COMMON_LVB_REVERSE_VIDEO, # double-byte charsets only + } + + stdout = GetStdHandle(STD_OUTPUT_HANDLE) + origattr = stdout.GetConsoleScreenBufferInfo()['Attributes'] + ansire = re.compile('\033\[([^m]*)m([^\033]*)(.*)', re.MULTILINE | re.DOTALL) + + def win32print(text, orig, **opts): + label = opts.get('label', '') + attr = 0 + + # determine console attributes based on labels + for l in label.split(): + style = _styles.get(l, '') + for effect in style.split(): + attr |= w32effects[effect] + + # hack to ensure regexp finds data + if not text.startswith('\033['): + text = '\033[m' + text + + # Look for ANSI-like codes embedded in text + m = re.match(ansire, text) + while m: + for sattr in m.group(1).split(';'): + if sattr: + val = int(sattr) + attr = val and attr|val or 0 + stdout.SetConsoleTextAttribute(attr or origattr) + orig(m.group(2), **opts) + m = re.match(ansire, m.group(3)) + + # Explicity reset original attributes + stdout.SetConsoleTextAttribute(origattr) + +except ImportError: + w32effects = None diff -r 8227a631c6b4 -r 5172261b92af hgext/hgcia.py --- a/hgext/hgcia.py Mon Apr 19 18:57:16 2010 +0200 +++ b/hgext/hgcia.py Mon Apr 19 18:59:02 2010 +0200 @@ -113,7 +113,7 @@ n = self.ctx.node() pbuf = patchbuf() - patch.export(self.cia.repo, [n], fp=pbuf) + cmdutil.export(self.cia.repo, [n], fp=pbuf) return patch.diffstat(pbuf.lines) or '' def logmsg(self): diff -r 8227a631c6b4 -r 5172261b92af hgext/inotify/__init__.py --- a/hgext/inotify/__init__.py Mon Apr 19 18:57:16 2010 +0200 +++ b/hgext/inotify/__init__.py Mon Apr 19 18:59:02 2010 +0200 @@ -41,7 +41,7 @@ # to start an inotify server if it won't start. _inotifyon = True - def status(self, match, subrepos, ignored, clean, unknown=True): + def status(self, match, subrepos, ignored, clean, unknown): files = match.files() if '.' in files: files = [] diff -r 8227a631c6b4 -r 5172261b92af hgext/keyword.py --- a/hgext/keyword.py Mon Apr 19 18:57:16 2010 +0200 +++ b/hgext/keyword.py Mon Apr 19 18:59:02 2010 +0200 @@ -1,6 +1,6 @@ # keyword.py - $Keyword$ expansion for Mercurial # -# Copyright 2007-2009 Christian Ebert +# Copyright 2007-2010 Christian Ebert # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. @@ -79,7 +79,6 @@ from mercurial import commands, cmdutil, dispatch, filelog, revlog, extensions from mercurial import patch, localrepo, templater, templatefilters, util, match from mercurial.hgweb import webcommands -from mercurial.lock import release from mercurial.node import nullid from mercurial.i18n import _ import re, shutil, tempfile @@ -136,16 +135,16 @@ self.re_kw = re.compile(kwpat) templatefilters.filters['utcdate'] = utcdate - self.ct = cmdutil.changeset_templater(self.ui, self.repo, - False, None, '', False) def substitute(self, data, path, ctx, subfunc): '''Replaces keywords in data with expanded template.''' def kwsub(mobj): kw = mobj.group(1) - self.ct.use_template(self.templates[kw]) + ct = cmdutil.changeset_templater(self.ui, self.repo, + False, None, '', False) + ct.use_template(self.templates[kw]) self.ui.pushbuffer() - self.ct.show(ctx, root=self.repo.root, file=path) + ct.show(ctx, root=self.repo.root, file=path) ekw = templatefilters.firstline(self.ui.popbuffer()) return '$%s: %s $' % (kw, ekw) return subfunc(kwsub, data) @@ -163,16 +162,13 @@ Caveat: localrepository._link fails on Windows.''' return self.match(path) and not 'l' in flagfunc(path) - def overwrite(self, node, expand, files): + def overwrite(self, node, expand, candidates): '''Overwrites selected files expanding/shrinking keywords.''' ctx = self.repo[node] mf = ctx.manifest() if node is not None: # commit - files = [f for f in ctx.files() if f in mf] - notify = self.ui.debug - else: # kwexpand/kwshrink - notify = self.ui.note - candidates = [f for f in files if self.iskwfile(f, ctx.flags)] + candidates = [f for f in ctx.files() if f in mf] + candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)] if candidates: self.restrict = True # do not expand when reading msg = (expand and _('overwriting %s expanding keywords\n') @@ -190,7 +186,7 @@ else: found = self.re_kw.search(data) if found: - notify(msg % f) + self.ui.note(msg % f) self.repo.wwrite(f, data, mf.flags(f)) if node is None: self.repo.dirstate.normal(f) @@ -251,10 +247,8 @@ '''Bails out if [keyword] configuration is not active. Returns status of working directory.''' if kwt: - unknown = (opts.get('unknown') or opts.get('all') - or opts.get('untracked')) return repo.status(match=cmdutil.match(repo, pats, opts), clean=True, - unknown=unknown) + unknown=opts.get('unknown') or opts.get('all')) if ui.configitems('keyword'): raise util.Abort(_('[keyword] patterns cannot match')) raise util.Abort(_('no [keyword] patterns configured')) @@ -264,17 +258,15 @@ if repo.dirstate.parents()[1] != nullid: raise util.Abort(_('outstanding uncommitted merge')) kwt = kwtools['templater'] - status = _status(ui, repo, kwt, *pats, **opts) - modified, added, removed, deleted = status[:4] - if modified or added or removed or deleted: - raise util.Abort(_('outstanding uncommitted changes')) - wlock = lock = None + wlock = repo.wlock() try: - wlock = repo.wlock() - lock = repo.lock() - kwt.overwrite(None, expand, status[6]) + status = _status(ui, repo, kwt, *pats, **opts) + modified, added, removed, deleted, unknown, ignored, clean = status + if modified or added or removed or deleted: + raise util.Abort(_('outstanding uncommitted changes')) + kwt.overwrite(None, expand, clean) finally: - release(lock, wlock) + wlock.release() def demo(ui, repo, *args, **opts): '''print [keywordmaps] configuration and an expansion example @@ -295,7 +287,6 @@ ui.write('%s = %s\n' % (k, v)) fn = 'demo.txt' - branchname = 'demobranch' tmpdir = tempfile.mkdtemp('', 'kwdemo.') ui.note(_('creating temporary repository at %s\n') % tmpdir) repo = localrepo.localrepository(ui, tmpdir, True) @@ -331,35 +322,23 @@ uisetup(ui) reposetup(ui, repo) - for k, v in ui.configitems('extensions'): - if k.endswith('keyword'): - extension = '%s = %s' % (k, v) - break - ui.write('[extensions]\n%s\n' % extension) + ui.write('[extensions]\nkeyword =\n') demoitems('keyword', ui.configitems('keyword')) demoitems('keywordmaps', kwmaps.iteritems()) keywords = '$' + '$\n$'.join(sorted(kwmaps.keys())) + '$\n' repo.wopener(fn, 'w').write(keywords) repo.add([fn]) - path = repo.wjoin(fn) - ui.note(_('\nkeywords written to %s:\n') % path) + ui.note(_('\nkeywords written to %s:\n') % fn) ui.note(keywords) - ui.note('\nhg -R "%s" branch "%s"\n' % (tmpdir, branchname)) - # silence branch command if not verbose - quiet = ui.quiet - ui.quiet = not ui.verbose - commands.branch(ui, repo, branchname) - ui.quiet = quiet + repo.dirstate.setbranch('demobranch') for name, cmd in ui.configitems('hooks'): if name.split('.', 1)[0].find('commit') > -1: repo.ui.setconfig('hooks', name, '') - ui.note(_('unhooked all commit hooks\n')) msg = _('hg keyword configuration and expansion example') - ui.note("hg -R '%s' ci -m '%s'\n" % (tmpdir, msg)) + ui.note("hg ci -m '%s'\n" % msg) repo.commit(text=msg) ui.status(_('\n\tkeywords expanded\n')) ui.write(repo.wread(fn)) - ui.debug('\nremoving temporary repository %s\n' % tmpdir) shutil.rmtree(tmpdir, ignore_errors=True) def expand(ui, repo, *pats, **opts): @@ -398,7 +377,7 @@ cwd = pats and repo.getcwd() or '' modified, added, removed, deleted, unknown, ignored, clean = status files = [] - if not (opts.get('unknown') or opts.get('untracked')) or opts.get('all'): + if not opts.get('unknown') or opts.get('all'): files = sorted(modified + added + clean) wctx = repo[None] kwfiles = [f for f in files if kwt.iskwfile(f, wctx.flags)] @@ -485,15 +464,10 @@ del self.commitctx def kwcommitctx(self, ctx, error=False): - wlock = lock = None - try: - wlock = self.wlock() - lock = self.lock() - n = super(kwrepo, self).commitctx(ctx, error) - kwt.overwrite(n, True, None) - return n - finally: - release(lock, wlock) + n = super(kwrepo, self).commitctx(ctx, error) + # no lock needed, only called from repo.commit() which already locks + kwt.overwrite(n, True, None) + return n # monkeypatches def kwpatchfile_init(orig, self, ui, fname, opener, @@ -540,9 +514,6 @@ [('A', 'all', None, _('show keyword status flags of all files')), ('i', 'ignore', None, _('show files excluded from expansion')), ('u', 'unknown', None, _('only show unknown (not tracked) files')), - ('a', 'all', None, - _('show keyword status flags of all files (DEPRECATED)')), - ('u', 'untracked', None, _('only show untracked files (DEPRECATED)')), ] + commands.walkopts, _('hg kwfiles [OPTION]... [FILE]...')), 'kwshrink': (shrink, commands.walkopts, diff -r 8227a631c6b4 -r 5172261b92af hgext/mq.py --- a/hgext/mq.py Mon Apr 19 18:57:16 2010 +0200 +++ b/hgext/mq.py Mon Apr 19 18:59:02 2010 +0200 @@ -53,18 +53,11 @@ normname = util.normpath class statusentry(object): - def __init__(self, rev, name=None): - if not name: - fields = rev.split(':', 1) - if len(fields) == 2: - self.rev, self.name = fields - else: - self.rev, self.name = None, None - else: - self.rev, self.name = rev, name + def __init__(self, node, name): + self.node, self.name = node, name def __str__(self): - return self.rev + ':' + self.name + return hex(self.node) + ':' + self.name class patchheader(object): def __init__(self, pf, plainmode=False): @@ -79,8 +72,7 @@ break def eatempty(lines): while lines: - l = lines[-1] - if re.match('\s*$', l): + if not lines[-1].strip(): del lines[-1] else: break @@ -265,8 +257,11 @@ @util.propertycache def applied(self): if os.path.exists(self.join(self.status_path)): + def parse(l): + n, name = l.split(':', 1) + return statusentry(bin(n), name) lines = self.opener(self.status_path).read().splitlines() - return [statusentry(l) for l in lines] + return [parse(l) for l in lines] return [] @util.propertycache @@ -329,16 +324,12 @@ return os.path.join(self.path, *p) def find_series(self, patch): - pre = re.compile("(\s*)([^#]+)") - index = 0 - for l in self.full_series: - m = pre.match(l) - if m: - s = m.group(2) - s = s.rstrip() - if s == patch: - return index - index += 1 + def matchpatch(l): + l = l.split('#', 1)[0] + return l.strip() == patch + for index, l in enumerate(self.full_series): + if matchpatch(l): + return index return None guard_re = re.compile(r'\s?#([-+][^-+# \t\r\n\f][^# \t\r\n\f]*)') @@ -490,15 +481,22 @@ opts['unified'] = '0' m = cmdutil.match(repo, files, opts) - chunks = patch.diff(repo, node1, node2, m, changes, diffopts) - write = fp is None and repo.ui.write or fp.write + if fp is None: + write = repo.ui.write + else: + def write(s, **kw): + fp.write(s) if stat: width = self.ui.interactive() and util.termwidth() or 80 - write(patch.diffstat(util.iterlines(chunks), width=width, - git=diffopts.git)) + chunks = patch.diff(repo, node1, node2, m, changes, diffopts) + for chunk, label in patch.diffstatui(util.iterlines(chunks), + width=width, + git=diffopts.git): + write(chunk, label=label) else: - for chunk in chunks: - write(chunk) + for chunk, label in patch.diffui(repo, node1, node2, m, changes, + diffopts): + write(chunk, label=label) def mergeone(self, repo, mergeq, head, patch, rev, diffopts): # first try just applying the patch @@ -544,22 +542,16 @@ (p1, p2) = repo.dirstate.parents() if p2 == nullid: return p1 - if len(self.applied) == 0: + if not self.applied: return None - return bin(self.applied[-1].rev) - pp = repo.changelog.parents(rev) - if pp[1] != nullid: - arevs = [x.rev for x in self.applied] - p0 = hex(pp[0]) - p1 = hex(pp[1]) - if p0 in arevs: - return pp[0] - if p1 in arevs: - return pp[1] - return pp[0] + return self.applied[-1].node + p1, p2 = repo.changelog.parents(rev) + if p2 != nullid and p2 in [x.node for x in self.applied]: + return p2 + return p1 def mergepatch(self, repo, mergeq, series, diffopts): - if len(self.applied) == 0: + if not self.applied: # each of the patches merged in will have two parents. This # can confuse the qrefresh, qdiff, and strip code because it # needs to know which parent is actually in the patch queue. @@ -569,7 +561,7 @@ pname = ".hg.patches.merge.marker" n = repo.commit('[mq]: merge marker', force=True) self.removeundo(repo) - self.applied.append(statusentry(hex(n), pname)) + self.applied.append(statusentry(n, pname)) self.applied_dirty = 1 head = self.qparents(repo) @@ -587,10 +579,10 @@ if not info: self.ui.warn(_("patch %s is not applied\n") % patch) return (1, None) - rev = bin(info[1]) + rev = info[1] err, head = self.mergeone(repo, mergeq, head, patch, rev, diffopts) if head: - self.applied.append(statusentry(hex(head), patch)) + self.applied.append(statusentry(head, patch)) self.applied_dirty = 1 if err: return (err, head) @@ -613,12 +605,12 @@ return (True, files, fuzz) def apply(self, repo, series, list=False, update_status=True, - strict=False, patchdir=None, merge=None, all_files={}): + strict=False, patchdir=None, merge=None, all_files=None): wlock = lock = tr = None try: wlock = repo.wlock() lock = repo.lock() - tr = repo.transaction() + tr = repo.transaction("qpush") try: ret = self._apply(repo, series, list, update_status, strict, patchdir, merge, all_files=all_files) @@ -638,7 +630,7 @@ self.removeundo(repo) def _apply(self, repo, series, list=False, update_status=True, - strict=False, patchdir=None, merge=None, all_files={}): + strict=False, patchdir=None, merge=None, all_files=None): '''returns (error, hash) error = 1 for unable to read, 2 for patch failed, 3 for patch fuzz''' # TODO unify with commands.py @@ -671,7 +663,8 @@ if ph.haspatch: (patcherr, files, fuzz) = self.patch(repo, pf) - all_files.update(files) + if all_files is not None: + all_files.update(files) patcherr = not patcherr else: self.ui.warn(_("patch %s is empty\n") % patchname) @@ -701,7 +694,7 @@ raise util.Abort(_("repo commit failed")) if update_status: - self.applied.append(statusentry(hex(n), patchname)) + self.applied.append(statusentry(n, patchname)) if patcherr: self.ui.warn(_("patch failed, rejects left in working dir\n")) @@ -733,7 +726,7 @@ self.series_dirty = 1 def _revpatches(self, repo, revs): - firstrev = repo[self.applied[0].rev].rev() + firstrev = repo[self.applied[0].node].rev() patches = [] for i, rev in enumerate(revs): @@ -741,7 +734,7 @@ raise util.Abort(_('revision %d is not managed') % rev) ctx = repo[rev] - base = bin(self.applied[i].rev) + base = self.applied[i].node if ctx.node() != base: msg = _('cannot delete revision %d above applied patches') raise util.Abort(msg % rev) @@ -789,8 +782,8 @@ self._cleanup(realpatches, numrevs, opts.get('keep')) def check_toppatch(self, repo): - if len(self.applied) > 0: - top = bin(self.applied[-1].rev) + if self.applied: + top = self.applied[-1].node patch = self.applied[-1].name pp = repo.dirstate.parents() if top not in pp: @@ -870,7 +863,7 @@ raise util.Abort(_("repo commit failed")) try: self.full_series[insert:insert] = [patchfn] - self.applied.append(statusentry(hex(n), patchfn)) + self.applied.append(statusentry(n, patchfn)) self.parse_series() self.series_dirty = 1 self.applied_dirty = 1 @@ -927,7 +920,7 @@ """returns (index, rev, patch)""" for i, a in enumerate(self.applied): if a.name == patch: - return (i, a.rev, a.name) + return (i, a.node, a.name) return None # if the exact patch name does not exist, we try a few @@ -950,7 +943,7 @@ return None if matches: return matches[0] - if len(self.series) > 0 and len(self.applied) > 0: + if self.series and self.applied: if s == 'qtip': return self.series[self.series_end(True)-1] if s == 'qbase': @@ -1068,7 +1061,7 @@ end = self.series.index(patch, start) + 1 s = self.series[start:end] - all_files = {} + all_files = set() try: if mergeq: ret = self.mergepatch(repo, mergeq, s, diffopts) @@ -1078,12 +1071,15 @@ self.ui.warn(_('cleaning up working directory...')) node = repo.dirstate.parents()[0] hg.revert(repo, node, None) - unknown = repo.status(unknown=True)[4] # only remove unknown files that we know we touched or # created while patching - for f in unknown: - if f in all_files: - util.unlink(repo.wjoin(f)) + for f in all_files: + if f not in repo.dirstate: + try: + util.unlink(repo.wjoin(f)) + except OSError, inst: + if inst.errno != errno.ENOENT: + raise self.ui.warn(_('done\n')) raise @@ -1101,10 +1097,6 @@ wlock.release() def pop(self, repo, patch=None, force=False, update=True, all=False): - def getfile(f, rev, flags): - t = repo.file(f).read(rev) - repo.wwrite(f, t, flags) - wlock = repo.wlock() try: if patch: @@ -1116,7 +1108,7 @@ if not info: raise util.Abort(_("patch %s is not applied") % patch) - if len(self.applied) == 0: + if not self.applied: # Allow qpop -a to work repeatedly, # but not qpop without an argument self.ui.warn(_("no patches applied\n")) @@ -1135,16 +1127,16 @@ if not update: parents = repo.dirstate.parents() - rr = [bin(x.rev) for x in self.applied] + rr = [x.node for x in self.applied] for p in parents: if p in rr: self.ui.warn(_("qpop: forcing dirstate update\n")) update = True else: - parents = [p.hex() for p in repo[None].parents()] + parents = [p.node() for p in repo[None].parents()] needupdate = False for entry in self.applied[start:]: - if entry.rev in parents: + if entry.node in parents: needupdate = True break update = needupdate @@ -1154,7 +1146,7 @@ self.applied_dirty = 1 end = len(self.applied) - rev = bin(self.applied[start].rev) + rev = self.applied[start].node if update: top = self.check_toppatch(repo)[0] @@ -1164,7 +1156,7 @@ node = short(rev) raise util.Abort(_('trying to pop unknown node %s') % node) - if heads != [bin(self.applied[-1].rev)]: + if heads != [self.applied[-1].node]: raise util.Abort(_("popping would remove a revision not " "managed by this patch queue")) @@ -1172,8 +1164,7 @@ # form of hg.update. if update: qp = self.qparents(repo, rev) - changes = repo.changelog.read(qp) - mmap = repo.manifest.read(changes[0]) + ctx = repo[qp] m, a, r, d = repo.status(qp, top)[:4] if d: raise util.Abort(_("deletions found between repo revs")) @@ -1184,18 +1175,16 @@ if e.errno != errno.ENOENT: raise repo.dirstate.forget(f) - for f in m: - getfile(f, mmap[f], mmap.flags(f)) - for f in r: - getfile(f, mmap[f], mmap.flags(f)) for f in m + r: + fctx = ctx[f] + repo.wwrite(f, fctx.data(), fctx.flags()) repo.dirstate.normal(f) repo.dirstate.setparents(qp, nullid) for patch in reversed(self.applied[start:end]): self.ui.status(_("popping %s\n") % patch.name) del self.applied[start:end] self.strip(repo, rev, update=False, backup='strip') - if len(self.applied): + if self.applied: self.ui.write(_("now at: %s\n") % self.applied[-1].name) else: self.ui.write(_("patch queue now empty\n")) @@ -1216,7 +1205,7 @@ self.printdiff(repo, diffopts, node1, node2, files=pats, opts=opts) def refresh(self, repo, pats=None, **opts): - if len(self.applied) == 0: + if not self.applied: self.ui.write(_("no patches applied\n")) return 1 msg = opts.get('msg', '').rstrip() @@ -1228,8 +1217,7 @@ try: self.check_toppatch(repo) - (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name) - top = bin(top) + (top, patchfn) = (self.applied[-1].node, self.applied[-1].name) if repo.changelog.heads(top) != [top]: raise util.Abort(_("cannot refresh a revision with children")) @@ -1386,7 +1374,7 @@ patchf.rename() n = repo.commit(message, user, ph.date, match=match, force=True) - self.applied.append(statusentry(hex(n), patchfn)) + self.applied.append(statusentry(n, patchfn)) except: ctx = repo[cparents[0]] repo.dirstate.rebuild(ctx.node(), ctx.manifest()) @@ -1426,7 +1414,9 @@ def qseries(self, repo, missing=None, start=0, length=None, status=None, summary=False): - def displayname(pfx, patchname): + def displayname(pfx, patchname, state): + if pfx: + self.ui.write(pfx) if summary: ph = patchheader(self.join(patchname), self.plainmode) msg = ph.message and ph.message[0] or '' @@ -1436,10 +1426,12 @@ msg = util.ellipsis(msg, width) else: msg = '' - msg = "%s%s: %s" % (pfx, patchname, msg) + self.ui.write(patchname, label='qseries.' + state) + self.ui.write(': ') + self.ui.write(msg, label='qseries.message.' + state) else: - msg = pfx + patchname - self.ui.write(msg + '\n') + self.ui.write(patchname, label='qseries.' + state) + self.ui.write('\n') applied = set([p.name for p in self.applied]) if length is None: @@ -1450,17 +1442,17 @@ for i in xrange(start, start + length): patch = self.series[i] if patch in applied: - stat = 'A' + char, state = 'A', 'applied' elif self.pushable(i)[0]: - stat = 'U' + char, state = 'U', 'unapplied' else: - stat = 'G' + char, state = 'G', 'guarded' pfx = '' if self.ui.verbose: - pfx = '%*d %s ' % (idxwidth, i, stat) - elif status and status != stat: + pfx = '%*d %s ' % (idxwidth, i, char) + elif status and status != char: continue - displayname(pfx, patch) + displayname(pfx, patch, state) else: msng_list = [] for root, dirs, files in os.walk(self.path): @@ -1474,7 +1466,7 @@ msng_list.append(fl) for x in sorted(msng_list): pfx = self.ui.verbose and ('D ') or '' - displayname(pfx, x) + displayname(pfx, x, 'missing') def issaveline(self, l): if l.name == '.hg.patches.save.line': @@ -1485,8 +1477,7 @@ return hg.repository(self.ui, path=self.path, create=create) def restore(self, repo, rev, delete=None, qupdate=None): - c = repo.changelog.read(rev) - desc = c[4].strip() + desc = repo[rev].description().strip() lines = desc.splitlines() i = 0 datastart = None @@ -1502,12 +1493,11 @@ qpp = [bin(x) for x in l] elif datastart != None: l = line.rstrip() - se = statusentry(l) - file_ = se.name - if se.rev: - applied.append(se) + n, name = l.split(':', 1) + if n: + applied.append(statusentry(bin(n), name)) else: - series.append(file_) + series.append(l) if datastart is None: self.ui.warn(_("No saved patch data found\n")) return 1 @@ -1541,14 +1531,13 @@ hg.clean(r, qpp[0]) def save(self, repo, msg=None): - if len(self.applied) == 0: + if not self.applied: self.ui.warn(_("save: no patches applied, exiting\n")) return 1 if self.issaveline(self.applied[-1]): self.ui.warn(_("status is already saved\n")) return 1 - ar = [':' + x for x in self.full_series] if not msg: msg = _("hg patches saved state") else: @@ -1558,18 +1547,18 @@ pp = r.dirstate.parents() msg += "\nDirstate: %s %s" % (hex(pp[0]), hex(pp[1])) msg += "\n\nPatch Data:\n" - text = msg + "\n".join([str(x) for x in self.applied]) + '\n' + (ar and - "\n".join(ar) + '\n' or "") - n = repo.commit(text, force=True) + msg += ''.join('%s\n' % x for x in self.applied) + msg += ''.join(':%s\n' % x for x in self.full_series) + n = repo.commit(msg, force=True) if not n: self.ui.warn(_("repo commit failed\n")) return 1 - self.applied.append(statusentry(hex(n),'.hg.patches.save.line')) + self.applied.append(statusentry(n, '.hg.patches.save.line')) self.applied_dirty = 1 self.removeundo(repo) def full_series_end(self): - if len(self.applied) > 0: + if self.applied: p = self.applied[-1].name end = self.find_series(p) if end is None: @@ -1584,17 +1573,15 @@ """ end = 0 def next(start): - if all_patches: + if all_patches or start >= len(self.series): return start - i = start - while i < len(self.series): + for i in xrange(start, len(self.series)): p, reason = self.pushable(i) if p: break self.explain_pushable(i) - i += 1 return i - if len(self.applied) > 0: + if self.applied: p = self.applied[-1].name try: end = self.series.index(p) @@ -1631,7 +1618,6 @@ if (len(files) > 1 or len(rev) > 1) and patchname: raise util.Abort(_('option "-n" not valid when importing multiple ' 'patches')) - i = 0 added = [] if rev: # If mq patches are applied, we can only import revisions @@ -1642,14 +1628,14 @@ raise util.Abort(_('revision %d is the root of more than one ' 'branch') % rev[-1]) if self.applied: - base = hex(repo.changelog.node(rev[0])) - if base in [n.rev for n in self.applied]: + base = repo.changelog.node(rev[0]) + if base in [n.node for n in self.applied]: raise util.Abort(_('revision %d is already managed') % rev[0]) - if heads != [bin(self.applied[-1].rev)]: + if heads != [self.applied[-1].node]: raise util.Abort(_('revision %d is not the parent of ' 'the queue') % rev[0]) - base = repo.changelog.rev(bin(self.applied[0].rev)) + base = repo.changelog.rev(self.applied[0].node) lastparent = repo.changelog.parentrevs(base)[0] else: if heads != [repo.changelog.node(rev[0])]: @@ -1676,10 +1662,10 @@ self.full_series.insert(0, patchname) patchf = self.opener(patchname, "w") - patch.export(repo, [n], fp=patchf, opts=diffopts) + cmdutil.export(repo, [n], fp=patchf, opts=diffopts) patchf.close() - se = statusentry(hex(n), patchname) + se = statusentry(n, patchname) self.applied.insert(0, se) added.append(patchname) @@ -1687,7 +1673,7 @@ self.parse_series() self.applied_dirty = 1 - for filename in files: + for i, filename in enumerate(files): if existing: if filename == '-': raise util.Abort(_('-e is incompatible with import from -')) @@ -1720,7 +1706,6 @@ self.full_series[index:index] = [patchname] self.parse_series() self.ui.warn(_("adding %s to series file\n") % patchname) - i += 1 added.append(patchname) patchname = None self.series_dirty = 1 @@ -1897,7 +1882,7 @@ qbase, destrev = None, None if sr.local(): if sr.mq.applied: - qbase = bin(sr.mq.applied[0].rev) + qbase = sr.mq.applied[0].node if not hg.islocal(dest): heads = set(sr.heads()) destrev = list(heads.difference(sr.heads(qbase))) @@ -2158,7 +2143,17 @@ ''' def status(idx): guards = q.series_guards[idx] or ['unguarded'] - ui.write('%s: %s\n' % (q.series[idx], ' '.join(guards))) + ui.write('%s: ' % ui.label(q.series[idx], 'qguard.patch')) + for i, guard in enumerate(guards): + if guard.startswith('+'): + ui.write(guard, label='qguard.positive') + elif guard.startswith('-'): + ui.write(guard, label='qguard.negative') + else: + ui.write(guard, label='qguard.unguarded') + if i != len(guards) - 1: + ui.write(' ') + ui.write('\n') q = repo.mq patch = None args = list(args) @@ -2538,8 +2533,8 @@ def abort_if_wdir_patched(self, errmsg, force=False): if self.mq.applied and not force: - parent = hex(self.dirstate.parents()[0]) - if parent in [s.rev for s in self.mq.applied]: + parent = self.dirstate.parents()[0] + if parent in [s.node for s in self.mq.applied]: raise util.Abort(errmsg) def commit(self, text="", user=None, date=None, match=None, @@ -2564,7 +2559,7 @@ if not q.applied: return result - mqtags = [(bin(patch.rev), patch.name) for patch in q.applied] + mqtags = [(patch.node, patch.name) for patch in q.applied] if mqtags[-1][0] not in self.changelog.nodemap: self.ui.warn(_('mq status file refers to unknown node %s\n') @@ -2590,7 +2585,7 @@ return super(mqrepo, self)._branchtags(partial, lrev) cl = self.changelog - qbasenode = bin(q.applied[0].rev) + qbasenode = q.applied[0].node if qbasenode not in cl.nodemap: self.ui.warn(_('mq status file refers to unknown node %s\n') % short(qbasenode)) @@ -2719,7 +2714,7 @@ ('n', 'none', None, _('drop all guards'))], _('hg qguard [-l] [-n] [PATCH] [-- [+GUARD]... [-GUARD]...]')), 'qheader': (header, [], _('hg qheader [PATCH]')), - "^qimport": + "qimport": (qimport, [('e', 'existing', None, _('import file in patch directory')), ('n', 'name', '', _('name of patch file')), @@ -2732,7 +2727,7 @@ (init, [('c', 'create-repo', None, _('create queue repository'))], _('hg qinit [-c]')), - "qnew": + "^qnew": (new, [('e', 'edit', None, _('edit commit message')), ('f', 'force', None, _('import uncommitted changes (DEPRECATED)')), @@ -2801,7 +2796,7 @@ [('m', 'missing', None, _('print patches not in series')), ] + seriesopts, _('hg qseries [-ms]')), - "^strip": + "strip": (strip, [('f', 'force', None, _('force removal with local changes')), ('b', 'backup', None, _('bundle unrelated changesets')), @@ -2817,3 +2812,11 @@ [('a', 'applied', None, _('finish all applied changesets'))], _('hg qfinish [-a] [REV]...')), } + +colortable = {'qguard.negative': 'red', + 'qguard.positive': 'yellow', + 'qguard.unguarded': 'green', + 'qseries.applied': 'blue bold underline', + 'qseries.guarded': 'black bold', + 'qseries.missing': 'red bold', + 'qseries.unapplied': 'black bold'} diff -r 8227a631c6b4 -r 5172261b92af hgext/patchbomb.py --- a/hgext/patchbomb.py Mon Apr 19 18:57:16 2010 +0200 +++ b/hgext/patchbomb.py Mon Apr 19 18:59:02 2010 +0200 @@ -105,6 +105,10 @@ raise util.Abort(_('diffstat rejected')) return s +def introneeded(opts, number): + '''is an introductory message required?''' + return number > 1 or opts.get('intro') or opts.get('desc') + def makepatch(ui, repo, patch, opts, _charsets, idx, total, patchname=None): desc = [] @@ -170,7 +174,7 @@ flag = ' ' + flag subj = desc[0].strip().rstrip('. ') - if total == 1 and not opts.get('intro'): + if not introneeded(opts, total): subj = '[PATCH%s] %s' % (flag, opts.get('subject') or subj) else: tlen = len(str(total)) @@ -249,7 +253,7 @@ def getpatches(revs): for r in cmdutil.revrange(repo, revs): output = cStringIO.StringIO() - patch.export(repo, [r], fp=output, + cmdutil.export(repo, [r], fp=output, opts=patch.diffopts(ui, opts)) yield output.getvalue().split('\n') @@ -329,7 +333,7 @@ len(patches), name) msgs.append(msg) - if len(patches) > 1 or opts.get('intro'): + if introneeded(opts, len(patches)): tlen = len(str(len(patches))) flag = ' '.join(opts.get('flag')) diff -r 8227a631c6b4 -r 5172261b92af hgext/progress.py --- a/hgext/progress.py Mon Apr 19 18:57:16 2010 +0200 +++ b/hgext/progress.py Mon Apr 19 18:59:02 2010 +0200 @@ -114,7 +114,7 @@ if tail: used += len(tail) + 1 progwidth = termwidth - used - 3 - if total: + if total and pos <= total: amt = pos * progwidth // total bar = '=' * (amt - 1) if amt > 0: @@ -165,10 +165,10 @@ self.show(topic, pos, item, unit, total) return orig(topic, pos, item=item, unit=unit, total=total) - def write(self, orig, *args): + def write(self, orig, *args, **opts): if self.printed: self.clear() - return orig(*args) + return orig(*args, **opts) sharedprog = None diff -r 8227a631c6b4 -r 5172261b92af hgext/rebase.py --- a/hgext/rebase.py Mon Apr 19 18:57:16 2010 +0200 +++ b/hgext/rebase.py Mon Apr 19 18:59:02 2010 +0200 @@ -14,7 +14,7 @@ http://mercurial.selenic.com/wiki/RebaseExtension ''' -from mercurial import util, repair, merge, cmdutil, commands, error +from mercurial import hg, util, repair, merge, cmdutil, commands, error from mercurial import extensions, ancestor, copies, patch from mercurial.commands import templateopts from mercurial.node import nullrev @@ -87,6 +87,9 @@ keepf = opts.get('keep', False) keepbranchesf = opts.get('keepbranches', False) detachf = opts.get('detach', False) + # keepopen is not meant for use on the command line, but by + # other extensions + keepopen = opts.get('keepopen', False) if contf or abortf: if contf and abortf: @@ -178,7 +181,7 @@ ui.note(_('rebase merging completed\n')) - if collapsef: + if collapsef and not keepopen: p1, p2 = defineparents(repo, min(state), target, state, targetancestors) commitmsg = 'Collapsed revision' @@ -344,10 +347,10 @@ 'Update rebased mq patches - finalize and then import them' mqrebase = {} for p in repo.mq.applied: - if repo[p.rev].rev() in state: + if repo[p.node].rev() in state: repo.ui.debug('revision %d is an mq patch (%s), finalize it.\n' % - (repo[p.rev].rev(), p.name)) - mqrebase[repo[p.rev].rev()] = (p.name, isagitpatch(repo, p.name)) + (repo[p.node].rev(), p.name)) + mqrebase[repo[p.node].rev()] = (p.name, isagitpatch(repo, p.name)) if mqrebase: repo.mq.finish(repo, mqrebase.keys()) @@ -444,8 +447,8 @@ # This check isn't strictly necessary, since mq detects commits over an # applied patch. But it prevents messing up the working directory when # a partially completed rebase is blocked by mq. - if 'qtip' in repo.tags() and (repo[dest].hex() in - [s.rev for s in repo.mq.applied]): + if 'qtip' in repo.tags() and (repo[dest].node() in + [s.node for s in repo.mq.applied]): raise util.Abort(_('cannot rebase onto an applied mq patch')) if src: @@ -501,7 +504,14 @@ cmdutil.bail_if_changed(repo) revsprepull = len(repo) - orig(ui, repo, *args, **opts) + origpostincoming = commands.postincoming + def _dummy(*args, **kwargs): + pass + commands.postincoming = _dummy + try: + orig(ui, repo, *args, **opts) + finally: + commands.postincoming = origpostincoming revspostpull = len(repo) if revspostpull > revsprepull: rebase(ui, repo, **opts) @@ -509,7 +519,7 @@ dest = repo[branch].rev() if dest != repo['.'].rev(): # there was nothing to rebase we force an update - merge.update(repo, dest, False, False, False) + hg.update(repo, dest) else: orig(ui, repo, *args, **opts) diff -r 8227a631c6b4 -r 5172261b92af hgext/record.py --- a/hgext/record.py Mon Apr 19 18:57:16 2010 +0200 +++ b/hgext/record.py Mon Apr 19 18:59:02 2010 +0200 @@ -293,6 +293,7 @@ _('&Quit, recording no changes'), _('&?')) r = ui.promptchoice("%s %s" % (query, resps), choices) + ui.write("\n") if r == 7: # ? doc = gettext(record.__doc__) c = doc.find(_('y - record this change')) @@ -519,7 +520,18 @@ os.rmdir(backupdir) except OSError: pass - return cmdutil.commit(ui, repo, recordfunc, pats, opts) + + # wrap ui.write so diff output can be labeled/colorized + def wrapwrite(orig, *args, **kw): + label = kw.pop('label', '') + for chunk, l in patch.difflabel(lambda: args): + orig(chunk, label=label + l) + oldwrite = ui.write + extensions.wrapfunction(ui, 'write', wrapwrite) + try: + return cmdutil.commit(ui, repo, recordfunc, pats, opts) + finally: + ui.write = oldwrite cmdtable = { "record": @@ -543,7 +555,7 @@ (qrecord, # add qnew options, except '--force' - [opt for opt in mq.cmdtable['qnew'][1] if opt[1] != 'force'], + [opt for opt in mq.cmdtable['^qnew'][1] if opt[1] != 'force'], _('hg qrecord [OPTION]... PATCH [FILE]...')), } diff -r 8227a631c6b4 -r 5172261b92af hgext/relink.py --- a/hgext/relink.py Mon Apr 19 18:57:16 2010 +0200 +++ b/hgext/relink.py Mon Apr 19 18:59:02 2010 +0200 @@ -116,6 +116,7 @@ CHUNKLEN = 65536 relinked = 0 savedbytes = 0 + f = '' pos = 0 total = len(files) @@ -145,7 +146,7 @@ except OSError, inst: ui.warn('%s: %s\n' % (tgt, str(inst))) - ui.progress(_('relinking'), None, f, _(' files'), total) + ui.progress(_('relinking'), None) ui.status(_('relinked %d files (%d bytes reclaimed)\n') % (relinked, savedbytes)) diff -r 8227a631c6b4 -r 5172261b92af i18n/da.po --- a/i18n/da.po Mon Apr 19 18:57:16 2010 +0200 +++ b/i18n/da.po Mon Apr 19 18:59:02 2010 +0200 @@ -17,8 +17,8 @@ msgstr "" "Project-Id-Version: Mercurial\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-04-04 23:48+0200\n" -"PO-Revision-Date: 2010-04-05 01:09+0200\n" +"POT-Creation-Date: 2010-04-05 01:22+0200\n" +"PO-Revision-Date: 2010-04-05 01:37+0200\n" "Last-Translator: \n" "Language-Team: Danish\n" "MIME-Version: 1.0\n" @@ -425,9 +425,8 @@ msgid "Revision %d is a merge, ignoring...\n" msgstr "Revision %d er en sammenføjning; ignorerer...\n" -#, python-format -msgid "generating stats: %d%%" -msgstr "genererer statistik: %d%%" +msgid "analyzing" +msgstr "" msgid "" "histogram of changes to the repository\n" @@ -524,11 +523,8 @@ msgid "file with email aliases" msgstr "fil med email-aliaser" -msgid "show progress" -msgstr "vis fremskridt" - -msgid "hg churn [-d DATE] [-r REV] [--aliases FILE] [--progress] [FILE]" -msgstr "hg churn [-d DATO] [-r REV] [--aliases FIL] [--progress] [FIL]" +msgid "hg churn [-d DATE] [-r REV] [--aliases FILE] [FILE]" +msgstr "hg churn [-d DATO] [-r REV] [--aliases FIL] [FIL]" msgid "" "colorize output from some commands\n" @@ -2168,9 +2164,6 @@ "\n" "nøgleord skrevet til %s:\n" -msgid "unhooked all commit hooks\n" -msgstr "" - msgid "hg keyword configuration and expansion example" msgstr "eksempel på konfiguration og ekspansion af nøgleord" @@ -2259,12 +2252,6 @@ msgid "only show unknown (not tracked) files" msgstr "vis kun ukendte (ikke-fulgte) filer" -msgid "show keyword status flags of all files (DEPRECATED)" -msgstr "vis keyword status for alle filer (FORÆLDET)" - -msgid "only show untracked files (DEPRECATED)" -msgstr "vis kun ikke-fulgte filer (FORÆLDET)" - msgid "hg kwfiles [OPTION]... [FILE]..." msgstr "hg kwfiles [TILVALG]... [FIL]..." @@ -4776,6 +4763,9 @@ msgid "invalid format spec '%%%s' in output filename" msgstr "ugyldig formatspecifikation '%%%s' i output filnavn" +msgid "searching" +msgstr "søger" + #, python-format msgid "adding %s\n" msgstr "tilføjer %s\n" @@ -5103,8 +5093,10 @@ " By default, the revision used is the parent of the working\n" " directory; use -r/--rev to specify a different revision.\n" "\n" -" To specify the type of archive to create, use -t/--type. Valid\n" -" types are:\n" +" The archive type is automatically detected based on file\n" +" extension (or override using -t/--type).\n" +"\n" +" Valid types are:\n" "\n" " :``files``: a directory full of files (default)\n" " :``tar``: tar archive, uncompressed\n" @@ -6781,6 +6773,10 @@ " By default, the server logs accesses to stdout and errors to\n" " stderr. Use the -A/--accesslog and -E/--errorlog options to log to\n" " files.\n" +"\n" +" To have the server choose a free port number to listen on, specify\n" +" a port number of 0; in this case, the server will print the port\n" +" number it uses.\n" " " msgstr "" "eksporter depotet via HTTP\n" @@ -6790,6 +6786,10 @@ " Som standard logger serveren forespørgsler til stdout og fejl til\n" " stderr. Brug -A/--accesslog og -E/--errorlog tilvalgene for at\n" " logge til filer.\n" +"\n" +" For at få serveren til at vælge et frit portnummer at lytte til,\n" +" angiv da portnummer 0; så vil serveren skrive det portnummer den\n" +" bruger.\n" " " #, python-format @@ -7739,7 +7739,7 @@ msgid "name of error log file to write to" msgstr "navn på fejlllog fil der skrives til" -msgid "port to listen on (default: 8000)" +msgid "port to listen on (default: 8000" msgstr "port der skal lyttes på (standard: 8000)" msgid "address to listen on (default: all interfaces)" @@ -9156,9 +9156,6 @@ msgid "queries" msgstr "" -msgid "searching" -msgstr "søger" - msgid "already have changeset " msgstr "har allerede ændringen " @@ -9493,6 +9490,15 @@ msgid "Unsupported line endings type: %s" msgstr "Linieendelse %s understøttes ikke" +msgid "" +"internal patcher failed\n" +"please report details to http://mercurial.selenic.com/bts/\n" +"or mercurial@selenic.com\n" +msgstr "" +"intern lappe-funktionalitet fejlede\n" +"angiv venligst fejldetaljer på http://mercurial.selenic.com/bts/\n" +"eller mercurial@selenic.com\n" + #, python-format msgid " %d files changed, %d insertions(+), %d deletions(-)\n" msgstr "%d filer ændret, %d indsættelser(+), %d sletninger(-)\n" @@ -9640,8 +9646,8 @@ msgstr "fjerner underdepot %s\n" #, python-format -msgid "pulling subrepo %s\n" -msgstr "hiver fra underdepot %s\n" +msgid "pulling subrepo %s from %s\n" +msgstr "hiver underdepot %s fra %s\n" #, python-format msgid "pushing subrepo %s\n" diff -r 8227a631c6b4 -r 5172261b92af i18n/fr.po --- a/i18n/fr.po Mon Apr 19 18:57:16 2010 +0200 +++ b/i18n/fr.po Mon Apr 19 18:59:02 2010 +0200 @@ -1,17 +1,17 @@ # French translations for Mercurial # Traductions françaises de Mercurial # Copyright (C) 2009 Matt Mackall and others -# +# # Quelques règles : # - dans l'aide d'une commande, la première ligne descriptive # commence par un verbe au présent sans majuscule # - dans l'aide d'une commande, la description des options # utilise un verbe à l'infinitif -# +# # Note : la terminologie ci-dessous est loin d'être complète, figée ou # parfaite. À compléter et à améliorer, particulièrement les # termes comportant un point d'interrogation... -# +# # Dictionnaire de termes courants : # - to apply a patch appliquer un patch # - a branch une branche @@ -46,7 +46,7 @@ # untracked non suivi, non géré, pas sous contrôle du dépôt, # hors révision ? # - the working directory le répertoire de travail -# +# # Termes très courants repris de l'anglais - à utiliser sans guillemets # pour ne pas alourdir inutilement la traduction : # - a diff un diff ? (ou également un patch ? synonymes...) @@ -54,7 +54,7 @@ # - a patch un patch # - a tag un tag # - to tag taguer -# +# # Termes anglais avec une signification très spécifique, difficile à # paraphraser sans alourdir ou perdre le sens - à utiliser avec guillemets : # - a bundle un \"bundle\" @@ -62,7 +62,7 @@ # - a changeset un \"changeset\" # - a changegroup un \"changegroup\" # - the tip la révision \"tip\" -# +# # Termes dont le classement / la traduction sont à déterminer : # - a commit un commit, un \"commit\" # - to commit \"committer\" ? (beuark, même dit tous les jours) @@ -73,7 +73,7 @@ # - to push propager ? (utilisé par svn pour commit) # publier ? pousser ?? envoyer ?? # - the series file (mq) ? -# +# # Notes : # - (cédric) je verrais bien l'ajout d'une rubrique générale dans l'aide # (par exemple 'hg help glossary') librement remplissable par chaque équipe @@ -81,7 +81,7 @@ # qui vont être rencontrés dans mercurial - et en particulier permettrait # de faire le lien avec des termes franglisants parfois utilisés # (par ex. fusionner = "merger", etc.) ... ? -# +# msgid "" msgstr "" "Project-Id-Version: Mercurial\n" @@ -100,10 +100,10 @@ msgstr " (défaut: %s)" msgid "OPTIONS" -msgstr "" +msgstr "OPTIONS" msgid "COMMANDS" -msgstr "" +msgstr "COMMANDES" #, fuzzy msgid "" @@ -454,8 +454,7 @@ "A template is a piece of text, with markup to invoke variable\n" "expansion::\n" "\n" -" $ hg log -r1 --template \"{node}\\n\"\n" -" b56ce7b07c52de7d5fd79fb89701ea538af65746\n" +" $ hg log -r1 --template \"{node}\\n\"\\n b56ce7b07c52de7d5fd79fb89701ea538af65746\n" "\n" "Strings in curly braces are called keywords. The availability of\n" "keywords depends on the exact context of the templater. These\n" @@ -492,8 +491,7 @@ "variable. You can also use a chain of filters to get the desired\n" "output::\n" "\n" -" $ hg tip --template \"{date|isodate}\\n\"\n" -" 2008-08-21 18:22 +0000\n" +" $ hg tip --template \"{date|isodate}\\n\"\\n 2008-08-21 18:22 +0000\n" "\n" "List of filters:\n" "\n" @@ -713,8 +711,9 @@ " " msgstr "" +#, fuzzy msgid "a bookmark of this name does not exist" -msgstr "" +msgstr "un signet de ce nom n'existe pas" msgid "a bookmark of the same name already exists" msgstr "" @@ -738,10 +737,10 @@ msgstr "" msgid "delete a given bookmark" -msgstr "" +msgstr "Supprimer un signet donné" msgid "rename a given bookmark" -msgstr "" +msgstr "Renommer un signet donné" msgid "hg bookmarks [-f] [-d] [-m NAME] [-r REV] [NAME]" msgstr "" @@ -821,8 +820,7 @@ " {hgweb} Base URL for browsing Mercurial repositories.\n" "\n" " Default 'changeset {node|short} in repo {root} refers '\n" -" 'to bug {bug}.\\ndetails:\\n\\t{desc|tabindent}'\n" -"\n" +" 'to bug {bug}.\\ndetails:\\n\\t{desc|tabindent}'\\n\n" "strip\n" " The number of slashes to strip from the front of {root} to produce\n" " {webroot}. Default 0.\n" @@ -864,9 +862,7 @@ " bzuser=unknown@domain.com\n" " bzdir=/opt/bugzilla-3.2\n" " template=Changeset {node|short} in {root|basename}.\n" -" {hgweb}/{webroot}/rev/{node|short}\\n\n" -" {desc}\\n\n" -" strip=5\n" +" {hgweb}/{webroot}/rev/{node|short}\\n\\n {desc}\\n\\n strip=5\n" "\n" " [web]\n" " baseurl=http://dev.domain.com/hg\n" @@ -973,8 +969,9 @@ msgid "hg children [-r REV] [FILE]" msgstr "" +#, fuzzy msgid "command to display statistics about repository history" -msgstr "" +msgstr "Commande pour afficher les statistiques de l'historique du repository" #, python-format msgid "Revision %d is a merge, ignoring...\n" @@ -1393,9 +1390,7 @@ msgid "hg debugcvsps [OPTION]... [PATH]..." msgstr "" -msgid "" -"warning: lightweight checkouts may cause conversion failures, try with a " -"regular branch instead.\n" +msgid "warning: lightweight checkouts may cause conversion failures, try with a regular branch instead.\n" msgstr "" msgid "bzr source type could not be determined\n" @@ -1439,18 +1434,19 @@ #, python-format msgid "%s: unknown repository type" -msgstr "" +msgstr "%s : type de dépôt inconnu" #, python-format msgid "unknown sort mode: %s" -msgstr "" +msgstr "mode de tri inconnu: %s" #, python-format msgid "cycle detected between %s and %s" -msgstr "" - +msgstr "cycle détecté entre %s et %s" + +#, fuzzy msgid "not all revisions were sorted" -msgstr "" +msgstr "Touts les révisions n'ont pas été triées" #, python-format msgid "Writing author map file %s\n" @@ -1475,22 +1471,24 @@ msgid "scanning source...\n" msgstr "" +#, fuzzy msgid "sorting...\n" -msgstr "" - +msgstr "tri en cours...\n" + +#, fuzzy msgid "converting...\n" -msgstr "" +msgstr "conversion en cours...\n" #, python-format msgid "source: %s\n" -msgstr "" +msgstr "source: %s\n" #, python-format msgid "assuming destination %s\n" msgstr "" msgid "more than one sort mode specified" -msgstr "" +msgstr "plus d'un mode de tri specifié" msgid "--sourcesort is not supported by this data source" msgstr "" @@ -1501,55 +1499,56 @@ #, python-format msgid "connecting to %s\n" -msgstr "" +msgstr "connexion à %s\n" msgid "CVS pserver authentication failed" -msgstr "" - -#, python-format -msgid "" -"unexpected response from CVS server (expected \"Valid-requests\", but got %r)" -msgstr "" +msgstr "l'authentification au serveur CVS a échoué" + +#, python-format, fuzzy +msgid "unexpected response from CVS server (expected \"Valid-requests\", but got %r)" +msgstr "réponse innatendue du serveur CVS (\\'Valid-requests\" attendue, mais %r reçue)" #, python-format msgid "%d bytes missing from remote file" -msgstr "" +msgstr "%d bytes manquants dans le fichier distant" #, python-format msgid "cvs server: %s\n" -msgstr "" +msgstr "serveur cvs : %s\n" #, python-format msgid "unknown CVS response: %s" -msgstr "" - +msgstr "Réponse CVS inconnue : %s" + +#, fuzzy msgid "collecting CVS rlog\n" -msgstr "" +msgstr "récupération des rlog CVS\n" #, python-format msgid "reading cvs log cache %s\n" msgstr "" -#, python-format +#, python-format, fuzzy msgid "cache has %d log entries\n" -msgstr "" +msgstr "le cache a %d entrées de log\n" #, python-format msgid "error reading cache: %r\n" -msgstr "" +msgstr "erreur lors de la lecture du cache : %r\n" #, python-format msgid "running %s\n" msgstr "" +#, fuzzy msgid "RCS file must be followed by working file" -msgstr "" +msgstr "le fichier RCS doit être suivi par le fichier de travail" msgid "must have at least some revisions" msgstr "" msgid "expected revision number" -msgstr "" +msgstr "numéro de révision attendu" msgid "revision must be followed by date line" msgstr "" @@ -1558,9 +1557,9 @@ msgid "writing cvs log cache %s\n" msgstr "" -#, python-format +#, python-format, fuzzy msgid "%d log entries\n" -msgstr "" +msgstr "%d entrées dans les log\n" msgid "creating changesets\n" msgstr "" @@ -1580,10 +1579,10 @@ #, python-format msgid "darcs version 2.1 or newer needed (found %r)" -msgstr "" +msgstr "darcs version 2.1 ou supérieur nécessaire (trouvé %r)" msgid "Python ElementTree module is not available" -msgstr "" +msgstr "Le module Python ElementTree n'est pas disponible" msgid "internal calling inconsistency" msgstr "" @@ -1614,8 +1613,7 @@ msgstr "" #, python-format -msgid "" -"tree analysis stopped because it points to an unregistered archive %s...\n" +msgid "tree analysis stopped because it points to an unregistered archive %s...\n" msgstr "" #, python-format @@ -1624,7 +1622,7 @@ #, python-format msgid "%s is not a local Mercurial repo" -msgstr "" +msgstr "%s n'est pas un dépôt local de Mercurial" #, python-format msgid "initializing destination %s repository\n" @@ -1638,7 +1636,7 @@ msgstr "" msgid "updating tags\n" -msgstr "" +msgstr "mise à jour des tags\n" #, python-format msgid "%s is not a valid start revision" @@ -1675,9 +1673,9 @@ msgid "Subversion python bindings are too old, 1.4 or later required" msgstr "" -#, python-format +#, python-format, fuzzy msgid "svn: revision %s is not an integer" -msgstr "" +msgstr "svn : la révision %s n'est pas un entier" #, python-format msgid "svn: start revision %s is not an integer" @@ -1712,7 +1710,7 @@ #, python-format msgid "no tags found at revision %d\n" -msgstr "" +msgstr "aucun tag trouvé dans la révision %d\n" #, python-format msgid "%s not found up to revision %d" @@ -1732,7 +1730,7 @@ #, python-format msgid "initializing svn repo %r\n" -msgstr "" +msgstr "initialisation du dépôt svn %r\n" #, python-format msgid "initializing svn wc %r\n" @@ -1745,7 +1743,7 @@ msgstr "" msgid "XXX TAGS NOT IMPLEMENTED YET\n" -msgstr "" +msgstr "XXX TAGS PAS ENCORE IMPLÉMENTÉ\n" msgid "" "command to allow external programs to compare revisions\n" @@ -1796,7 +1794,7 @@ msgstr "" msgid "cleaning up temp directory\n" -msgstr "" +msgstr "nettoyage du dossier temporaire\n" msgid "" "use external program to diff repository (or selected files)\n" @@ -1837,10 +1835,8 @@ " %(path)s program.\n" "\n" " When two revision arguments are given, then changes are shown between\n" -" those revisions. If only one revision is specified then that revision " -"is\n" -" compared to the working directory, and, when no revisions are " -"specified,\n" +" those revisions. If only one revision is specified then that revision is\n" +" compared to the working directory, and, when no revisions are specified,\n" " the working directory files are compared to its parent." msgstr "" @@ -1871,8 +1867,7 @@ " " msgstr "" -msgid "" -"working dir not at branch tip (use \"hg update\" to check out branch tip)" +msgid "working dir not at branch tip (use \"hg update\" to check out branch tip)" msgstr "" msgid "outstanding uncommitted merge" @@ -1884,23 +1879,18 @@ msgid "working directory is missing some files" msgstr "" -msgid "" -"multiple heads in this branch (use \"hg heads .\" and \"hg merge\" to merge)" +msgid "multiple heads in this branch (use \"hg heads .\" and \"hg merge\" to merge)" msgstr "" #, python-format msgid "pulling from %s\n" msgstr "" -msgid "" -"Other repository doesn't support revision lookup, so a rev cannot be " -"specified." -msgstr "" - -#, python-format -msgid "" -"not merging with %d other new branch heads (use \"hg heads .\" and \"hg merge" -"\" to merge them)\n" +msgid "Other repository doesn't support revision lookup, so a rev cannot be specified." +msgstr "" + +#, python-format +msgid "not merging with %d other new branch heads (use \"hg heads .\" and \"hg merge\" to merge them)\n" msgstr "" #, python-format @@ -1934,7 +1924,7 @@ msgstr "" msgid "error while verifying signature" -msgstr "" +msgstr "erreur lors de la vérification de la signature" #, python-format msgid "%s Bad signature from \"%s\"\n" @@ -1951,16 +1941,16 @@ msgid "list signed changesets" msgstr "" -#, python-format +#, python-format, fuzzy msgid "%s:%d node does not exist\n" -msgstr "" +msgstr "%s: le noeud %d n'existe pas\n" msgid "verify all the signatures there may be for a particular revision" msgstr "" #, python-format msgid "No valid signature for %s\n" -msgstr "" +msgstr "Signature invalide pour %s\n" msgid "" "add a signature for the current or given revision\n" @@ -1978,9 +1968,7 @@ msgid "Error while signing" msgstr "" -msgid "" -"working copy of .hgsigs is changed (please commit .hgsigs manually or use --" -"force)" +msgid "working copy of .hgsigs is changed (please commit .hgsigs manually or use --force)" msgstr "" msgid "unknown signature version" @@ -2071,8 +2059,7 @@ " # Append a diffstat to the log message (optional)\n" " #diffstat = False\n" " # Template to use for log messages (optional)\n" -" #template = {desc}\\n{baseurl}/rev/{node}-- {diffstat}\n" -" # Style to use (optional)\n" +" #template = {desc}\\n{baseurl}/rev/{node}-- {diffstat}\\n # Style to use (optional)\n" " #style = foo\n" " # The URL of the CIA notification service (optional)\n" " # You can use mailto: URLs to send by email, eg\n" @@ -2163,7 +2150,7 @@ msgstr "" msgid "recursive" -msgstr "" +msgstr "récursif" msgid "pretty" msgstr "" @@ -2175,7 +2162,7 @@ msgstr "" msgid "search" -msgstr "" +msgstr "recherche" msgid "hg git-diff-tree [OPTION]... NODE1 NODE2 [FILE]..." msgstr "" @@ -2190,19 +2177,19 @@ msgstr "" msgid "ignored" -msgstr "" +msgstr "ignoré" msgid "hg debug-rev-parse REV" msgstr "" msgid "header" -msgstr "" +msgstr "en-tête" msgid "topo-order" msgstr "" msgid "parents" -msgstr "" +msgstr "parent" msgid "max-count" msgstr "" @@ -2296,7 +2283,7 @@ #, python-format msgid "found %d\n" -msgstr "" +msgstr "trouvé %d\n" #, python-format msgid "*** to raise the limit from %d to %d (run as root):\n" @@ -2400,8 +2387,7 @@ "\n" " [interhg]\n" " issues = s!issue(\\d+)!issue\\1!\n" -" bugzilla = s!((?:bug|b=|(?=#?\\d{4,}))(?:\\s*#?)(\\d+))!\\1!" -"i\n" +" bugzilla = s!((?:bug|b=|(?=#?\\d{4,}))(?:\\s*#?)(\\d+))!\\1!i\n" " boldify = s!(^|\\s)#(\\d+)\\b! #\\2!\n" msgstr "" @@ -2735,8 +2721,7 @@ msgstr "le patch %s n'est pas appliqué\n" msgid "patch failed, unable to continue (try -v)\n" -msgstr "" -"l'application du patch a échoué, impossible de continuer (essayez avec -v)\n" +msgstr "l'application du patch a échoué, impossible de continuer (essayez avec -v)\n" #, python-format msgid "applying %s\n" @@ -2860,9 +2845,7 @@ #, python-format msgid "errors during apply, please fix and refresh %s\n" -msgstr "" -"des erreurs se sont produites durant l'application, veuillez corriger puis " -"rafraîchir %s\n" +msgstr "des erreurs se sont produites durant l'application, veuillez corriger puis rafraîchir %s\n" #, python-format msgid "now at: %s\n" @@ -2880,16 +2863,14 @@ msgstr "qpop: %s est déjà le dernier patch appliqué\n" msgid "qpop: forcing dirstate update\n" -msgstr "" -"qpop: mise à jour de l'état du répertoire de travail (dirstate) forcée\n" +msgstr "qpop: mise à jour de l'état du répertoire de travail (dirstate) forcée\n" #, python-format msgid "trying to pop unknown node %s" msgstr "tentative de dépilement d'un nœud inconnu : %s" msgid "popping would remove a revision not managed by this patch queue" -msgstr "" -"le dépilement enlèverait une révision non gérée par cette pile de patchs" +msgstr "le dépilement enlèverait une révision non gérée par cette pile de patchs" msgid "deletions found between repo revs" msgstr "suppressions trouvées entre des révisions du dépôt" @@ -2905,12 +2886,8 @@ msgstr "impossible de rafraîchir une révision possédant des révisions filles" # restaurer/récupérer ? pas satisfait... -msgid "" -"refresh interrupted while patch was popped! (revert --all, qpush to " -"recover)\n" -msgstr "" -"rafraîchissement interrompu alors qu'un patch était en cours de dépilement " -"(utiliser revert --all, ou qpush pour restaurer l'état)\n" +msgid "refresh interrupted while patch was popped! (revert --all, qpush to recover)\n" +msgstr "rafraîchissement interrompu alors qu'un patch était en cours de dépilement (utiliser revert --all, ou qpush pour restaurer l'état)\n" msgid "patch queue directory already exists" msgstr "la pile de patchs existe déjà" @@ -2963,9 +2940,7 @@ msgstr "l'option \"-r\" n'est pas utilisable lors de l'importation de fichiers" msgid "option \"-n\" not valid when importing multiple patches" -msgstr "" -"l'option \"-n\" n'est pas utilisable lors de l'importation de plusieurs " -"patchs" +msgstr "l'option \"-n\" n'est pas utilisable lors de l'importation de plusieurs patchs" # origine/base/racine ? #, python-format @@ -3009,8 +2984,7 @@ msgid "" "remove patches from queue\n" "\n" -" The patches must not be applied, and at least one patch is required. " -"With\n" +" The patches must not be applied, and at least one patch is required. With\n" " -k/--keep, the patch files are preserved in the patch directory.\n" "\n" " To stop managing a patch and move it into permanent history,\n" @@ -3678,9 +3652,7 @@ msgstr "hg qpush [-f] [-l] [-a] [-m] [-n NOM] [PATCH | INDEX]" msgid "refresh only files already in the patch and specified files" -msgstr "" -"ne rafraîchir que les fichiers déjà présent dans le patch et ceux " -"explicitement spécifiés" +msgstr "ne rafraîchir que les fichiers déjà présent dans le patch et ceux explicitement spécifiés" msgid "add/update author field in patch with current user" msgstr "" @@ -3812,8 +3784,7 @@ " maxdiff = 300 # max lines of diffs to include (0=none, -1=all)\n" " maxsubject = 67 # truncate subject line longer than this\n" " diffstat = True # add a diffstat before the diff content\n" -" sources = serve # notify if source of incoming changes in this " -"list\n" +" sources = serve # notify if source of incoming changes in this list\n" " # (serve == ssh or http, push, pull, bundle)\n" " merge = False # send notification for merges (default True)\n" " [email]\n" @@ -4138,10 +4109,8 @@ "\n" " hg email -b # send bundle of all patches not in default\n" " hg email -b DEST # send bundle of all patches not in DEST\n" -" hg email -b -r 3000 # bundle of all ancestors of 3000 not in " -"default\n" -" hg email -b -r 3000 DEST # bundle of all ancestors of 3000 not in " -"DEST\n" +" hg email -b -r 3000 # bundle of all ancestors of 3000 not in default\n" +" hg email -b -r 3000 DEST # bundle of all ancestors of 3000 not in DEST\n" "\n" " Before using this command, you will need to enable email in your\n" " hgrc. See the [email] section in hgrc(5) for details.\n" @@ -4201,9 +4170,7 @@ msgstr "veuillez spécifier au minimum un \"changeset\", à l'aide de -r ou -o" msgid "--outgoing mode always on with --bundle; do not re-specify --outgoing" -msgstr "" -"ne pas spécifier --outgoing, qui est systématiquement activé lorsque --" -"bundle est utilisé" +msgstr "ne pas spécifier --outgoing, qui est systématiquement activé lorsque --bundle est utilisé" msgid "too many destinations" msgstr "trop de destinations" @@ -4272,8 +4239,7 @@ msgstr "afficher les messages tels qu'ils seraient envoyés" msgid "write messages to mbox file instead of sending them" -msgstr "" -"écrire les messages dans un fichier au format \"mbox\" au lieu de les envoyer" +msgstr "écrire les messages dans un fichier au format \"mbox\" au lieu de les envoyer" msgid "subject of first message (intro or single patch)" msgstr "sujet du premier message (intro ou patch unique)" @@ -4294,9 +4260,7 @@ msgstr "envoyer les modifications non présentes dans le dépôt cible" msgid "send changes not in target as a binary bundle" -msgstr "" -"envoyer les modifications non présentes dans le dépôt cible sous forme de " -"\"bundle\" binaire" +msgstr "envoyer les modifications non présentes dans le dépôt cible sous forme de \"bundle\" binaire" msgid "name of the bundle attachment file" msgstr "nom à donner au fichier \"bundle\" envoyé" @@ -4308,9 +4272,7 @@ msgstr "procéder même si le dépôt cible n'est pas apparenté (avec -b/--bundle)" msgid "a base changeset to specify instead of a destination (with -b/--bundle)" -msgstr "" -"un \"changeset\" à utiliser comme point de départ, au lieu d'une destination " -"(avec -b/--bundle)" +msgstr "un \"changeset\" à utiliser comme point de départ, au lieu d'une destination (avec -b/--bundle)" msgid "send an introduction email for a single patch" msgstr "envoyer un courriel d'introduction pour un patch seul" @@ -4402,9 +4364,7 @@ msgstr "afficher les nom des fichiers au lieu de les supprimer" msgid "end filenames with NUL, for use with xargs (implies -p/--print)" -msgstr "" -"terminer les noms de fichiers par un caractère nul, pour utilisation avec " -"xargs (implique -p/--print)" +msgstr "terminer les noms de fichiers par un caractère nul, pour utilisation avec xargs (implique -p/--print)" msgid "hg purge [OPTION]... [DIR]..." msgstr "hg purge [OPTION]... [RÉPERTOIRE]..." @@ -4524,9 +4484,7 @@ msgid "abort an interrupted rebase" msgstr "" -msgid "" -"hg rebase [-s REV | -b REV] [-d REV] [--collapse] [--keep] [--keepbranches] " -"| [-c] | [-a]" +msgid "hg rebase [-s REV | -b REV] [-d REV] [--collapse] [--keep] [--keepbranches] | [-c] | [-a]" msgstr "" msgid "commands to interactively select changes for commit/qrefresh" @@ -4799,8 +4757,7 @@ msgid "filter changesets through FILTER" msgstr "" -msgid "" -"hg transplant [-s REPOSITORY] [-b BRANCH [-a]] [-p REV] [-m REV] [REV]..." +msgid "hg transplant [-s REPOSITORY] [-b BRANCH [-a]] [-p REV] [-m REV] [REV]..." msgstr "" msgid "" @@ -4858,8 +4815,7 @@ " ** = cleverdecode:\n" " # or ** = macdecode:\n" "\n" -"If not doing conversion, to make sure you do not commit CRLF/CR by " -"accident::\n" +"If not doing conversion, to make sure you do not commit CRLF/CR by accident::\n" "\n" " [hooks]\n" " pretxncommit.crlf = python:hgext.win32text.forbidcrlf\n" @@ -4950,9 +4906,7 @@ msgstr "le préfixe donné pour l'archive contient des composants non autorisés" msgid "cannot give prefix when archiving to files" -msgstr "" -"impossible de donner un préfixe pour une création d'archive vers un " -"répertoire (de type \"files\")" +msgstr "impossible de donner un préfixe pour une création d'archive vers un répertoire (de type \"files\")" #, python-format msgid "unknown archive type '%s'" @@ -5012,8 +4966,7 @@ #, python-format msgid "invalid format spec '%%%s' in output filename" -msgstr "" -"'%%%s'spécification de format invalide dans le nom du fichier de sortie" +msgstr "'%%%s'spécification de format invalide dans le nom du fichier de sortie" #, python-format msgid "adding %s\n" @@ -5025,9 +4978,7 @@ #, python-format msgid "recording removal of %s as rename to %s (%d%% similar)\n" -msgstr "" -"suppression de %s plannifiée, en tant que renommage de %s (similaire à %d%" -"%)\n" +msgstr "suppression de %s plannifiée, en tant que renommage de %s (similaire à %d%%)\n" #, python-format msgid "%s: not copying - file is not managed\n" @@ -5295,8 +5246,7 @@ " removed.\n" " " msgstr "" -"crée une archive du dépôt à une révision donnée, sans conserver " -"l'historique\n" +"crée une archive du dépôt à une révision donnée, sans conserver l'historique\n" "\n" " Par défaut l'archive est créée à partir de la révision parente\n" " du répertoire de travail. Une autre révision peut être spécifiée\n" @@ -5328,8 +5278,7 @@ msgstr "le répertoire racine ne peut servir de destination" msgid "cannot archive plain files to stdout" -msgstr "" -"impossible d'envoyer une archive de simples fichiers vers la sortie standard" +msgstr "impossible d'envoyer une archive de simples fichiers vers la sortie standard" msgid "" "reverse effect of earlier changeset\n" @@ -5790,14 +5739,10 @@ msgid " patch test failed!\n" msgstr "" -msgid "" -" (Current patch tool may be incompatible with patch, or misconfigured. " -"Please check your .hgrc file)\n" -msgstr "" - -msgid "" -" Internal patcher failure, please report this error to http://mercurial." -"selenic.com/bts/\n" +msgid " (Current patch tool may be incompatible with patch, or misconfigured. Please check your .hgrc file)\n" +msgstr "" + +msgid " Internal patcher failure, please report this error to http://mercurial.selenic.com/bts/\n" msgstr "" msgid "Checking commit editor...\n" @@ -6012,15 +5957,12 @@ msgstr "utiliser \"hg help\" pour la liste complète des commandes" msgid "use \"hg help\" for the full list of commands or \"hg -v\" for details" -msgstr "" -"utiliser \"hg help\" pour la liste complète des commandes ou \"hg -v\" pour " -"plus de détails" +msgstr "utiliser \"hg help\" pour la liste complète des commandes ou \"hg -v\" pour plus de détails" # la chaîne passée est préfixée par un espace #, python-format msgid "use \"hg -v help%s\" to show aliases and global options" -msgstr "" -"utiliser \"hg -v help%s\" pour afficher les alias et les options globales" +msgstr "utiliser \"hg -v help%s\" pour afficher les alias et les options globales" #, python-format msgid "use \"hg -v help %s\" to show global options" @@ -6266,9 +6208,7 @@ msgid "%s - use \"hg update\" instead" msgstr "" -msgid "" -"working dir not at a head rev - use \"hg update\" or merge with an explicit " -"rev" +msgid "working dir not at a head rev - use \"hg update\" or merge with an explicit rev" msgstr "" msgid "" @@ -7233,9 +7173,7 @@ msgid "[-nibt] [-r REV] [SOURCE]" msgstr "" -msgid "" -"directory strip option for patch. This has the same meaning as the " -"corresponding patch option" +msgid "directory strip option for patch. This has the same meaning as the corresponding patch option" msgstr "" msgid "base path" @@ -7649,9 +7587,7 @@ msgstr "** exception inconnue rencontrée, détails ci-dessous\n" msgid "** report bug details to http://mercurial.selenic.com/bts/\n" -msgstr "" -"** veuillez signaler le problème en détails sur http://www.selenic.com/" -"mercurial/bts\n" +msgstr "** veuillez signaler le problème en détails sur http://www.selenic.com/mercurial/bts\n" msgid "** or mercurial@selenic.com\n" msgstr "** ou mercurial@selenic.com\n" @@ -7690,12 +7626,8 @@ msgid "Option --cwd may not be abbreviated!" msgstr "L'option --cwd ne peut être abrégée !" -msgid "" -"Option -R has to be separated from other options (e.g. not -qR) and --" -"repository may only be abbreviated as --repo!" -msgstr "" -"L'option -R doit être séparée des autres options (autrement dit -qR est " -"invalide) et --repository ne peut être abrégé qu'en --repo !" +msgid "Option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo!" +msgstr "L'option -R doit être séparée des autres options (autrement dit -qR est invalide) et --repository ne peut être abrégé qu'en --repo !" #, python-format msgid "Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n" @@ -7712,9 +7644,7 @@ msgid "unrecognized profiling format '%s' - Ignored\n" msgstr "" -msgid "" -"lsprof not available - install from http://codespeak.net/svn/user/arigo/hack/" -"misc/lsprof/" +msgid "lsprof not available - install from http://codespeak.net/svn/user/arigo/hack/misc/lsprof/" msgstr "" #, python-format @@ -7836,9 +7766,7 @@ msgid "destination '%s' is not empty" msgstr "" -msgid "" -"src repository does not support revision lookup and so doesn't support clone " -"by revision" +msgid "src repository does not support revision lookup and so doesn't support clone by revision" msgstr "" msgid "clone from remote to remote not supported" @@ -7849,16 +7777,13 @@ msgstr "comparaison avec %s\n" #, python-format -msgid "" -"%d files updated, %d files merged, %d files removed, %d files unresolved\n" +msgid "%d files updated, %d files merged, %d files removed, %d files unresolved\n" msgstr "" msgid "use 'hg resolve' to retry unresolved file merges\n" msgstr "" -msgid "" -"use 'hg resolve' to retry unresolved file merges or 'hg update -C' to " -"abandon\n" +msgid "use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon\n" msgstr "" msgid "(branch merge, don't forget to commit)\n" @@ -8126,9 +8051,7 @@ msgid "requesting all changes\n" msgstr "" -msgid "" -"Partial pull cannot be done because other repository doesn't support " -"changegroupsubset." +msgid "Partial pull cannot be done because other repository doesn't support changegroupsubset." msgstr "" #, python-format @@ -8247,9 +8170,7 @@ msgstr "" #, python-format -msgid "" -"untracked file in working directory differs from file in requested revision: " -"'%s'" +msgid "untracked file in working directory differs from file in requested revision: '%s'" msgstr "" #, python-format diff -r 8227a631c6b4 -r 5172261b92af mercurial/byterange.py --- a/mercurial/byterange.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/byterange.py Mon Apr 19 18:59:02 2010 +0200 @@ -25,11 +25,6 @@ import urllib2 import email.Utils -try: - from cStringIO import StringIO -except ImportError, msg: - from StringIO import StringIO - class RangeError(IOError): """Error raised when an unsatisfiable range is requested.""" pass diff -r 8227a631c6b4 -r 5172261b92af mercurial/cmdutil.py --- a/mercurial/cmdutil.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/cmdutil.py Mon Apr 19 18:59:02 2010 +0200 @@ -289,11 +289,18 @@ '''find renamed files -- yields (before, after, score) tuples''' copies = {} ctx = repo['.'] - for r in removed: + for i, r in enumerate(removed): + repo.ui.progress(_('searching'), i, total=len(removed)) if r not in ctx: continue fctx = ctx.filectx(r) + # lazily load text + @util.cachefunc + def data(): + orig = fctx.data() + return orig, mdiff.splitnewlines(orig) + def score(text): if not len(text): return 0.0 @@ -301,14 +308,13 @@ return 1.0 if threshold == 1.0: return 0.0 - orig = fctx.data() + orig, lines = data() # bdiff.blocks() returns blocks of matching lines # count the number of bytes in each equal = 0 - alines = mdiff.splitnewlines(text) matches = bdiff.blocks(text, orig) for x1, x2, y1, y2 in matches: - for line in alines[x1:x2]: + for line in lines[y1:y2]: equal += len(line) lengths = len(text) + len(orig) @@ -319,6 +325,7 @@ myscore = score(repo.wread(a)) if myscore >= bestscore: copies[a] = (r, myscore) + repo.ui.progress(_('searching'), None) for dest, v in copies.iteritems(): source, score = v @@ -356,9 +363,7 @@ removed.append(abs) elif repo.dirstate[abs] == 'a': added.append(abs) - if not dry_run: - repo.remove(deleted) - repo.add(unknown) + copies = {} if similarity > 0: for old, new, score in findrenames(repo, added + unknown, removed + deleted, similarity): @@ -366,8 +371,17 @@ repo.ui.status(_('recording removal of %s as rename to %s ' '(%d%% similar)\n') % (m.rel(old), m.rel(new), score * 100)) - if not dry_run: + copies[new] = old + + if not dry_run: + wlock = repo.wlock() + try: + repo.remove(deleted) + repo.add(unknown) + for new, old in copies.iteritems(): repo.copy(old, new) + finally: + wlock.release() def copy(ui, repo, pats, opts, rename=False): # called with the repo lock held @@ -646,6 +660,46 @@ if runfn: return runfn() +def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False, + opts=None): + '''export changesets as hg patches.''' + + total = len(revs) + revwidth = max([len(str(rev)) for rev in revs]) + + def single(rev, seqno, fp): + ctx = repo[rev] + node = ctx.node() + parents = [p.node() for p in ctx.parents() if p] + branch = ctx.branch() + if switch_parent: + parents.reverse() + prev = (parents and parents[0]) or nullid + + if not fp: + fp = make_file(repo, template, node, total=total, seqno=seqno, + revwidth=revwidth, mode='ab') + if fp != sys.stdout and hasattr(fp, 'name'): + repo.ui.note("%s\n" % fp.name) + + fp.write("# HG changeset patch\n") + fp.write("# User %s\n" % ctx.user()) + fp.write("# Date %d %d\n" % ctx.date()) + if branch and (branch != 'default'): + fp.write("# Branch %s\n" % branch) + fp.write("# Node ID %s\n" % hex(node)) + fp.write("# Parent %s\n" % hex(prev)) + if len(parents) > 1: + fp.write("# Parent %s\n" % hex(parents[1])) + fp.write(ctx.description().rstrip()) + fp.write("\n\n") + + for chunk in patch.diff(repo, prev, node, opts=opts): + fp.write(chunk) + + for seqno, rev in enumerate(revs): + single(rev, seqno + 1, fp) + class changeset_printer(object): '''show changeset information when templating not requested.''' @@ -681,7 +735,7 @@ if self.buffered: self.ui.pushbuffer() self._show(ctx, copies, props) - self.hunk[ctx.rev()] = self.ui.popbuffer() + self.hunk[ctx.rev()] = self.ui.popbuffer(labeled=True) else: self._show(ctx, copies, props) @@ -691,7 +745,8 @@ rev = ctx.rev() if self.ui.quiet: - self.ui.write("%d:%s\n" % (rev, short(changenode))) + self.ui.write("%d:%s\n" % (rev, short(changenode)), + label='log.node') return log = self.repo.changelog @@ -702,52 +757,66 @@ parents = [(p, hexfunc(log.node(p))) for p in self._meaningful_parentrevs(log, rev)] - self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode))) + self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode)), + label='log.changeset') branch = ctx.branch() # don't show the default branch name if branch != 'default': branch = encoding.tolocal(branch) - self.ui.write(_("branch: %s\n") % branch) + self.ui.write(_("branch: %s\n") % branch, + label='log.branch') for tag in self.repo.nodetags(changenode): - self.ui.write(_("tag: %s\n") % tag) + self.ui.write(_("tag: %s\n") % tag, + label='log.tag') for parent in parents: - self.ui.write(_("parent: %d:%s\n") % parent) + self.ui.write(_("parent: %d:%s\n") % parent, + label='log.parent') if self.ui.debugflag: mnode = ctx.manifestnode() self.ui.write(_("manifest: %d:%s\n") % - (self.repo.manifest.rev(mnode), hex(mnode))) - self.ui.write(_("user: %s\n") % ctx.user()) - self.ui.write(_("date: %s\n") % date) + (self.repo.manifest.rev(mnode), hex(mnode)), + label='ui.debug log.manifest') + self.ui.write(_("user: %s\n") % ctx.user(), + label='log.user') + self.ui.write(_("date: %s\n") % date, + label='log.date') if self.ui.debugflag: files = self.repo.status(log.parents(changenode)[0], changenode)[:3] for key, value in zip([_("files:"), _("files+:"), _("files-:")], files): if value: - self.ui.write("%-12s %s\n" % (key, " ".join(value))) + self.ui.write("%-12s %s\n" % (key, " ".join(value)), + label='ui.debug log.files') elif ctx.files() and self.ui.verbose: - self.ui.write(_("files: %s\n") % " ".join(ctx.files())) + self.ui.write(_("files: %s\n") % " ".join(ctx.files()), + label='ui.note log.files') if copies and self.ui.verbose: copies = ['%s (%s)' % c for c in copies] - self.ui.write(_("copies: %s\n") % ' '.join(copies)) + self.ui.write(_("copies: %s\n") % ' '.join(copies), + label='ui.note log.copies') extra = ctx.extra() if extra and self.ui.debugflag: for key, value in sorted(extra.items()): self.ui.write(_("extra: %s=%s\n") - % (key, value.encode('string_escape'))) + % (key, value.encode('string_escape')), + label='ui.debug log.extra') description = ctx.description().strip() if description: if self.ui.verbose: - self.ui.write(_("description:\n")) - self.ui.write(description) + self.ui.write(_("description:\n"), + label='ui.note log.description') + self.ui.write(description, + label='ui.note log.description') self.ui.write("\n\n") else: self.ui.write(_("summary: %s\n") % - description.splitlines()[0]) + description.splitlines()[0], + label='log.summary') self.ui.write("\n") self.showpatch(changenode) @@ -755,10 +824,10 @@ def showpatch(self, node): if self.patch: prev = self.repo.changelog.parents(node)[0] - chunks = patch.diff(self.repo, prev, node, match=self.patch, - opts=patch.diffopts(self.ui, self.diffopts)) - for chunk in chunks: - self.ui.write(chunk) + chunks = patch.diffui(self.repo, prev, node, match=self.patch, + opts=patch.diffopts(self.ui, self.diffopts)) + for chunk, label in chunks: + self.ui.write(chunk, label=label) self.ui.write("\n") def _meaningful_parentrevs(self, log, rev): @@ -875,7 +944,7 @@ msg = _("%s: no key named '%s'") raise util.Abort(msg % (self.t.mapfile, inst.args[0])) except SyntaxError, inst: - raise util.Abort(_('%s: %s') % (self.t.mapfile, inst.args[0])) + raise util.Abort('%s: %s' % (self.t.mapfile, inst.args[0])) def show_changeset(ui, repo, opts, buffered=False, matchfn=False): """show one changeset using template or regular display. diff -r 8227a631c6b4 -r 5172261b92af mercurial/commands.py --- a/mercurial/commands.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/commands.py Mon Apr 19 18:59:02 2010 +0200 @@ -12,8 +12,8 @@ import hg, util, revlog, bundlerepo, extensions, copies, error import patch, help, mdiff, url, encoding, templatekw import archival, changegroup, cmdutil, sshserver, hbisect -from hgweb import server -import merge as merge_ +from hgweb import server, hgweb_mod, hgwebdir_mod +import merge as mergemod import minirst # Commands start here, listed alphabetically @@ -158,8 +158,10 @@ By default, the revision used is the parent of the working directory; use -r/--rev to specify a different revision. - To specify the type of archive to create, use -t/--type. Valid - types are: + The archive type is automatically detected based on file + extension (or override using -t/--type). + + Valid types are: :``files``: a directory full of files (default) :``tar``: tar archive, uncompressed @@ -184,16 +186,32 @@ dest = cmdutil.make_filename(repo, dest, node) if os.path.realpath(dest) == repo.root: raise util.Abort(_('repository root cannot be destination')) - matchfn = cmdutil.match(repo, [], opts) - kind = opts.get('type') or 'files' + + def guess_type(): + exttypes = { + 'tar': ['.tar'], + 'tbz2': ['.tbz2', '.tar.bz2'], + 'tgz': ['.tgz', '.tar.gz'], + 'zip': ['.zip'], + } + + for type, extensions in exttypes.items(): + if util.any(dest.endswith(ext) for ext in extensions): + return type + return None + + kind = opts.get('type') or guess_type() or 'files' prefix = opts.get('prefix') + if dest == '-': if kind == 'files': raise util.Abort(_('cannot archive plain files to stdout')) dest = sys.stdout if not prefix: prefix = os.path.basename(repo.root) + '-%h' + prefix = cmdutil.make_filename(repo, prefix, node) + matchfn = cmdutil.match(repo, [], opts) archival.archive(repo, dest, node, kind, not opts.get('no_decode'), matchfn, prefix) @@ -1156,14 +1174,16 @@ diffopts = patch.diffopts(ui, opts) m = cmdutil.match(repo, pats, opts) - it = patch.diff(repo, node1, node2, match=m, opts=diffopts) if stat: + it = patch.diff(repo, node1, node2, match=m, opts=diffopts) width = ui.interactive() and util.termwidth() or 80 - ui.write(patch.diffstat(util.iterlines(it), width=width, - git=diffopts.git)) + for chunk, label in patch.diffstatui(util.iterlines(it), width=width, + git=diffopts.git): + ui.write(chunk, label=label) else: - for chunk in it: - ui.write(chunk) + it = patch.diffui(repo, node1, node2, match=m, opts=diffopts) + for chunk, label in it: + ui.write(chunk, label=label) def export(ui, repo, *changesets, **opts): """dump the header and diffs for one or more changesets @@ -1208,7 +1228,7 @@ ui.note(_('exporting patches:\n')) else: ui.note(_('exporting patch:\n')) - patch.export(repo, revs, template=opts.get('output'), + cmdutil.export(repo, revs, template=opts.get('output'), switch_parent=opts.get('switch_parent'), opts=patch.diffopts(ui, opts)) @@ -1335,6 +1355,7 @@ iter = [('', l) for l in states] for change, l in iter: cols = [fn, str(rev)] + before, match, after = None, None, None if opts.get('line_number'): cols.append(str(l.linenum)) if opts.get('all'): @@ -1349,8 +1370,15 @@ continue filerevmatches[c] = 1 else: - cols.append(l.line) - ui.write(sep.join(cols), eol) + before = l.line[:l.colstart] + match = l.line[l.colstart:l.colend] + after = l.line[l.colend:] + ui.write(sep.join(cols)) + if before is not None: + ui.write(sep + before) + ui.write(match, label='grep.match') + ui.write(after) + ui.write(eol) found = True return found @@ -2583,7 +2611,7 @@ raise util.Abort(_('no files or directories specified; ' 'use --all to remerge all files')) - ms = merge_.mergestate(repo) + ms = mergemod.mergestate(repo) m = cmdutil.match(repo, pats, opts) for f in ms: @@ -2592,7 +2620,9 @@ if nostatus: ui.write("%s\n" % f) else: - ui.write("%s %s\n" % (ms[f].upper(), f)) + ui.write("%s %s\n" % (ms[f].upper(), f), + label='resolve.' + + {'u': 'unresolved', 'r': 'resolved'}[ms[f]]) elif mark: ms.mark(f, "r") elif unmark: @@ -2829,8 +2859,8 @@ finally: wlock.release() -def rollback(ui, repo): - """roll back the last transaction +def rollback(ui, repo, **opts): + """roll back the last transaction (dangerous) This command should be used with care. There is only one level of rollback, and there is no way to undo a rollback. It will also @@ -2856,7 +2886,7 @@ repository; for example an in-progress pull from the repository may fail if a rollback is performed. """ - repo.rollback() + repo.rollback(opts.get('dry_run')) def root(ui, repo): """print the root (top) of the current working directory @@ -2866,13 +2896,17 @@ ui.write(repo.root + "\n") def serve(ui, repo, **opts): - """export the repository via HTTP + """start stand-alone webserver Start a local HTTP repository browser and pull server. By default, the server logs accesses to stdout and errors to stderr. Use the -A/--accesslog and -E/--errorlog options to log to files. + + To have the server choose a free port number to listen on, specify + a port number of 0; in this case, the server will print the port + number it uses. """ if opts["stdio"]: @@ -2882,25 +2916,35 @@ s = sshserver.sshserver(ui, repo) s.serve_forever() + # this way we can check if something was given in the command-line + if opts.get('port'): + opts['port'] = int(opts.get('port')) + baseui = repo and repo.baseui or ui optlist = ("name templates style address port prefix ipv6" - " accesslog errorlog webdir_conf certificate encoding") + " accesslog errorlog certificate encoding") for o in optlist.split(): - if opts.get(o, None): - baseui.setconfig("web", o, str(opts[o])) - if (repo is not None) and (repo.ui != baseui): - repo.ui.setconfig("web", o, str(opts[o])) - - if repo is None and not ui.config("web", "webdir_conf"): - raise error.RepoError(_("There is no Mercurial repository here" - " (.hg not found)")) + val = opts.get(o, '') + if val in (None, ''): # should check against default options instead + continue + baseui.setconfig("web", o, val) + if repo and repo.ui != baseui: + repo.ui.setconfig("web", o, val) + + if opts.get('webdir_conf'): + app = hgwebdir_mod.hgwebdir(opts['webdir_conf'], ui) + elif repo is not None: + app = hgweb_mod.hgweb(hg.repository(repo.ui, repo.root)) + else: + raise error.RepoError(_("There is no Mercurial repository" + " here (.hg not found)")) class service(object): def init(self): util.set_signal_handler() - self.httpd = server.create_server(baseui, repo) - - if not ui.verbose: + self.httpd = server.create_server(ui, app) + + if opts['port'] and not ui.verbose: return if self.httpd.prefix: @@ -2921,8 +2965,12 @@ fqaddr = self.httpd.fqaddr if ':' in fqaddr: fqaddr = '[%s]' % fqaddr - ui.status(_('listening at http://%s%s/%s (bound to %s:%d)\n') % - (fqaddr, port, prefix, bindaddr, self.httpd.port)) + if opts['port']: + write = ui.status + else: + write = ui.write + write(_('listening at http://%s%s/%s (bound to %s:%d)\n') % + (fqaddr, port, prefix, bindaddr, self.httpd.port)) def run(self): self.httpd.serve_forever() @@ -3013,9 +3061,11 @@ format = "%%s%s" % end for f in files: - ui.write(format % repo.pathto(f, cwd)) + ui.write(format % repo.pathto(f, cwd), + label='status.' + state) if f in copy: - ui.write(' %s%s' % (repo.pathto(copy[f], cwd), end)) + ui.write(' %s%s' % (repo.pathto(copy[f], cwd), end), + label='status.copied') def summary(ui, repo, **opts): """summarize working directory state @@ -3030,33 +3080,41 @@ ctx = repo[None] parents = ctx.parents() pnode = parents[0].node() - tags = repo.tags() for p in parents: - t = ' '.join([t for t in tags if tags[t] == p.node()]) + # label with log.changeset (instead of log.parent) since this + # shows a working directory parent *changeset*: + ui.write(_('parent: %d:%s ') % (p.rev(), str(p)), + label='log.changeset') + ui.write(' '.join(p.tags()), label='log.tag') if p.rev() == -1: if not len(repo): - t += _(' (empty repository)') + ui.write(_(' (empty repository)')) else: - t += _(' (no revision checked out)') - ui.write(_('parent: %d:%s %s\n') % (p.rev(), str(p), t)) + ui.write(_(' (no revision checked out)')) + ui.write('\n') if p.description(): - ui.status(' ' + p.description().splitlines()[0].strip() + '\n') + ui.status(' ' + p.description().splitlines()[0].strip() + '\n', + label='log.summary') branch = ctx.branch() bheads = repo.branchheads(branch) m = _('branch: %s\n') % branch if branch != 'default': - ui.write(m) + ui.write(m, label='log.branch') else: - ui.status(m) + ui.status(m, label='log.branch') st = list(repo.status(unknown=True))[:6] - ms = merge_.mergestate(repo) + ms = mergemod.mergestate(repo) st.append([f for f in ms if ms[f] == 'u']) - labels = [_('%d modified'), _('%d added'), _('%d removed'), - _('%d deleted'), _('%d unknown'), _('%d ignored'), - _('%d unresolved')] + labels = [ui.label(_('%d modified'), 'status.modified'), + ui.label(_('%d added'), 'status.added'), + ui.label(_('%d removed'), 'status.removed'), + ui.label(_('%d deleted'), 'status.deleted'), + ui.label(_('%d unknown'), 'status.unknown'), + ui.label(_('%d ignored'), 'status.ignored'), + ui.label(_('%d unresolved'), 'resolve.unresolved')] t = [] for s, l in zip(st, labels): if s: @@ -3263,7 +3321,7 @@ return postincoming(ui, repo, modheads, opts.get('update'), None) def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False): - """update working directory + """update working directory (or switch revisions) Update the repository's working directory to the specified changeset. @@ -3768,7 +3826,7 @@ ('', 'no-backup', None, _('do not save backup copies of files')), ] + walkopts + dryrunopts, _('[OPTION]... [-r REV] [NAME]...')), - "rollback": (rollback, []), + "rollback": (rollback, dryrunopts), "root": (root, []), "^serve": (serve, @@ -3776,7 +3834,8 @@ ('d', 'daemon', None, _('run server in background')), ('', 'daemon-pipefds', '', _('used internally by daemon mode')), ('E', 'errorlog', '', _('name of error log file to write to')), - ('p', 'port', 0, _('port to listen on (default: 8000)')), + # use string type, then we can check if something was passed + ('p', 'port', '', _('port to listen on (default: 8000)')), ('a', 'address', '', _('address to listen on (default: all interfaces)')), ('', 'prefix', '', diff -r 8227a631c6b4 -r 5172261b92af mercurial/dirstate.py --- a/mercurial/dirstate.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/dirstate.py Mon Apr 19 18:59:02 2010 +0200 @@ -11,7 +11,6 @@ import struct, os, stat, errno import cStringIO -_unknown = ('?', 0, 0, 0) _format = ">cllll" propertycache = util.propertycache diff -r 8227a631c6b4 -r 5172261b92af mercurial/dispatch.py --- a/mercurial/dispatch.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/dispatch.py Mon Apr 19 18:59:02 2010 +0200 @@ -9,7 +9,7 @@ import os, sys, atexit, signal, pdb, socket, errno, shlex, time import util, commands, hg, fancyopts, extensions, hook, error import cmdutil, encoding -import ui as _ui +import ui as uimod def run(): "run the command in sys.argv" @@ -18,7 +18,7 @@ def dispatch(args): "run the command specified in args" try: - u = _ui.ui() + u = uimod.ui() if '--traceback' in args: u.setconfig('ui', 'traceback', 'on') except util.Abort, inst: diff -r 8227a631c6b4 -r 5172261b92af mercurial/filelog.py --- a/mercurial/filelog.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/filelog.py Mon Apr 19 18:59:02 2010 +0200 @@ -33,9 +33,7 @@ def add(self, text, meta, transaction, link, p1=None, p2=None): if meta or text.startswith('\1\n'): - mt = "" - if meta: - mt = ["%s: %s\n" % (k, v) for k, v in sorted(meta.iteritems())] + mt = ["%s: %s\n" % (k, v) for k, v in sorted(meta.iteritems())] text = "\1\n%s\1\n%s" % ("".join(mt), text) return self.addrevision(text, transaction, link, p1, p2) diff -r 8227a631c6b4 -r 5172261b92af mercurial/graphmod.py --- a/mercurial/graphmod.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/graphmod.py Mon Apr 19 18:59:02 2010 +0200 @@ -115,7 +115,7 @@ edges.append((ecol, next.index(eid), colors[eid])) elif eid == cur: for p in parents: - edges.append((ecol, next.index(p), colors[p])) + edges.append((ecol, next.index(p), color)) # Yield and move on yield (cur, type, data, (col, color), edges) diff -r 8227a631c6b4 -r 5172261b92af mercurial/help.py --- a/mercurial/help.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/help.py Mon Apr 19 18:59:02 2010 +0200 @@ -25,7 +25,7 @@ break start = line[:3] - if start == '\"\"\"' or start == "\'\'\'": + if start == '"""' or start == "'''": line = line[3:] while line: if line.rstrip().endswith(start): diff -r 8227a631c6b4 -r 5172261b92af mercurial/hg.py --- a/mercurial/hg.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/hg.py Mon Apr 19 18:59:02 2010 +0200 @@ -10,8 +10,8 @@ from lock import release import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo import lock, util, extensions, error, encoding, node -import merge as _merge -import verify as _verify +import merge as mergemod +import verify as verifymod import errno, os, shutil def _local(path): @@ -359,7 +359,7 @@ def update(repo, node): """update the working directory to node, merging linear changes""" - stats = _merge.update(repo, node, False, False, None) + stats = mergemod.update(repo, node, False, False, None) _showstats(repo, stats) if stats[3]: repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n")) @@ -370,14 +370,14 @@ def clean(repo, node, show_stats=True): """forcibly switch the working directory to node, clobbering changes""" - stats = _merge.update(repo, node, False, True, None) + stats = mergemod.update(repo, node, False, True, None) if show_stats: _showstats(repo, stats) return stats[3] > 0 def merge(repo, node, force=None, remind=True): """branch merge with node, resolving changes""" - stats = _merge.update(repo, node, True, force, False) + stats = mergemod.update(repo, node, True, force, False) _showstats(repo, stats) if stats[3]: repo.ui.status(_("use 'hg resolve' to retry unresolved file merges " @@ -388,8 +388,8 @@ def revert(repo, node, choose): """revert changes to revision in node without updating dirstate""" - return _merge.update(repo, node, False, True, choose)[3] > 0 + return mergemod.update(repo, node, False, True, choose)[3] > 0 def verify(repo): """verify the consistency of a repository""" - return _verify.verify(repo) + return verifymod.verify(repo) diff -r 8227a631c6b4 -r 5172261b92af mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/hgweb/hgweb_mod.py Mon Apr 19 18:59:02 2010 +0200 @@ -10,7 +10,6 @@ from mercurial import ui, hg, hook, error, encoding, templater from common import get_mtime, ErrorResponse, permhooks from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR -from common import HTTP_UNAUTHORIZED, HTTP_METHOD_NOT_ALLOWED from request import wsgirequest import webcommands, protocol, webutil diff -r 8227a631c6b4 -r 5172261b92af mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/hgweb/hgwebdir_mod.py Mon Apr 19 18:59:02 2010 +0200 @@ -195,11 +195,8 @@ yield {"type" : i[0], "extension": i[1], "node": nodeid, "url": url} - sortdefault = None, False - def entries(sortcolumn="", descending=False, subdir="", **map): + def rawentries(subdir="", **map): - rows = [] - parity = paritygen(self.stripecount) descend = self.ui.configbool('web', 'descend', True) for name, path in self.repos: @@ -251,19 +248,19 @@ lastchange=d, lastchange_sort=d[1]-d[0], archives=archivelist(u, "tip", url)) - if (not sortcolumn or (sortcolumn, descending) == sortdefault): - # fast path for unsorted output - row['parity'] = parity.next() - yield row - else: - rows.append((row["%s_sort" % sortcolumn], row)) - if rows: - rows.sort() - if descending: - rows.reverse() - for key, row in rows: - row['parity'] = parity.next() - yield row + yield row + + sortdefault = None, False + def entries(sortcolumn="", descending=False, subdir="", **map): + rows = rawentries(subdir=subdir, **map) + + if sortcolumn and sortdefault != (sortcolumn, descending): + sortkey = '%s_sort' % sortcolumn + rows = sorted(rows, key=lambda x: x[sortkey], + reverse=descending) + for row, parity in zip(rows, paritygen(self.stripecount)): + row['parity'] = parity + yield row self.refresh() sortable = ["name", "description", "contact", "lastchange"] diff -r 8227a631c6b4 -r 5172261b92af mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/hgweb/server.py Mon Apr 19 18:59:02 2010 +0200 @@ -7,9 +7,7 @@ # GNU General Public License version 2 or any later version. import os, sys, errno, urllib, BaseHTTPServer, socket, SocketServer, traceback -from mercurial import hg, util, error -from hgweb_mod import hgweb -from hgwebdir_mod import hgwebdir +from mercurial import util, error from mercurial.i18n import _ def _splitURI(uri): @@ -195,104 +193,85 @@ self.close_connection = True pass -def create_server(ui, repo): - use_threads = True - - def openlog(opt, default): - if opt and opt != '-': - return open(opt, 'a') - return default - - if repo is None: - myui = ui +try: + from threading import activeCount + _mixin = SocketServer.ThreadingMixIn +except ImportError: + if hasattr(os, "fork"): + _mixin = SocketServer.ForkingMixIn else: - myui = repo.ui - address = myui.config("web", "address", "") - port = int(myui.config("web", "port", 8000)) - prefix = myui.config("web", "prefix", "") - if prefix: - prefix = "/" + prefix.strip("/") - use_ipv6 = myui.configbool("web", "ipv6") - webdir_conf = myui.config("web", "webdir_conf") - ssl_cert = myui.config("web", "certificate") - accesslog = openlog(myui.config("web", "accesslog", "-"), sys.stdout) - errorlog = openlog(myui.config("web", "errorlog", "-"), sys.stderr) + class _mixin: + pass + +def openlog(opt, default): + if opt and opt != '-': + return open(opt, 'a') + return default - if use_threads: - try: - from threading import activeCount - except ImportError: - use_threads = False +class MercurialHTTPServer(object, _mixin, BaseHTTPServer.HTTPServer): - if use_threads: - _mixin = SocketServer.ThreadingMixIn - else: - if hasattr(os, "fork"): - _mixin = SocketServer.ForkingMixIn - else: - class _mixin: - pass + # SO_REUSEADDR has broken semantics on windows + if os.name == 'nt': + allow_reuse_address = 0 - class MercurialHTTPServer(object, _mixin, BaseHTTPServer.HTTPServer): + def __init__(self, ui, app, addr, handler, **kwargs): + BaseHTTPServer.HTTPServer.__init__(self, addr, handler, **kwargs) + self.daemon_threads = True + self.application = app - # SO_REUSEADDR has broken semantics on windows - if os.name == 'nt': - allow_reuse_address = 0 + ssl_cert = ui.config('web', 'certificate') + if ssl_cert: + try: + from OpenSSL import SSL + ctx = SSL.Context(SSL.SSLv23_METHOD) + except ImportError: + raise util.Abort(_("SSL support is unavailable")) + ctx.use_privatekey_file(ssl_cert) + ctx.use_certificate_file(ssl_cert) + sock = socket.socket(self.address_family, self.socket_type) + self.socket = SSL.Connection(ctx, sock) + self.server_bind() + self.server_activate() - def __init__(self, *args, **kargs): - BaseHTTPServer.HTTPServer.__init__(self, *args, **kargs) - self.accesslog = accesslog - self.errorlog = errorlog - self.daemon_threads = True - def make_handler(): - if webdir_conf: - hgwebobj = hgwebdir(webdir_conf, ui) - elif repo is not None: - hgwebobj = hgweb(hg.repository(repo.ui, repo.root)) - else: - raise error.RepoError(_("There is no Mercurial repository" - " here (.hg not found)")) - return hgwebobj - self.application = make_handler() + prefix = ui.config('web', 'prefix', '') + if prefix: + prefix = '/' + prefix.strip('/') + self.prefix = prefix - if ssl_cert: - try: - from OpenSSL import SSL - ctx = SSL.Context(SSL.SSLv23_METHOD) - except ImportError: - raise util.Abort(_("SSL support is unavailable")) - ctx.use_privatekey_file(ssl_cert) - ctx.use_certificate_file(ssl_cert) - sock = socket.socket(self.address_family, self.socket_type) - self.socket = SSL.Connection(ctx, sock) - self.server_bind() - self.server_activate() + alog = openlog(ui.config('web', 'accesslog', '-'), sys.stdout) + elog = openlog(ui.config('web', 'errorlog', '-'), sys.stderr) + self.accesslog = alog + self.errorlog = elog + + self.addr, self.port = self.socket.getsockname()[0:2] + self.fqaddr = socket.getfqdn(addr[0]) - self.addr, self.port = self.socket.getsockname()[0:2] - self.prefix = prefix - self.fqaddr = socket.getfqdn(address) - - class IPv6HTTPServer(MercurialHTTPServer): - address_family = getattr(socket, 'AF_INET6', None) +class IPv6HTTPServer(MercurialHTTPServer): + address_family = getattr(socket, 'AF_INET6', None) + def __init__(self, *args, **kwargs): + if self.address_family is None: + raise error.RepoError(_('IPv6 is not available on this system')) + super(IPv6HTTPServer, self).__init__(*args, **kwargs) - def __init__(self, *args, **kwargs): - if self.address_family is None: - raise error.RepoError(_('IPv6 is not available on this system')) - super(IPv6HTTPServer, self).__init__(*args, **kwargs) +def create_server(ui, app): - if ssl_cert: + if ui.config('web', 'certificate'): handler = _shgwebhandler else: handler = _hgwebhandler + if ui.configbool('web', 'ipv6'): + cls = IPv6HTTPServer + else: + cls = MercurialHTTPServer + # ugly hack due to python issue5853 (for threaded use) import mimetypes; mimetypes.init() + address = ui.config('web', 'address', '') + port = int(ui.config('web', 'port', 8000)) try: - if use_ipv6: - return IPv6HTTPServer((address, port), handler) - else: - return MercurialHTTPServer((address, port), handler) + return cls(ui, app, (address, port), handler) except socket.error, inst: raise util.Abort(_("cannot start server at '%s:%d': %s") % (address, port, inst.args[1])) diff -r 8227a631c6b4 -r 5172261b92af mercurial/localrepo.py --- a/mercurial/localrepo.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/localrepo.py Mon Apr 19 18:59:02 2010 +0200 @@ -11,9 +11,10 @@ import changelog, dirstate, filelog, manifest, context import lock, transaction, store, encoding import util, extensions, hook, error -import match as match_ -import merge as merge_ -import tags as tags_ +import match as matchmod +import merge as mergemod +import tags as tagsmod +import url as urlmod from lock import release import weakref, stat, errno, os, time, inspect propertycache = util.propertycache @@ -207,7 +208,7 @@ if '.hgtags' not in self.dirstate: self.add(['.hgtags']) - m = match_.exact(self.root, '', ['.hgtags']) + m = matchmod.exact(self.root, '', ['.hgtags']) tagnode = self.commit(message, user, date, extra=extra, match=m) for name in names: @@ -268,8 +269,8 @@ alltags = {} # map tag name to (node, hist) tagtypes = {} - tags_.findglobaltags(self.ui, self, alltags, tagtypes) - tags_.readlocaltags(self.ui, self, alltags, tagtypes) + tagsmod.findglobaltags(self.ui, self, alltags, tagtypes) + tagsmod.readlocaltags(self.ui, self, alltags, tagtypes) # Build the return dicts. Have to re-encode tag names because # the tags module always uses UTF-8 (in order not to lose info @@ -410,9 +411,8 @@ for branch, newnodes in newbranches.iteritems(): bheads = partial.setdefault(branch, []) bheads.extend(newnodes) - if len(bheads) < 2: + if len(bheads) <= 1: continue - newbheads = [] # starting from tip means fewer passes over reachable while newnodes: latest = newnodes.pop() @@ -420,9 +420,8 @@ continue minbhrev = self[min([self[bh].rev() for bh in bheads])].node() reachable = self.changelog.reachable(latest, minbhrev) + reachable.remove(latest) bheads = [b for b in bheads if b not in reachable] - newbheads.insert(0, latest) - bheads.extend(newbheads) partial[branch] = bheads def lookup(self, key): @@ -503,7 +502,7 @@ for pat, cmd in self.ui.configitems(filter): if cmd == '!': continue - mf = match_.match(self.root, '', [pat]) + mf = matchmod.match(self.root, '', [pat]) fn = None params = cmd for name, filterfn in self._datafilters.iteritems(): @@ -554,7 +553,7 @@ def wwritedata(self, filename, data): return self._filter("decode", filename, data) - def transaction(self): + def transaction(self, desc): tr = self._transref and self._transref() or None if tr and tr.running(): return tr.nest() @@ -571,10 +570,12 @@ ds = "" self.opener("journal.dirstate", "w").write(ds) self.opener("journal.branch", "w").write(self.dirstate.branch()) + self.opener("journal.desc", "w").write("%d\n%s\n" % (len(self), desc)) renames = [(self.sjoin("journal"), self.sjoin("undo")), (self.join("journal.dirstate"), self.join("undo.dirstate")), - (self.join("journal.branch"), self.join("undo.branch"))] + (self.join("journal.branch"), self.join("undo.branch")), + (self.join("journal.desc"), self.join("undo.desc"))] tr = transaction.transaction(self.ui.warn, self.sopener, self.sjoin("journal"), aftertrans(renames), @@ -597,13 +598,26 @@ finally: lock.release() - def rollback(self): + def rollback(self, dryrun=False): wlock = lock = None try: wlock = self.wlock() lock = self.lock() if os.path.exists(self.sjoin("undo")): - self.ui.status(_("rolling back last transaction\n")) + try: + args = self.opener("undo.desc", "r").read().splitlines() + if len(args) >= 3 and self.ui.verbose: + desc = _("rolling back to revision %s" + " (undo %s: %s)\n") % ( + args[0], args[1], args[2]) + elif len(args) >= 2: + desc = _("rolling back to revision %s (undo %s)\n") % ( + args[0], args[1]) + except IOError: + desc = _("rolling back unknown transaction\n") + self.ui.status(desc) + if dryrun: + return transaction.rollback(self.sopener, self.sjoin("undo"), self.ui.warn) util.rename(self.join("undo.dirstate"), self.join("dirstate")) @@ -767,7 +781,7 @@ raise util.Abort('%s: %s' % (f, msg)) if not match: - match = match_.always(self.root, '') + match = matchmod.always(self.root, '') if not force: vdirs = [] @@ -824,7 +838,7 @@ and self[None].branch() == self['.'].branch()): return None - ms = merge_.mergestate(self) + ms = mergemod.mergestate(self) for f in changes[0]: if f in ms and ms[f] == 'u': raise util.Abort(_("unresolved merge conflicts " @@ -890,7 +904,7 @@ lock = self.lock() try: - tr = self.transaction() + tr = self.transaction("commit") trp = weakref.proxy(tr) # check in files @@ -996,7 +1010,7 @@ working = ctx2.rev() is None parentworking = working and ctx1 == self['.'] - match = match or match_.always(self.root, self.getcwd()) + match = match or matchmod.always(self.root, self.getcwd()) listignored, listclean, listunknown = ignored, clean, unknown # load earliest manifest first for caching reasons @@ -1396,7 +1410,7 @@ self.ui.debug("found new changesets starting at " + " ".join([short(f) for f in fetch]) + "\n") - self.ui.progress(_('searching'), None, unit=_('queries')) + self.ui.progress(_('searching'), None) self.ui.debug("%d total queries\n" % reqcnt) return base.keys(), list(fetch), heads @@ -1829,7 +1843,7 @@ yield chnk self.ui.progress(_('bundling changes'), cnt, unit=_('chunks')) cnt += 1 - self.ui.progress(_('bundling changes'), None, unit=_('chunks')) + self.ui.progress(_('bundling changes'), None) # Figure out which manifest nodes (of the ones we think might be @@ -1857,7 +1871,7 @@ yield chnk self.ui.progress(_('bundling manifests'), cnt, unit=_('chunks')) cnt += 1 - self.ui.progress(_('bundling manifests'), None, unit=_('chunks')) + self.ui.progress(_('bundling manifests'), None) # These are no longer needed, dereference and toss the memory for # them. @@ -1906,7 +1920,7 @@ del msng_filenode_set[fname] # Signal that no more groups are left. yield changegroup.closechunk() - self.ui.progress(_('bundling files'), None, unit=_('chunks')) + self.ui.progress(_('bundling files'), None) if msng_cl_lst: self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source) @@ -1958,7 +1972,7 @@ self.ui.progress(_('bundling changes'), cnt, unit=_('chunks')) cnt += 1 yield chnk - self.ui.progress(_('bundling changes'), None, unit=_('chunks')) + self.ui.progress(_('bundling changes'), None) mnfst = self.manifest nodeiter = gennodelst(mnfst) @@ -1967,7 +1981,7 @@ self.ui.progress(_('bundling manifests'), cnt, unit=_('chunks')) cnt += 1 yield chnk - self.ui.progress(_('bundling manifests'), None, unit=_('chunks')) + self.ui.progress(_('bundling manifests'), None) cnt = 0 for fname in sorted(changedfiles): @@ -1985,7 +1999,7 @@ _('bundling files'), cnt, item=fname, unit=_('chunks')) cnt += 1 yield chnk - self.ui.progress(_('bundling files'), None, unit=_('chunks')) + self.ui.progress(_('bundling files'), None) yield changegroup.closechunk() @@ -2016,6 +2030,7 @@ self.hook('prechangegroup', throw=True, source=srctype, url=url) changesets = files = revisions = 0 + efiles = set() # write changelog data to temp files so concurrent readers will not see # inconsistent view @@ -2023,7 +2038,7 @@ cl.delayupdate() oldheads = len(cl.heads()) - tr = self.transaction() + tr = self.transaction("\n".join([srctype, urlmod.hidepassword(url)])) try: trp = weakref.proxy(tr) # pull off the changeset group @@ -2033,8 +2048,10 @@ step = _('changesets') count = 1 ui = self.ui + total = None def __call__(self): - self.ui.progress(self.step, self.count, unit=_('chunks')) + self.ui.progress(self.step, self.count, unit=_('chunks'), + total=self.total) self.count += 1 pr = prog() chunkiter = changegroup.chunkiter(source, progress=pr) @@ -2042,12 +2059,16 @@ raise util.Abort(_("received changelog group is empty")) clend = len(cl) changesets = clend - clstart + for c in xrange(clstart, clend): + efiles.update(self[c].files()) + efiles = len(efiles) self.ui.progress(_('changesets'), None) # pull off the manifest group self.ui.status(_("adding manifests\n")) pr.step = _('manifests') pr.count = 1 + pr.total = changesets # manifests <= changesets chunkiter = changegroup.chunkiter(source, progress=pr) # no need to check for empty manifest group here: # if the result of the merge of 1 and 2 is the same in 3 and 4, @@ -2070,14 +2091,16 @@ self.ui.status(_("adding file changes\n")) pr.step = 'files' pr.count = 1 + pr.total = efiles while 1: f = changegroup.getchunk(source) if not f: break self.ui.debug("adding %s revisions\n" % f) + pr() fl = self.file(f) o = len(fl) - chunkiter = changegroup.chunkiter(source, progress=pr) + chunkiter = changegroup.chunkiter(source) if fl.addgroup(chunkiter, revmap, trp) is None: raise util.Abort(_("received file revlog group is empty")) revisions += len(fl) - o diff -r 8227a631c6b4 -r 5172261b92af mercurial/mdiff.py --- a/mercurial/mdiff.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/mdiff.py Mon Apr 19 18:59:02 2010 +0200 @@ -125,12 +125,12 @@ else: al = splitnewlines(a) bl = splitnewlines(b) - l = list(bunidiff(a, b, al, bl, "a/" + fn1, "b/" + fn2, opts=opts)) + l = list(_unidiff(a, b, al, bl, opts=opts)) if not l: return "" - # difflib uses a space, rather than a tab - l[0] = "%s%s" % (l[0][:-2], datetag(ad)) - l[1] = "%s%s" % (l[1][:-2], datetag(bd)) + + l.insert(0, "--- a/%s%s" % (fn1, datetag(ad))) + l.insert(1, "+++ b/%s%s" % (fn2, datetag(bd))) for ln in xrange(len(l)): if l[ln][-1] != '\n': @@ -141,11 +141,10 @@ return "".join(l) -# somewhat self contained replacement for difflib.unified_diff +# creates a headerless unified diff # t1 and t2 are the text to be diffed # l1 and l2 are the text broken up into lines -# header1 and header2 are the filenames for the diff output -def bunidiff(t1, t2, l1, l2, header1, header2, opts=defaultopts): +def _unidiff(t1, t2, l1, l2, opts=defaultopts): def contextend(l, len): ret = l + opts.context if ret > len: @@ -158,10 +157,7 @@ return 0 return ret - def yieldhunk(hunk, header): - if header: - for x in header: - yield x + def yieldhunk(hunk): (astart, a2, bstart, b2, delta) = hunk aend = contextend(a2, len(l1)) alen = aend - astart @@ -184,8 +180,6 @@ for x in xrange(a2, aend): yield ' ' + l1[x] - header = ["--- %s\t\n" % header1, "+++ %s\t\n" % header2] - if opts.showfunc: funcre = re.compile('\w') @@ -236,11 +230,8 @@ astart = hunk[1] bstart = hunk[3] else: - for x in yieldhunk(hunk, header): + for x in yieldhunk(hunk): yield x - # we only want to yield the header if the files differ, and - # we only want to yield it once. - header = None if prev: # we've joined the previous hunk, record the new ending points. hunk[1] = a2 @@ -255,7 +246,7 @@ delta[len(delta):] = ['+' + x for x in new] if hunk: - for x in yieldhunk(hunk, header): + for x in yieldhunk(hunk): yield x def patchtext(bin): diff -r 8227a631c6b4 -r 5172261b92af mercurial/patch.py --- a/mercurial/patch.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/patch.py Mon Apr 19 18:59:02 2010 +0200 @@ -10,7 +10,7 @@ from node import hex, nullid, short import base85, cmdutil, mdiff, util, diffhelpers, copies import cStringIO, email.Parser, os, re -import sys, tempfile, zlib +import tempfile, zlib gitre = re.compile('diff --git a/(.*) b/(.*)') @@ -1192,20 +1192,6 @@ return -1 return err -def diffopts(ui, opts=None, untrusted=False): - def get(key, name=None, getter=ui.configbool): - return ((opts and opts.get(key)) or - getter('diff', name or key, None, untrusted=untrusted)) - return mdiff.diffopts( - text=opts and opts.get('text'), - git=get('git'), - nodates=get('nodates'), - showfunc=get('show_function', 'showfunc'), - ignorews=get('ignore_all_space', 'ignorews'), - ignorewsamount=get('ignore_space_change', 'ignorewsamount'), - ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines'), - context=get('unified', getter=ui.config)) - def updatedir(ui, repo, patches, similarity=0): '''Update dirstate after patch application according to metadata''' if not patches: @@ -1337,6 +1323,10 @@ try: return internalpatch(patchname, ui, strip, cwd, files, eolmode) except NoHunks: + ui.warn(_('internal patcher failed\n' + 'please report details to ' + 'http://mercurial.selenic.com/bts/\n' + 'or mercurial@selenic.com\n')) patcher = (util.find_exe('gpatch') or util.find_exe('patch') or 'patch') ui.debug('no valid hunks found; trying with %r instead\n' % @@ -1393,6 +1383,20 @@ class GitDiffRequired(Exception): pass +def diffopts(ui, opts=None, untrusted=False): + def get(key, name=None, getter=ui.configbool): + return ((opts and opts.get(key)) or + getter('diff', name or key, None, untrusted=untrusted)) + return mdiff.diffopts( + text=opts and opts.get('text'), + git=get('git'), + nodates=get('nodates'), + showfunc=get('show_function', 'showfunc'), + ignorews=get('ignore_all_space', 'ignorews'), + ignorewsamount=get('ignore_space_change', 'ignorewsamount'), + ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines'), + context=get('unified', getter=ui.config)) + def diff(repo, node1=None, node2=None, match=None, changes=None, opts=None, losedatafn=None): '''yields diff of changes to files between two nodes, or node and @@ -1465,6 +1469,43 @@ else: return difffn(opts, None) +def difflabel(func, *args, **kw): + '''yields 2-tuples of (output, label) based on the output of func()''' + prefixes = [('diff', 'diff.diffline'), + ('copy', 'diff.extended'), + ('rename', 'diff.extended'), + ('old', 'diff.extended'), + ('new', 'diff.extended'), + ('deleted', 'diff.extended'), + ('---', 'diff.file_a'), + ('+++', 'diff.file_b'), + ('@@', 'diff.hunk'), + ('-', 'diff.deleted'), + ('+', 'diff.inserted')] + + for chunk in func(*args, **kw): + lines = chunk.split('\n') + for i, line in enumerate(lines): + if i != 0: + yield ('\n', '') + stripline = line + if line and line[0] in '+-': + # highlight trailing whitespace, but only in changed lines + stripline = line.rstrip() + for prefix, label in prefixes: + if stripline.startswith(prefix): + yield (stripline, label) + break + else: + yield (line, '') + if line != stripline: + yield (line[len(stripline):], 'diff.trailingwhitespace') + +def diffui(*args, **kw): + '''like diff(), but yields 2-tuples of (output, label) for ui.write()''' + return difflabel(diff, *args, **kw) + + def _addmodehdr(header, omode, nmode): if omode != nmode: header.append('old mode %s\n' % omode) @@ -1568,47 +1609,6 @@ if text: yield text -def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False, - opts=None): - '''export changesets as hg patches.''' - - total = len(revs) - revwidth = max([len(str(rev)) for rev in revs]) - - def single(rev, seqno, fp): - ctx = repo[rev] - node = ctx.node() - parents = [p.node() for p in ctx.parents() if p] - branch = ctx.branch() - if switch_parent: - parents.reverse() - prev = (parents and parents[0]) or nullid - - if not fp: - fp = cmdutil.make_file(repo, template, node, total=total, - seqno=seqno, revwidth=revwidth, - mode='ab') - if fp != sys.stdout and hasattr(fp, 'name'): - repo.ui.note("%s\n" % fp.name) - - fp.write("# HG changeset patch\n") - fp.write("# User %s\n" % ctx.user()) - fp.write("# Date %d %d\n" % ctx.date()) - if branch and (branch != 'default'): - fp.write("# Branch %s\n" % branch) - fp.write("# Node ID %s\n" % hex(node)) - fp.write("# Parent %s\n" % hex(prev)) - if len(parents) > 1: - fp.write("# Parent %s\n" % hex(parents[1])) - fp.write(ctx.description().rstrip()) - fp.write("\n\n") - - for chunk in diff(repo, prev, node, opts=opts): - fp.write(chunk) - - for seqno, rev in enumerate(revs): - single(rev, seqno + 1, fp) - def diffstatdata(lines): filename, adds, removes = None, 0, 0 for line in lines: @@ -1676,3 +1676,22 @@ % (len(stats), totaladds, totalremoves)) return ''.join(output) + +def diffstatui(*args, **kw): + '''like diffstat(), but yields 2-tuples of (output, label) for + ui.write() + ''' + + for line in diffstat(*args, **kw).splitlines(): + if line and line[-1] in '+-': + name, graph = line.rsplit(' ', 1) + yield (name + ' ', '') + m = re.search(r'\++', graph) + if m: + yield (m.group(0), 'diffstat.inserted') + m = re.search(r'-+', graph) + if m: + yield (m.group(0), 'diffstat.deleted') + else: + yield (line, '') + yield ('\n', '') diff -r 8227a631c6b4 -r 5172261b92af mercurial/posix.py --- a/mercurial/posix.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/posix.py Mon Apr 19 18:59:02 2010 +0200 @@ -7,7 +7,7 @@ from i18n import _ import osutil -import os, sys, errno, stat, getpass, pwd, grp, fcntl +import os, sys, errno, stat, getpass, pwd, grp posixfile = open nulldev = '/dev/null' @@ -118,6 +118,7 @@ return st1.st_dev == st2.st_dev if sys.platform == 'darwin': + import fcntl # only needed on darwin, missing on jython def realpath(path): ''' Returns the true, canonical file system path equivalent to the given diff -r 8227a631c6b4 -r 5172261b92af mercurial/pure/osutil.py --- a/mercurial/pure/osutil.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/pure/osutil.py Mon Apr 19 18:59:02 2010 +0200 @@ -6,25 +6,25 @@ # GNU General Public License version 2 or any later version. import os -import stat as _stat +import stat as statmod posixfile = open def _mode_to_kind(mode): - if _stat.S_ISREG(mode): - return _stat.S_IFREG - if _stat.S_ISDIR(mode): - return _stat.S_IFDIR - if _stat.S_ISLNK(mode): - return _stat.S_IFLNK - if _stat.S_ISBLK(mode): - return _stat.S_IFBLK - if _stat.S_ISCHR(mode): - return _stat.S_IFCHR - if _stat.S_ISFIFO(mode): - return _stat.S_IFIFO - if _stat.S_ISSOCK(mode): - return _stat.S_IFSOCK + if statmod.S_ISREG(mode): + return statmod.S_IFREG + if statmod.S_ISDIR(mode): + return statmod.S_IFDIR + if statmod.S_ISLNK(mode): + return statmod.S_IFLNK + if statmod.S_ISBLK(mode): + return statmod.S_IFBLK + if statmod.S_ISCHR(mode): + return statmod.S_IFCHR + if statmod.S_ISFIFO(mode): + return statmod.S_IFIFO + if statmod.S_ISSOCK(mode): + return statmod.S_IFSOCK return mode def listdir(path, stat=False, skip=None): @@ -49,7 +49,7 @@ names.sort() for fn in names: st = os.lstat(prefix + fn) - if fn == skip and _stat.S_ISDIR(st.st_mode): + if fn == skip and statmod.S_ISDIR(st.st_mode): return [] if stat: result.append((fn, _mode_to_kind(st.st_mode), st)) diff -r 8227a631c6b4 -r 5172261b92af mercurial/repair.py --- a/mercurial/repair.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/repair.py Mon Apr 19 18:59:02 2010 +0200 @@ -114,7 +114,7 @@ mfst = repo.manifest - tr = repo.transaction() + tr = repo.transaction("strip") offset = len(tr.entries) tr.startgroup() diff -r 8227a631c6b4 -r 5172261b92af mercurial/revlog.py --- a/mercurial/revlog.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/revlog.py Mon Apr 19 18:59:02 2010 +0200 @@ -848,6 +848,32 @@ c.append(self.node(r)) return c + def descendant(self, start, end): + for i in self.descendants(start): + if i == end: + return True + elif i > end: + break + return False + + def ancestor(self, a, b): + """calculate the least common ancestor of nodes a and b""" + + # fast path, check if it is a descendant + a, b = self.rev(a), self.rev(b) + start, end = sorted((a, b)) + if self.descendant(start, end): + return self.node(start) + + def parents(rev): + return [p for p in self.parentrevs(rev) if p != nullrev] + + c = ancestor.ancestor(a, b, parents) + if c is None: + return nullid + + return self.node(c) + def _match(self, id): if isinstance(id, (long, int)): # rev @@ -1122,32 +1148,6 @@ self._cache = (node, curr, text) return node - def descendant(self, start, end): - for i in self.descendants(start): - if i == end: - return True - elif i > end: - break - return False - - def ancestor(self, a, b): - """calculate the least common ancestor of nodes a and b""" - - # fast path, check if it is a descendant - a, b = self.rev(a), self.rev(b) - start, end = sorted((a, b)) - if self.descendant(start, end): - return self.node(start) - - def parents(rev): - return [p for p in self.parentrevs(rev) if p != nullrev] - - c = ancestor.ancestor(a, b, parents) - if c is None: - return nullid - - return self.node(c) - def group(self, nodelist, lookup, infocollect=None): """Calculate a delta group, yielding a sequence of changegroup chunks (strings). diff -r 8227a631c6b4 -r 5172261b92af mercurial/streamclone.py --- a/mercurial/streamclone.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/streamclone.py Mon Apr 19 18:59:02 2010 +0200 @@ -6,7 +6,6 @@ # GNU General Public License version 2 or any later version. import util, error -from i18n import _ from mercurial import store diff -r 8227a631c6b4 -r 5172261b92af mercurial/subrepo.py --- a/mercurial/subrepo.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/subrepo.py Mon Apr 19 18:59:02 2010 +0200 @@ -228,8 +228,9 @@ self._repo.lookup(revision) except error.RepoError: self._repo._subsource = source - self._repo.ui.status(_('pulling subrepo %s\n') % self._path) srcurl = _abssource(self._repo) + self._repo.ui.status(_('pulling subrepo %s from %s\n') + % (self._path, srcurl)) other = hg.repository(self._repo.ui, srcurl) self._repo.pull(other) diff -r 8227a631c6b4 -r 5172261b92af mercurial/templatefilters.py --- a/mercurial/templatefilters.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/templatefilters.py Mon Apr 19 18:59:02 2010 +0200 @@ -14,15 +14,13 @@ return "".join([stringify(t) for t in thing if t is not None]) return str(thing) -agescales = [("second", 1), - ("minute", 60), - ("hour", 3600), - ("day", 3600 * 24), +agescales = [("year", 3600 * 24 * 365), + ("month", 3600 * 24 * 30), ("week", 3600 * 24 * 7), - ("month", 3600 * 24 * 30), - ("year", 3600 * 24 * 365)] - -agescales.reverse() + ("day", 3600 * 24), + ("hour", 3600), + ("minute", 60), + ("second", 1)] def age(date): '''turn a (timestamp, tzoff) tuple into an age string.''' diff -r 8227a631c6b4 -r 5172261b92af mercurial/templater.py --- a/mercurial/templater.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/templater.py Mon Apr 19 18:59:02 2010 +0200 @@ -6,12 +6,30 @@ # GNU General Public License version 2 or any later version. from i18n import _ -import re, sys, os +import sys, os import util, config, templatefilters path = ['templates', '../templates'] stringify = templatefilters.stringify +def _flatten(thing): + '''yield a single stream from a possibly nested set of iterators''' + if isinstance(thing, str): + yield thing + elif not hasattr(thing, '__iter__'): + if i is not None: + yield str(thing) + else: + for i in thing: + if isinstance(i, str): + yield i + elif not hasattr(i, '__iter__'): + if i is not None: + yield str(i) + elif i is not None: + for j in _flatten(i): + yield j + def parsestring(s, quoted=True): '''parse a string using simple c-like syntax. string must be in quotes if quoted is True.''' @@ -42,97 +60,107 @@ filter uses function to transform value. syntax is {key|filter1|filter2|...}.''' - template_re = re.compile(r'{([\w\|%]+)}') + def __init__(self, loader, filters={}, defaults={}): + self._loader = loader + self._filters = filters + self._defaults = defaults + self._cache = {} - def __init__(self, loader, filters={}, defaults={}): - self.loader = loader - self.filters = filters - self.defaults = defaults - self.cache = {} + def process(self, t, mapping): + '''Perform expansion. t is name of map element to expand. + mapping contains added elements for use during expansion. Is a + generator.''' + return _flatten(self._process(self._load(t), mapping)) + + def _load(self, t): + '''load, parse, and cache a template''' + if t not in self._cache: + self._cache[t] = self._parse(self._loader(t)) + return self._cache[t] - def process(self, t, map): - '''Perform expansion. t is name of map element to expand. map contains - added elements for use during expansion. Is a generator.''' - tmpl = self.loader(t) - iters = [self._process(tmpl, map)] - while iters: - try: - item = iters[0].next() - except StopIteration: - iters.pop(0) - continue - if isinstance(item, str): - yield item - elif item is None: - yield '' - elif hasattr(item, '__iter__'): - iters.insert(0, iter(item)) - else: - yield str(item) + def _get(self, mapping, key): + v = mapping.get(key) + if v is None: + v = self._defaults.get(key, '') + if hasattr(v, '__call__'): + v = v(**mapping) + return v - def _format(self, expr, get, map): - key, format = expr.split('%') - v = get(key) + def _filter(self, mapping, parts): + filters, val = parts + x = self._get(mapping, val) + for f in filters: + x = f(x) + return x + + def _format(self, mapping, args): + key, parsed = args + v = self._get(mapping, key) if not hasattr(v, '__iter__'): - raise SyntaxError(_("error expanding '%s%%%s'") % (key, format)) - lm = map.copy() + raise SyntaxError(_("error expanding '%s%%%s'") + % (key, format)) + lm = mapping.copy() for i in v: if isinstance(i, dict): lm.update(i) - yield self.process(format, lm) + yield self._process(parsed, lm) else: # v is not an iterable of dicts, this happen when 'key' # has been fully expanded already and format is useless. # If so, return the expanded value. yield i - def _filter(self, expr, get, map): - if expr not in self.cache: - parts = expr.split('|') - val = parts[0] - try: - filters = [self.filters[f] for f in parts[1:]] - except KeyError, i: - raise SyntaxError(_("unknown filter '%s'") % i[0]) - def apply(get): - x = get(val) - for f in filters: - x = f(x) - return x - self.cache[expr] = apply - return self.cache[expr](get) + def _parse(self, tmpl): + '''preparse a template''' + parsed = [] + pos, stop = 0, len(tmpl) + while pos < stop: + n = tmpl.find('{', pos) + if n < 0: + parsed.append((None, tmpl[pos:stop])) + break + if n > 0 and tmpl[n - 1] == '\\': + # escaped + parsed.append((None, tmpl[pos:n - 1] + "{")) + pos = n + 1 + continue + if n > pos: + parsed.append((None, tmpl[pos:n])) - def _process(self, tmpl, map): - '''Render a template. Returns a generator.''' - - def get(key): - v = map.get(key) - if v is None: - v = self.defaults.get(key, '') - if hasattr(v, '__call__'): - v = v(**map) - return v - - while tmpl: - m = self.template_re.search(tmpl) - if not m: - yield tmpl + pos = n + n = tmpl.find('}', pos) + if n < 0: + # no closing + parsed.append((None, tmpl[pos:stop])) break - start, end = m.span(0) - variants = m.groups() - expr = variants[0] or variants[1] - - if start: - yield tmpl[:start] - tmpl = tmpl[end:] + expr = tmpl[pos + 1:n] + pos = n + 1 if '%' in expr: - yield self._format(expr, get, map) + key, t = expr.split('%') + parsed.append((self._format, (key.strip(), + self._load(t.strip())))) elif '|' in expr: - yield self._filter(expr, get, map) + parts = expr.split('|') + val = parts[0].strip() + try: + filters = [self._filters[f.strip()] for f in parts[1:]] + except KeyError, i: + raise SyntaxError(_("unknown filter '%s'") % i[0]) + parsed.append((self._filter, (filters, val))) else: - yield get(expr) + parsed.append((self._get, expr.strip())) + + return parsed + + def _process(self, parsed, mapping): + '''Render a template. Returns a generator.''' + for f, e in parsed: + if f: + yield f(mapping, e) + else: + yield e engines = {'default': engine} @@ -188,14 +216,14 @@ (self.map[t][1], inst.args[1])) return self.cache[t] - def __call__(self, t, **map): + def __call__(self, t, **mapping): ttype = t in self.map and self.map[t][0] or 'default' proc = self.engines.get(ttype) if proc is None: proc = engines[ttype](self.load, self.filters, self.defaults) self.engines[ttype] = proc - stream = proc.process(t, map) + stream = proc.process(t, mapping) if self.minchunk: stream = util.increasingchunks(stream, min=self.minchunk, max=self.maxchunk) diff -r 8227a631c6b4 -r 5172261b92af mercurial/templates/gitweb/graph.tmpl --- a/mercurial/templates/gitweb/graph.tmpl Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/templates/gitweb/graph.tmpl Mon Apr 19 18:59:02 2010 +0200 @@ -50,7 +50,7 @@ var graph = new Graph(); graph.scale({bg_height}); -graph.edge = function(x0, y0, x1, y1, color) { +graph.edge = function(x0, y0, x1, y1, color) \{ this.setColor(color, 0.0, 0.65); this.ctx.beginPath(); @@ -65,7 +65,7 @@ revlink += ' _TAGS'; revlink += '_DATE, by _USER'; -graph.vertex = function(x, y, color, parity, cur) { +graph.vertex = function(x, y, color, parity, cur) \{ this.ctx.beginPath(); color = this.setColor(color, 0.25, 0.75); @@ -84,17 +84,17 @@ item = item.replace(/_DATE/, cur[5]); var tagspan = ''; - if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) { + if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) \{ tagspan = ''; - if (cur[6][1]) { + if (cur[6][1]) \{ tagspan += ''; tagspan += cur[6][0] + ' '; - } else if (!cur[6][1] && cur[6][0] != 'default') { + } else if (!cur[6][1] && cur[6][0] != 'default') \{ tagspan += ''; tagspan += cur[6][0] + ' '; } - if (cur[7].length) { - for (var t in cur[7]) { + if (cur[7].length) \{ + for (var t in cur[7]) \{ var tag = cur[7][t]; tagspan += '' + tag + ' '; } diff -r 8227a631c6b4 -r 5172261b92af mercurial/templates/monoblue/graph.tmpl --- a/mercurial/templates/monoblue/graph.tmpl Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/templates/monoblue/graph.tmpl Mon Apr 19 18:59:02 2010 +0200 @@ -48,7 +48,7 @@ var graph = new Graph(); graph.scale({bg_height}); - graph.edge = function(x0, y0, x1, y1, color) { + graph.edge = function(x0, y0, x1, y1, color) \{ this.setColor(color, 0.0, 0.65); this.ctx.beginPath(); @@ -62,7 +62,7 @@ revlink += '_DESC'; revlink += '_TAGS_DATE, by _USER'; - graph.vertex = function(x, y, color, parity, cur) { + graph.vertex = function(x, y, color, parity, cur) \{ this.ctx.beginPath(); color = this.setColor(color, 0.25, 0.75); @@ -81,17 +81,17 @@ item = item.replace(/_DATE/, cur[5]); var tagspan = ''; - if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) { + if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) \{ tagspan = ''; - if (cur[6][1]) { + if (cur[6][1]) \{ tagspan += ''; tagspan += cur[6][0] + ' '; - } else if (!cur[6][1] && cur[6][0] != 'default') { + } else if (!cur[6][1] && cur[6][0] != 'default') \{ tagspan += ''; tagspan += cur[6][0] + ' '; } - if (cur[7].length) { - for (var t in cur[7]) { + if (cur[7].length) \{ + for (var t in cur[7]) \{ var tag = cur[7][t]; tagspan += '' + tag + ' '; } diff -r 8227a631c6b4 -r 5172261b92af mercurial/templates/paper/graph.tmpl --- a/mercurial/templates/paper/graph.tmpl Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/templates/paper/graph.tmpl Mon Apr 19 18:59:02 2010 +0200 @@ -59,7 +59,7 @@ var graph = new Graph(); graph.scale({bg_height}); -graph.edge = function(x0, y0, x1, y1, color) { +graph.edge = function(x0, y0, x1, y1, color) \{ this.setColor(color, 0.0, 0.65); this.ctx.beginPath(); @@ -73,7 +73,7 @@ revlink += '_DESC'; revlink += '_TAGS_DATE, by _USER'; -graph.vertex = function(x, y, color, parity, cur) { +graph.vertex = function(x, y, color, parity, cur) \{ this.ctx.beginPath(); color = this.setColor(color, 0.25, 0.75); @@ -92,17 +92,17 @@ item = item.replace(/_DATE/, cur[5]); var tagspan = ''; - if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) { + if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) \{ tagspan = ''; - if (cur[6][1]) { + if (cur[6][1]) \{ tagspan += ''; tagspan += cur[6][0] + ' '; - } else if (!cur[6][1] && cur[6][0] != 'default') { + } else if (!cur[6][1] && cur[6][0] != 'default') \{ tagspan += ''; tagspan += cur[6][0] + ' '; } - if (cur[7].length) { - for (var t in cur[7]) { + if (cur[7].length) \{ + for (var t in cur[7]) \{ var tag = cur[7][t]; tagspan += '' + tag + ' '; } diff -r 8227a631c6b4 -r 5172261b92af mercurial/templates/spartan/graph.tmpl --- a/mercurial/templates/spartan/graph.tmpl Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/templates/spartan/graph.tmpl Mon Apr 19 18:59:02 2010 +0200 @@ -43,7 +43,7 @@ var graph = new Graph(); graph.scale({bg_height}); -graph.edge = function(x0, y0, x1, y1, color) { +graph.edge = function(x0, y0, x1, y1, color) \{ this.setColor(color, 0.0, 0.65); this.ctx.beginPath(); @@ -57,7 +57,7 @@ revlink += '_DESC'; revlink += '_DATE, by _USER'; -graph.vertex = function(x, y, color, parity, cur) { +graph.vertex = function(x, y, color, parity, cur) \{ this.ctx.beginPath(); color = this.setColor(color, 0.25, 0.75); diff -r 8227a631c6b4 -r 5172261b92af mercurial/ui.py --- a/mercurial/ui.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/ui.py Mon Apr 19 18:59:02 2010 +0200 @@ -239,17 +239,42 @@ def pushbuffer(self): self._buffers.append([]) - def popbuffer(self): + def popbuffer(self, labeled=False): + '''pop the last buffer and return the buffered output + + If labeled is True, any labels associated with buffered + output will be handled. By default, this has no effect + on the output returned, but extensions and GUI tools may + handle this argument and returned styled output. If output + is being buffered so it can be captured and parsed or + processed, labeled should not be set to True. + ''' return "".join(self._buffers.pop()) - def write(self, *args): + def write(self, *args, **opts): + '''write args to output + + By default, this method simply writes to the buffer or stdout, + but extensions or GUI tools may override this method, + write_err(), popbuffer(), and label() to style output from + various parts of hg. + + An optional keyword argument, "label", can be passed in. + This should be a string containing label names separated by + space. Label names take the form of "topic.type". For example, + ui.debug() issues a label of "ui.debug". + + When labeling output for a specific command, a label of + "cmdname.type" is recommended. For example, status issues + a label of "status.modified" for modified files. + ''' if self._buffers: self._buffers[-1].extend([str(a) for a in args]) else: for a in args: sys.stdout.write(str(a)) - def write_err(self, *args): + def write_err(self, *args, **opts): try: if not getattr(sys.stdout, 'closed', False): sys.stdout.flush() @@ -335,17 +360,37 @@ return getpass.getpass(prompt or _('password: ')) except EOFError: raise util.Abort(_('response expected')) - def status(self, *msg): + def status(self, *msg, **opts): + '''write status message to output (if ui.quiet is False) + + This adds an output label of "ui.status". + ''' if not self.quiet: - self.write(*msg) - def warn(self, *msg): - self.write_err(*msg) - def note(self, *msg): + opts['label'] = opts.get('label', '') + ' ui.status' + self.write(*msg, **opts) + def warn(self, *msg, **opts): + '''write warning message to output (stderr) + + This adds an output label of "ui.warning". + ''' + opts['label'] = opts.get('label', '') + ' ui.warning' + self.write_err(*msg, **opts) + def note(self, *msg, **opts): + '''write note to output (if ui.verbose is True) + + This adds an output label of "ui.note". + ''' if self.verbose: - self.write(*msg) - def debug(self, *msg): + opts['label'] = opts.get('label', '') + ' ui.note' + self.write(*msg, **opts) + def debug(self, *msg, **opts): + '''write debug message to output (if ui.debugflag is True) + + This adds an output label of "ui.debug". + ''' if self.debugflag: - self.write(*msg) + opts['label'] = opts.get('label', '') + ' ui.debug' + self.write(*msg, **opts) def edit(self, text, user): (fd, name) = tempfile.mkstemp(prefix="hg-editor-", suffix=".txt", text=True) @@ -417,3 +462,15 @@ % (topic, item, pos, total, unit, pct)) else: self.debug('%s:%s %s%s\n' % (topic, item, pos, unit)) + + def label(self, msg, label): + '''style msg based on supplied label + + Like ui.write(), this just returns msg unchanged, but extensions + and GUI tools can override it to allow styling output without + writing it. + + ui.write(s, 'label') is equivalent to + ui.write(ui.label(s, 'label')). + ''' + return msg diff -r 8227a631c6b4 -r 5172261b92af mercurial/util.py --- a/mercurial/util.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/util.py Mon Apr 19 18:59:02 2010 +0200 @@ -36,6 +36,13 @@ _fastsha1 = sha1 = _sha1 return _sha1(s) +import __builtin__ + +def fakebuffer(sliceable, offset=0): + return sliceable[offset:] +if not hasattr(__builtin__, 'buffer'): + __builtin__.buffer = fakebuffer + import subprocess closefds = os.name == 'posix' diff -r 8227a631c6b4 -r 5172261b92af mercurial/verify.py --- a/mercurial/verify.py Mon Apr 19 18:57:16 2010 +0200 +++ b/mercurial/verify.py Mon Apr 19 18:59:02 2010 +0200 @@ -122,7 +122,7 @@ checklog(cl, "changelog", 0) total = len(repo) for i in repo: - ui.progress(_('checking'), i, total=total) + ui.progress(_('changesets'), i, total=total) n = cl.node(i) checkentry(cl, i, n, seen, [i], "changelog") @@ -133,14 +133,14 @@ filelinkrevs.setdefault(f, []).append(i) except Exception, inst: exc(i, _("unpacking changeset %s") % short(n), inst) - ui.progress(_('checking'), None) + ui.progress(_('changesets'), None) ui.status(_("checking manifests\n")) seen = {} checklog(mf, "manifest", 0) total = len(mf) for i in mf: - ui.progress(_('checking'), i, total=total) + ui.progress(_('manifests'), i, total=total) n = mf.node(i) lr = checkentry(mf, i, n, seen, mflinkrevs.get(n, []), "manifest") if n in mflinkrevs: @@ -156,7 +156,7 @@ filenodes.setdefault(f, {}).setdefault(fn, lr) except Exception, inst: exc(lr, _("reading manifest delta %s") % short(n), inst) - ui.progress(_('checking'), None) + ui.progress(_('manifests'), None) ui.status(_("crosschecking files in changesets and manifests\n")) diff -r 8227a631c6b4 -r 5172261b92af setup.py --- a/setup.py Mon Apr 19 18:57:16 2010 +0200 +++ b/setup.py Mon Apr 19 18:59:02 2010 +0200 @@ -37,7 +37,6 @@ import tempfile from distutils.core import setup, Extension from distutils.dist import Distribution -from distutils.command.install_data import install_data from distutils.command.build import build from distutils.command.build_py import build_py from distutils.spawn import spawn, find_executable diff -r 8227a631c6b4 -r 5172261b92af tests/get-with-headers.py --- a/tests/get-with-headers.py Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/get-with-headers.py Mon Apr 19 18:59:02 2010 +0200 @@ -3,7 +3,7 @@ """This does HTTP GET requests given a host:port and path and returns a subset of the headers plus the body of the result.""" -import httplib, sys, re +import httplib, sys try: import msvcrt, os diff -r 8227a631c6b4 -r 5172261b92af tests/helpers.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/helpers.sh Mon Apr 19 18:59:02 2010 +0200 @@ -0,0 +1,9 @@ +#/bin/sh + +hideport() { sed "s/localhost:$HGPORT/localhost:\$HGPORT/"; } + +repr() { python -c "import sys; print repr(sys.stdin.read()).replace('\\n', '\n')" } + +hidehex() { python -c 'import sys, re; print re.replace("\b[0-9A-Fa-f]{12,40}", "X" * 12)' } + +hidetmp() { sed "s/$HGTMP/\$HGTMP/"; } \ No newline at end of file diff -r 8227a631c6b4 -r 5172261b92af tests/killdaemons.py --- a/tests/killdaemons.py Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/killdaemons.py Mon Apr 19 18:59:02 2010 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python -import os, sys, time, errno, signal +import os, time, errno, signal # Kill off any leftover daemon processes try: diff -r 8227a631c6b4 -r 5172261b92af tests/run-tests.py --- a/tests/run-tests.py Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/run-tests.py Mon Apr 19 18:59:02 2010 +0200 @@ -46,9 +46,8 @@ import errno import optparse import os -import signal +import shutil import subprocess -import shutil import signal import sys import tempfile @@ -70,6 +69,9 @@ SKIPPED_PREFIX = 'skipped: ' FAILED_PREFIX = 'hghave check failed: ' PYTHON = sys.executable +IMPL_PATH = 'PYTHONPATH' +if 'java' in sys.platform: + IMPL_PATH = 'JYTHONPATH' requiredtools = ["python", "diff", "grep", "unzip", "gunzip", "bunzip2", "sed"] @@ -140,6 +142,10 @@ parser.set_defaults(**defaults) (options, args) = parser.parse_args() + # jython is always pure + if 'java' in sys.platform or '__pypy__' in sys.modules: + options.pure = True + if options.with_hg: if not (os.path.isfile(options.with_hg) and os.access(options.with_hg, os.X_OK)): @@ -843,6 +849,7 @@ os.environ["EMAIL"] = "Foo Bar " os.environ['CDPATH'] = '' os.environ['COLUMNS'] = '80' + os.environ['GREP_OPTIONS'] = '' os.environ['http_proxy'] = '' # unset env related to hooks @@ -914,10 +921,10 @@ # it, in case external libraries are only available via current # PYTHONPATH. (In particular, the Subversion bindings on OS X # are in /opt/subversion.) - oldpypath = os.environ.get('PYTHONPATH') + oldpypath = os.environ.get(IMPL_PATH) if oldpypath: pypath.append(oldpypath) - os.environ['PYTHONPATH'] = os.pathsep.join(pypath) + os.environ[IMPL_PATH] = os.pathsep.join(pypath) COVERAGE_FILE = os.path.join(TESTDIR, ".coverage") @@ -938,7 +945,7 @@ vlog("# Using TESTDIR", TESTDIR) vlog("# Using HGTMP", HGTMP) vlog("# Using PATH", os.environ["PATH"]) - vlog("# Using PYTHONPATH", os.environ["PYTHONPATH"]) + vlog("# Using", IMPL_PATH, os.environ[IMPL_PATH]) try: if len(tests) > 1 and options.jobs > 1: diff -r 8227a631c6b4 -r 5172261b92af tests/test-acl.out --- a/tests/test-acl.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-acl.out Mon Apr 19 18:59:02 2010 +0200 @@ -59,19 +59,19 @@ changesets: 3 chunks add changeset 911600dab2ae adding manifests -manifests: 1 chunks -manifests: 2 chunks -manifests: 3 chunks +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) adding file changes adding foo/Bar/file.txt revisions -files: 1 chunks +files: 1/3 chunks (33.33%) adding foo/file.txt revisions -files: 2 chunks +files: 2/3 chunks (66.67%) adding quux/file.py revisions -files: 3 chunks +files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files updating the branch cache -rolling back last transaction +rolling back to revision 1 (undo push) 0:6675d58eff77 Extension disabled for lack of acl.sources @@ -129,21 +129,21 @@ changesets: 3 chunks add changeset 911600dab2ae adding manifests -manifests: 1 chunks -manifests: 2 chunks -manifests: 3 chunks +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) adding file changes adding foo/Bar/file.txt revisions -files: 1 chunks +files: 1/3 chunks (33.33%) adding foo/file.txt revisions -files: 2 chunks +files: 2/3 chunks (66.67%) adding quux/file.py revisions -files: 3 chunks +files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: changes have source "push" - skipping updating the branch cache -rolling back last transaction +rolling back to revision 1 (undo push) 0:6675d58eff77 No [acl.allow]/[acl.deny] @@ -203,16 +203,16 @@ changesets: 3 chunks add changeset 911600dab2ae adding manifests -manifests: 1 chunks -manifests: 2 chunks -manifests: 3 chunks +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) adding file changes adding foo/Bar/file.txt revisions -files: 1 chunks +files: 1/3 chunks (33.33%) adding foo/file.txt revisions -files: 2 chunks +files: 2/3 chunks (66.67%) adding quux/file.py revisions -files: 3 chunks +files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow not enabled @@ -221,7 +221,7 @@ acl: allowing changeset f9cafe1212c8 acl: allowing changeset 911600dab2ae updating the branch cache -rolling back last transaction +rolling back to revision 1 (undo push) 0:6675d58eff77 Empty [acl.allow] @@ -282,16 +282,16 @@ changesets: 3 chunks add changeset 911600dab2ae adding manifests -manifests: 1 chunks -manifests: 2 chunks -manifests: 3 chunks +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) adding file changes adding foo/Bar/file.txt revisions -files: 1 chunks +files: 1/3 chunks (33.33%) adding foo/file.txt revisions -files: 2 chunks +files: 2/3 chunks (66.67%) adding quux/file.py revisions -files: 3 chunks +files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 0 entries for user fred @@ -362,16 +362,16 @@ changesets: 3 chunks add changeset 911600dab2ae adding manifests -manifests: 1 chunks -manifests: 2 chunks -manifests: 3 chunks +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) adding file changes adding foo/Bar/file.txt revisions -files: 1 chunks +files: 1/3 chunks (33.33%) adding foo/file.txt revisions -files: 2 chunks +files: 2/3 chunks (66.67%) adding quux/file.py revisions -files: 3 chunks +files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 1 entries for user fred @@ -445,16 +445,16 @@ changesets: 3 chunks add changeset 911600dab2ae adding manifests -manifests: 1 chunks -manifests: 2 chunks -manifests: 3 chunks +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) adding file changes adding foo/Bar/file.txt revisions -files: 1 chunks +files: 1/3 chunks (33.33%) adding foo/file.txt revisions -files: 2 chunks +files: 2/3 chunks (66.67%) adding quux/file.py revisions -files: 3 chunks +files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 0 entries for user barney @@ -527,16 +527,16 @@ changesets: 3 chunks add changeset 911600dab2ae adding manifests -manifests: 1 chunks -manifests: 2 chunks -manifests: 3 chunks +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) adding file changes adding foo/Bar/file.txt revisions -files: 1 chunks +files: 1/3 chunks (33.33%) adding foo/file.txt revisions -files: 2 chunks +files: 2/3 chunks (66.67%) adding quux/file.py revisions -files: 3 chunks +files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 1 entries for user fred @@ -612,16 +612,16 @@ changesets: 3 chunks add changeset 911600dab2ae adding manifests -manifests: 1 chunks -manifests: 2 chunks -manifests: 3 chunks +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) adding file changes adding foo/Bar/file.txt revisions -files: 1 chunks +files: 1/3 chunks (33.33%) adding foo/file.txt revisions -files: 2 chunks +files: 2/3 chunks (66.67%) adding quux/file.py revisions -files: 3 chunks +files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 1 entries for user fred @@ -696,16 +696,16 @@ changesets: 3 chunks add changeset 911600dab2ae adding manifests -manifests: 1 chunks -manifests: 2 chunks -manifests: 3 chunks +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) adding file changes adding foo/Bar/file.txt revisions -files: 1 chunks +files: 1/3 chunks (33.33%) adding foo/file.txt revisions -files: 2 chunks +files: 2/3 chunks (66.67%) adding quux/file.py revisions -files: 3 chunks +files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 0 entries for user barney @@ -781,16 +781,16 @@ changesets: 3 chunks add changeset 911600dab2ae adding manifests -manifests: 1 chunks -manifests: 2 chunks -manifests: 3 chunks +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) adding file changes adding foo/Bar/file.txt revisions -files: 1 chunks +files: 1/3 chunks (33.33%) adding foo/file.txt revisions -files: 2 chunks +files: 2/3 chunks (66.67%) adding quux/file.py revisions -files: 3 chunks +files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 1 entries for user barney @@ -799,7 +799,7 @@ acl: allowing changeset f9cafe1212c8 acl: allowing changeset 911600dab2ae updating the branch cache -rolling back last transaction +rolling back to revision 1 (undo push) 0:6675d58eff77 wilma can change files with a .txt extension @@ -867,16 +867,16 @@ changesets: 3 chunks add changeset 911600dab2ae adding manifests -manifests: 1 chunks -manifests: 2 chunks -manifests: 3 chunks +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) adding file changes adding foo/Bar/file.txt revisions -files: 1 chunks +files: 1/3 chunks (33.33%) adding foo/file.txt revisions -files: 2 chunks +files: 2/3 chunks (66.67%) adding quux/file.py revisions -files: 3 chunks +files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 1 entries for user wilma @@ -957,16 +957,16 @@ changesets: 3 chunks add changeset 911600dab2ae adding manifests -manifests: 1 chunks -manifests: 2 chunks -manifests: 3 chunks +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) adding file changes adding foo/Bar/file.txt revisions -files: 1 chunks +files: 1/3 chunks (33.33%) adding foo/file.txt revisions -files: 2 chunks +files: 2/3 chunks (66.67%) adding quux/file.py revisions -files: 3 chunks +files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook error: pretxnchangegroup.acl hook raised an exception: [Errno 2] No such file or directory: '../acl.config' @@ -1046,16 +1046,16 @@ changesets: 3 chunks add changeset 911600dab2ae adding manifests -manifests: 1 chunks -manifests: 2 chunks -manifests: 3 chunks +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) adding file changes adding foo/Bar/file.txt revisions -files: 1 chunks +files: 1/3 chunks (33.33%) adding foo/file.txt revisions -files: 2 chunks +files: 2/3 chunks (66.67%) adding quux/file.py revisions -files: 3 chunks +files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 1 entries for user betty @@ -1142,16 +1142,16 @@ changesets: 3 chunks add changeset 911600dab2ae adding manifests -manifests: 1 chunks -manifests: 2 chunks -manifests: 3 chunks +manifests: 1/3 chunks (33.33%) +manifests: 2/3 chunks (66.67%) +manifests: 3/3 chunks (100.00%) adding file changes adding foo/Bar/file.txt revisions -files: 1 chunks +files: 1/3 chunks (33.33%) adding foo/file.txt revisions -files: 2 chunks +files: 2/3 chunks (66.67%) adding quux/file.py revisions -files: 3 chunks +files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: acl.allow enabled, 1 entries for user barney @@ -1160,6 +1160,6 @@ acl: allowing changeset f9cafe1212c8 acl: allowing changeset 911600dab2ae updating the branch cache -rolling back last transaction +rolling back to revision 1 (undo push) 0:6675d58eff77 diff -r 8227a631c6b4 -r 5172261b92af tests/test-archive --- a/tests/test-archive Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-archive Mon Apr 19 18:59:02 2010 +0200 @@ -74,6 +74,20 @@ hg archive -t tgz -p %b-%h test-%h.tar.gz gzip -dc test-$QTIP.tar.gz | tar tf - 2>/dev/null | sed "s/$QTIP/TIP/" +hg archive autodetected_test.tar +tar tf autodetected_test.tar + +# The '-t' should override autodetection +hg archive -t tar autodetect_override_test.zip +tar tf autodetect_override_test.zip + +for ext in tar tar.gz tgz tar.bz2 tbz2 zip; do + hg archive auto_test.$ext + if [ -d auto_test.$ext ]; then + echo "extension $ext was not autodetected." + fi +done + cat > md5comp.py < a hg add a hg commit -m 0 diff -r 8227a631c6b4 -r 5172261b92af tests/test-bookmarks-current --- a/tests/test-bookmarks-current Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-bookmarks-current Mon Apr 19 18:59:02 2010 +0200 @@ -17,6 +17,9 @@ echo % list bookmarks hg bookmark +echo % list bookmarks with color +hg --config extensions.color= bookmark --color=always + echo % update to bookmark X hg update X diff -r 8227a631c6b4 -r 5172261b92af tests/test-bookmarks-current.out --- a/tests/test-bookmarks-current.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-bookmarks-current.out Mon Apr 19 18:59:02 2010 +0200 @@ -3,6 +3,8 @@ % set bookmark X % list bookmarks * X -1:000000000000 +% list bookmarks with color + * X -1:000000000000 % update to bookmark X 0 files updated, 0 files merged, 0 files removed, 0 files unresolved % list bookmarks diff -r 8227a631c6b4 -r 5172261b92af tests/test-bookmarks.out --- a/tests/test-bookmarks.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-bookmarks.out Mon Apr 19 18:59:02 2010 +0200 @@ -3,6 +3,8 @@ % bookmark rev -1 % list bookmarks * X -1:000000000000 +% list bookmarks with color + * X -1:000000000000 % bookmark X moved to rev 0 * X 0:f7b1eb17ad24 % look up bookmark diff -r 8227a631c6b4 -r 5172261b92af tests/test-bundle-r.out --- a/tests/test-bundle-r.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-bundle-r.out Mon Apr 19 18:59:02 2010 +0200 @@ -154,7 +154,7 @@ crosschecking files in changesets and manifests checking files 4 files, 9 changesets, 7 total revisions -rolling back last transaction +rolling back to revision 5 (undo pull) % should fail abort: --base is incompatible with specifying a destination abort: repository default-push not found! @@ -187,7 +187,7 @@ crosschecking files in changesets and manifests checking files 4 files, 9 changesets, 7 total revisions -rolling back last transaction +rolling back to revision 3 (undo unbundle) % 2 2:d62976ca1e50 adding changesets @@ -202,7 +202,7 @@ crosschecking files in changesets and manifests checking files 2 files, 5 changesets, 5 total revisions -rolling back last transaction +rolling back to revision 3 (undo unbundle) adding changesets adding manifests adding file changes @@ -215,7 +215,7 @@ crosschecking files in changesets and manifests checking files 3 files, 7 changesets, 6 total revisions -rolling back last transaction +rolling back to revision 3 (undo unbundle) adding changesets adding manifests adding file changes diff -r 8227a631c6b4 -r 5172261b92af tests/test-bundle.out --- a/tests/test-bundle.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-bundle.out Mon Apr 19 18:59:02 2010 +0200 @@ -37,7 +37,7 @@ added 9 changesets with 7 changes to 4 files (+1 heads) (run 'hg heads' to see heads, 'hg merge' to merge) ====== Rollback empty -rolling back last transaction +rolling back to revision 0 (undo pull) ====== Pull full.hg into empty again (using --cwd) pulling from ../full.hg requesting all changes @@ -55,7 +55,7 @@ searching for changes no changes found ====== Rollback empty -rolling back last transaction +rolling back to revision 0 (undo pull) ====== Pull full.hg into empty again (using -R) pulling from full.hg requesting all changes @@ -123,7 +123,7 @@ added 9 changesets with 7 changes to 4 files (+1 heads) (run 'hg heads' to see heads, 'hg merge' to merge) ====== Rollback empty -rolling back last transaction +rolling back to revision 0 (undo pull) ====== Log -R bundle:empty+full.hg 8 7 6 5 4 3 2 1 0 ====== Pull full.hg into empty again (using -R; with hook) diff -r 8227a631c6b4 -r 5172261b92af tests/test-check-code --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-check-code Mon Apr 19 18:59:02 2010 +0200 @@ -0,0 +1,26 @@ +#!/bin/sh +#cd `dirname $0` +cat > correct.py < wrong.py < quote.py < def toto( arg1, arg2): + gratuitous whitespace in () or [] +./wrong.py:2: + > del(arg2) + del isn't a function +./wrong.py:3: + > return ( 5+6, 9) + missing whitespace in expression + gratuitous whitespace in () or [] +./quote.py:5: + > '"""', 42+1, """and + missing whitespace in expression diff -r 8227a631c6b4 -r 5172261b92af tests/test-churn --- a/tests/test-churn Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-churn Mon Apr 19 18:59:02 2010 +0200 @@ -52,6 +52,8 @@ hg rm d/g/f2.txt hg ci -Am "removed d/g/f2.txt" -u user1 -d 14:00 d/g/f2.txt hg churn --diffstat +echo % churn --diffstat with color +hg --config extensions.color= churn --diffstat --color=always echo % changeset number churn hg churn -c diff -r 8227a631c6b4 -r 5172261b92af tests/test-churn.out --- a/tests/test-churn.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-churn.out Mon Apr 19 18:59:02 2010 +0200 @@ -32,6 +32,10 @@ user1 +3/-1 +++++++++++++++++++++++++++++++++++++++++-------------- user3 +3/-0 +++++++++++++++++++++++++++++++++++++++++ user2 +2/-0 +++++++++++++++++++++++++++ +% churn --diffstat with color +user1 +3/-1 +++++++++++++++++++++++++++++++++++++++++-------------- +user3 +3/-0 +++++++++++++++++++++++++++++++++++++++++ +user2 +2/-0 +++++++++++++++++++++++++++ % changeset number churn user1 4 *************************************************************** user3 3 *********************************************** diff -r 8227a631c6b4 -r 5172261b92af tests/test-convert-cvs.out --- a/tests/test-convert-cvs.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-convert-cvs.out Mon Apr 19 18:59:02 2010 +0200 @@ -45,7 +45,7 @@ 2 Initial revision 1 import filtering out empty revision -rolling back last transaction +rolling back to revision 1 (undo commit) 0 ci0 updating tags c diff -r 8227a631c6b4 -r 5172261b92af tests/test-debugcomplete.out --- a/tests/test-debugcomplete.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-debugcomplete.out Mon Apr 19 18:59:02 2010 +0200 @@ -220,7 +220,7 @@ rename: after, force, include, exclude, dry-run resolve: all, list, mark, unmark, no-status, include, exclude revert: all, date, rev, no-backup, include, exclude, dry-run -rollback: +rollback: dry-run root: showconfig: untrusted tag: force, local, rev, remove, message, date, user diff -r 8227a631c6b4 -r 5172261b92af tests/test-diff-color.out --- a/tests/test-diff-color.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-diff-color.out Mon Apr 19 18:59:02 2010 +0200 @@ -31,7 +31,8 @@ old mode 100644 new mode 100755 1 hunks, 2 lines changed -examine changes to 'a'? [Ynsfdaq?] @@ -2,7 +2,7 @@ +examine changes to 'a'? [Ynsfdaq?] +@@ -2,7 +2,7 @@ c a a @@ -41,13 +42,15 @@ a c record this change to 'a'? [Ynsfdaq?] -rolling back last transaction + +rolling back to revision 1 (undo commit) % qrecord diff --git a/a b/a old mode 100644 new mode 100755 1 hunks, 2 lines changed -examine changes to 'a'? [Ynsfdaq?] @@ -2,7 +2,7 @@ +examine changes to 'a'? [Ynsfdaq?] +@@ -2,7 +2,7 @@ c a a @@ -57,3 +60,4 @@ a c record this change to 'a'? [Ynsfdaq?] + diff -r 8227a631c6b4 -r 5172261b92af tests/test-eolfilename.out --- a/tests/test-eolfilename.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-eolfilename.out Mon Apr 19 18:59:02 2010 +0200 @@ -15,6 +15,6 @@ o % test issue2039 ? foo -bar +bar ? foo -bar.baz +bar.baz diff -r 8227a631c6b4 -r 5172261b92af tests/test-fncache.out --- a/tests/test-fncache.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-fncache.out Mon Apr 19 18:59:02 2010 +0200 @@ -54,6 +54,7 @@ .hg/requires .hg/undo .hg/undo.branch +.hg/undo.desc .hg/undo.dirstate % non fncache repo adding tst.d/Foo @@ -70,4 +71,5 @@ .hg/store/data/tst.d.hg/_foo.i .hg/store/undo .hg/undo.branch +.hg/undo.desc .hg/undo.dirstate diff -r 8227a631c6b4 -r 5172261b92af tests/test-globalopts.out --- a/tests/test-globalopts.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-globalopts.out Mon Apr 19 18:59:02 2010 +0200 @@ -186,9 +186,9 @@ rename rename files; equivalent of copy + remove resolve various operations to help finish a merge revert restore individual files or directories to an earlier state - rollback roll back the last transaction + rollback roll back the last transaction (dangerous) root print the root (top) of the current working directory - serve export the repository via HTTP + serve start stand-alone webserver showconfig show combined config settings from all hgrc files status show changed files in the working directory summary summarize working directory state @@ -196,7 +196,7 @@ tags list repository tags tip show the tip revision unbundle apply one or more changegroup files - update update working directory + update update working directory (or switch revisions) verify verify the integrity of the repository version output version and copyright information @@ -255,9 +255,9 @@ rename rename files; equivalent of copy + remove resolve various operations to help finish a merge revert restore individual files or directories to an earlier state - rollback roll back the last transaction + rollback roll back the last transaction (dangerous) root print the root (top) of the current working directory - serve export the repository via HTTP + serve start stand-alone webserver showconfig show combined config settings from all hgrc files status show changed files in the working directory summary summarize working directory state @@ -265,7 +265,7 @@ tags list repository tags tip show the tip revision unbundle apply one or more changegroup files - update update working directory + update update working directory (or switch revisions) verify verify the integrity of the repository version output version and copyright information diff -r 8227a631c6b4 -r 5172261b92af tests/test-grep --- a/tests/test-grep Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-grep Mon Apr 19 18:59:02 2010 +0200 @@ -21,6 +21,8 @@ hg grep '**test**' echo % simple hg grep port port +echo % simple with color +hg --config extensions.color= grep --color=always port port echo % all hg grep --traceback --all -nu port port echo % other diff -r 8227a631c6b4 -r 5172261b92af tests/test-grep.out --- a/tests/test-grep.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-grep.out Mon Apr 19 18:59:02 2010 +0200 @@ -4,6 +4,10 @@ port:4:export port:4:vaportight port:4:import/export +% simple with color +port:4:export +port:4:vaportight +port:4:import/export % all port:4:4:-:spam:import/export port:3:4:+:eggs:import/export diff -r 8227a631c6b4 -r 5172261b92af tests/test-help.out --- a/tests/test-help.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-help.out Mon Apr 19 18:59:02 2010 +0200 @@ -15,10 +15,10 @@ pull pull changes from the specified source push push changes to the specified destination remove remove the specified files on the next commit - serve export the repository via HTTP + serve start stand-alone webserver status show changed files in the working directory summary summarize working directory state - update update working directory + update update working directory (or switch revisions) use "hg help" for the full list of commands or "hg -v" for details add add the specified files on the next commit @@ -34,10 +34,10 @@ pull pull changes from the specified source push push changes to the specified destination remove remove the specified files on the next commit - serve export the repository via HTTP + serve start stand-alone webserver status show changed files in the working directory summary summarize working directory state - update update working directory + update update working directory (or switch revisions) Mercurial Distributed SCM list of commands: @@ -79,9 +79,9 @@ rename rename files; equivalent of copy + remove resolve various operations to help finish a merge revert restore individual files or directories to an earlier state - rollback roll back the last transaction + rollback roll back the last transaction (dangerous) root print the root (top) of the current working directory - serve export the repository via HTTP + serve start stand-alone webserver showconfig show combined config settings from all hgrc files status show changed files in the working directory summary summarize working directory state @@ -89,7 +89,7 @@ tags list repository tags tip show the tip revision unbundle apply one or more changegroup files - update update working directory + update update working directory (or switch revisions) verify verify the integrity of the repository version output version and copyright information @@ -144,9 +144,9 @@ rename rename files; equivalent of copy + remove resolve various operations to help finish a merge revert restore individual files or directories to an earlier state - rollback roll back the last transaction + rollback roll back the last transaction (dangerous) root print the root (top) of the current working directory - serve export the repository via HTTP + serve start stand-alone webserver showconfig show combined config settings from all hgrc files status show changed files in the working directory summary summarize working directory state @@ -154,7 +154,7 @@ tags list repository tags tip show the tip revision unbundle apply one or more changegroup files - update update working directory + update update working directory (or switch revisions) verify verify the integrity of the repository version output version and copyright information @@ -206,13 +206,13 @@ remove, rm: remove the specified files on the next commit serve: - export the repository via HTTP + start stand-alone webserver status, st: show changed files in the working directory summary, sum: summarize working directory state update, up, checkout, co: - update working directory + update working directory (or switch revisions) global options: -R --repository repository root directory or name of overlay bundle file @@ -487,10 +487,10 @@ pull pull changes from the specified source push push changes to the specified destination remove remove the specified files on the next commit - serve export the repository via HTTP + serve start stand-alone webserver status show changed files in the working directory summary summarize working directory state - update update working directory + update update working directory (or switch revisions) use "hg help" for the full list of commands or "hg -v" for details hg: unknown command 'skjdfks' @@ -511,10 +511,10 @@ pull pull changes from the specified source push push changes to the specified destination remove remove the specified files on the next commit - serve export the repository via HTTP + serve start stand-alone webserver status show changed files in the working directory summary summarize working directory state - update update working directory + update update working directory (or switch revisions) use "hg help" for the full list of commands or "hg -v" for details %% test command with no help text @@ -565,9 +565,9 @@ rename rename files; equivalent of copy + remove resolve various operations to help finish a merge revert restore individual files or directories to an earlier state - rollback roll back the last transaction + rollback roll back the last transaction (dangerous) root print the root (top) of the current working directory - serve export the repository via HTTP + serve start stand-alone webserver showconfig show combined config settings from all hgrc files status show changed files in the working directory summary summarize working directory state @@ -575,7 +575,7 @@ tags list repository tags tip show the tip revision unbundle apply one or more changegroup files - update update working directory + update update working directory (or switch revisions) verify verify the integrity of the repository version output version and copyright information diff -r 8227a631c6b4 -r 5172261b92af tests/test-hook.out --- a/tests/test-hook.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-hook.out Mon Apr 19 18:59:02 2010 +0200 @@ -101,7 +101,7 @@ adding file changes added 1 changesets with 1 changes to 1 files (run 'hg update' to get a working copy) -rolling back last transaction +rolling back to revision 4 (undo pull) preoutgoing hook: HG_SOURCE=pull preoutgoing.forbid hook: HG_SOURCE=pull pulling from ../a diff -r 8227a631c6b4 -r 5172261b92af tests/test-hup.out --- a/tests/test-hup.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-hup.out Mon Apr 19 18:59:02 2010 +0200 @@ -4,4 +4,4 @@ transaction abort! rollback completed killed! -.hg/00changelog.i .hg/journal.branch .hg/journal.dirstate .hg/requires .hg/store .hg/store/00changelog.i .hg/store/00changelog.i.a +.hg/00changelog.i .hg/journal.branch .hg/journal.desc .hg/journal.dirstate .hg/requires .hg/store .hg/store/00changelog.i .hg/store/00changelog.i.a diff -r 8227a631c6b4 -r 5172261b92af tests/test-import.out --- a/tests/test-import.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-import.out Mon Apr 19 18:59:02 2010 +0200 @@ -182,7 +182,7 @@ applying ../patch1 applying ../patch2 applied 1d4bd90af0e4 -rolling back last transaction +rolling back to revision 2 (undo commit) parent: 1 % hg import in a subdirectory requesting all changes diff -r 8227a631c6b4 -r 5172261b92af tests/test-inherit-mode.out --- a/tests/test-inherit-mode.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-inherit-mode.out Mon Apr 19 18:59:02 2010 +0200 @@ -26,6 +26,7 @@ 00660 ./.hg/store/fncache 00660 ./.hg/store/undo 00660 ./.hg/undo.branch +00660 ./.hg/undo.desc 00660 ./.hg/undo.dirstate 00700 ./dir/ 00600 ./dir/bar @@ -54,4 +55,5 @@ 00660 ../push/.hg/store/fncache 00660 ../push/.hg/store/undo 00660 ../push/.hg/undo.branch +00660 ../push/.hg/undo.desc 00660 ../push/.hg/undo.dirstate diff -r 8227a631c6b4 -r 5172261b92af tests/test-keyword --- a/tests/test-keyword Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-keyword Mon Apr 19 18:59:02 2010 +0200 @@ -139,12 +139,12 @@ echo % compare changenodes in a c cat a c -echo % qinit -c -hg qinit -c +echo % init --mq +hg init --mq echo % qimport hg qimport -r tip -n mqtest.diff -echo % qcommit -hg qcommit -mqtest +echo % commit --mq +hg commit --mq -m mqtest echo % keywords should not be expanded in patch cat .hg/patches/mqtest.diff echo % qpop diff -r 8227a631c6b4 -r 5172261b92af tests/test-keyword.out --- a/tests/test-keyword.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-keyword.out Mon Apr 19 18:59:02 2010 +0200 @@ -1,6 +1,6 @@ % hg kwdemo [extensions] -keyword = +keyword = [keyword] demo.txt = [keywordmaps] @@ -21,7 +21,7 @@ $Revision: xxxxxxxxxxxx $ $Source: /TMP/demo.txt,v $ [extensions] -keyword = +keyword = [keyword] demo.txt = [keywordmaps] @@ -132,9 +132,9 @@ xxx $ $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $ tests for different changenodes -% qinit -c +% init --mq % qimport -% qcommit +% commit --mq % keywords should not be expanded in patch # HG changeset patch # User User Name @@ -198,7 +198,7 @@ +do not process $Id: +xxx $ % rollback -rolling back last transaction +rolling back to revision 2 (undo commit) % status A c % update -C @@ -206,7 +206,7 @@ % custom keyword expansion % try with kwdemo [extensions] -keyword = +keyword = [keyword] * = b = ignore @@ -266,7 +266,7 @@ % status ? c % rollback -rolling back last transaction +rolling back to revision 3 (undo commit) % status R a ? c @@ -308,7 +308,7 @@ ignore $Id$ % rollback -rolling back last transaction +rolling back to revision 3 (undo commit) % clean update 1 files updated, 0 files merged, 0 files removed, 0 files unresolved % kwexpand/kwshrink on selected files diff -r 8227a631c6b4 -r 5172261b92af tests/test-log --- a/tests/test-log Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-log Mon Apr 19 18:59:02 2010 +0200 @@ -118,6 +118,9 @@ echo '% log -d -1' hg log -d -1 +echo '% log -p -l2 --color=always' +hg --config extensions.color= log -p -l2 --color=always + cd .. hg init usertest diff -r 8227a631c6b4 -r 5172261b92af tests/test-log.out --- a/tests/test-log.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-log.out Mon Apr 19 18:59:02 2010 +0200 @@ -279,6 +279,33 @@ summary: r1 % log -d -1 +% log -p -l2 --color=always +changeset: 6:2404bbcab562 +tag: tip +user: test +date: Thu Jan 01 00:00:01 1970 +0000 +summary: b1.1 + +diff -r 302e9dd6890d -r 2404bbcab562 b1 +--- a/b1 Thu Jan 01 00:00:01 1970 +0000 ++++ b/b1 Thu Jan 01 00:00:01 1970 +0000 +@@ -1,1 +1,2 @@ + b1 ++postm + +changeset: 5:302e9dd6890d +parent: 3:e62f78d544b4 +parent: 4:ddb82e70d1a1 +user: test +date: Thu Jan 01 00:00:01 1970 +0000 +summary: m12 + +diff -r e62f78d544b4 -r 302e9dd6890d b2 +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ b/b2 Thu Jan 01 00:00:01 1970 +0000 +@@ -0,0 +1,1 @@ ++b2 + adding a adding b changeset: 0:29a4c94f1924 diff -r 8227a631c6b4 -r 5172261b92af tests/test-mq-guards --- a/tests/test-mq-guards Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-mq-guards Mon Apr 19 18:59:02 2010 +0200 @@ -99,6 +99,8 @@ hg qselect 1 2 3 echo % list patches and guards hg qguard -l +echo % list patches and guards with color +hg --config extensions.color= qguard -l --color=always echo % list series hg qseries -v echo % list guards @@ -125,6 +127,8 @@ echo % should show new.patch and b.patch as Guarded, c.patch as Applied echo % and d.patch as Unapplied hg qseries -v +echo % qseries again, but with color +hg --config extensions.color= qseries -v --color=always hg qguard d.patch +2 echo % new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded. @@ -159,3 +163,5 @@ echo the guards file was not ignored in the past hg qdelete -k b.patch hg qseries -m +echo % hg qseries -m with color +hg --config extensions.color= qseries -m --color=always diff -r 8227a631c6b4 -r 5172261b92af tests/test-mq-guards.out --- a/tests/test-mq-guards.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-mq-guards.out Mon Apr 19 18:59:02 2010 +0200 @@ -84,6 +84,10 @@ a.patch: +1 +2 -3 b.patch: +2 c.patch: unguarded +% list patches and guards with color +a.patch: +1 +2 -3 +b.patch: +2 +c.patch: unguarded % list series 0 G a.patch 1 U b.patch @@ -126,6 +130,11 @@ 1 G b.patch 2 A c.patch 3 U d.patch +% qseries again, but with color +0 G new.patch +1 G b.patch +2 A c.patch +3 U d.patch % new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded. 0 G new.patch 1 G b.patch @@ -206,3 +215,5 @@ % hg qseries -m: only b.patch should be shown the guards file was not ignored in the past b.patch +% hg qseries -m with color +b.patch diff -r 8227a631c6b4 -r 5172261b92af tests/test-newbranch.out --- a/tests/test-newbranch.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-newbranch.out Mon Apr 19 18:59:02 2010 +0200 @@ -62,7 +62,7 @@ default bar % test for invalid branch cache -rolling back last transaction +rolling back to revision 5 (undo commit) changeset: 4:4909a3732169 branch: foo tag: tip diff -r 8227a631c6b4 -r 5172261b92af tests/test-notify.out --- a/tests/test-notify.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-notify.out Mon Apr 19 18:59:02 2010 +0200 @@ -95,10 +95,10 @@ +a (run 'hg update' to get a working copy) % fail for config file is missing -rolling back last transaction +rolling back to revision 1 (undo pull) pull failed % pull -rolling back last transaction +rolling back to revision 1 (undo pull) pulling from ../a searching for changes adding changesets @@ -129,7 +129,7 @@ +a (run 'hg update' to get a working copy) % pull -rolling back last transaction +rolling back to revision 1 (undo pull) pulling from ../a searching for changes adding changesets diff -r 8227a631c6b4 -r 5172261b92af tests/test-patchbomb --- a/tests/test-patchbomb Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-patchbomb Mon Apr 19 18:59:02 2010 +0200 @@ -126,6 +126,11 @@ hg email --date '1970-1-1 0:1' -n --intro -f quux -t foo -c bar -s test \ -r 2 | fixheaders +echo "% test --desc without --intro for a single patch" +echo foo > intro.text +hg email --date '1970-1-1 0:1' -n --desc intro.text -f quux -t foo -c bar \ + -s test -r 2 | fixheaders + echo "% test intro for multiple patches" hg email --date '1970-1-1 0:1' -n --intro -f quux -t foo -c bar -s test \ -r 0:1 | fixheaders diff -r 8227a631c6b4 -r 5172261b92af tests/test-patchbomb.out --- a/tests/test-patchbomb.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-patchbomb.out Mon Apr 19 18:59:02 2010 +0200 @@ -940,6 +940,52 @@ @@ -0,0 +1,1 @@ +c +% test --desc without --intro for a single patch +This patch series consists of 1 patches. + + +Displaying [PATCH 0 of 1] test ... +Content-Type: text/plain; charset="us-ascii" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: [PATCH 0 of 1] test +Message-Id: = 0: total = loops + if opts.get('total', None): + total = int(opts.get('total')) loops = abs(loops) for i in range(loops): @@ -17,7 +19,8 @@ commands.norepo += " loop" cmdtable = { - "loop": (loop, [], 'hg loop LOOPS'), + "loop": (loop, [('', 'total', '', 'override for total')], + 'hg loop LOOPS'), } EOF @@ -55,5 +58,8 @@ echo '% test format options and indeterminate progress' hg -y --config 'progress.format=number item bar' loop -- -2 2>&1 | python filtercr.py +echo "% make sure things don't fall over if count > total" +hg -y loop --total 4 6 2>&1 | python filtercr.py + echo '% test immediate progress completion' hg -y loop 0 2>&1 | python filtercr.py diff -r 8227a631c6b4 -r 5172261b92af tests/test-progress.out --- a/tests/test-progress.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-progress.out Mon Apr 19 18:59:02 2010 +0200 @@ -17,4 +17,12 @@ 0 loop.0 [ <=> ] 1 loop.1 [ <=> ] + % make sure things don't fall over if count > total + +loop [ ] 0/4 +loop [================> ] 1/4 +loop [=================================> ] 2/4 +loop [==================================================> ] 3/4 +loop [===================================================================>] 4/4 +loop [ <=> ] 5/4 % test immediate progress completion diff -r 8227a631c6b4 -r 5172261b92af tests/test-pull --- a/tests/test-pull Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-pull Mon Apr 19 18:59:02 2010 +0200 @@ -11,13 +11,14 @@ cat hg.pid >> $DAEMON_PIDS cd .. -hg clone --pull http://localhost:$HGPORT/ copy | sed -e "s,:$HGPORT/,:\$HGPORT/," +hg clone --pull http://foo:bar@localhost:$HGPORT/ copy | sed -e "s,:$HGPORT/,:\$HGPORT/," cd copy hg verify hg co cat foo hg manifest --debug hg pull | sed -e "s,:$HGPORT/,:\$HGPORT/," +hg rollback --dry-run --verbose | sed -e "s,:$HGPORT/,:\$HGPORT/," echo % issue 622 cd .. diff -r 8227a631c6b4 -r 5172261b92af tests/test-pull-r.out --- a/tests/test-pull-r.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-pull-r.out Mon Apr 19 18:59:02 2010 +0200 @@ -19,7 +19,7 @@ abort: unknown revision 'missing'! % pull multiple revisions with update 0:bbd179dfa0a7 -rolling back last transaction +rolling back to revision 0 (undo pull) % pull -r 0 changeset: 0:bbd179dfa0a7 tag: tip diff -r 8227a631c6b4 -r 5172261b92af tests/test-pull.out --- a/tests/test-pull.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-pull.out Mon Apr 19 18:59:02 2010 +0200 @@ -19,9 +19,10 @@ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved foo 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo -pulling from http://localhost:$HGPORT/ +pulling from http://foo:***@localhost:$HGPORT/ searching for changes no changes found +rolling back to revision 0 (undo pull: http://foo:***@localhost:$HGPORT/) % issue 622 pulling from ../test requesting all changes diff -r 8227a631c6b4 -r 5172261b92af tests/test-push-http.out --- a/tests/test-push-http.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-push-http.out Mon Apr 19 18:59:02 2010 +0200 @@ -25,7 +25,7 @@ remote: added 1 changesets with 1 changes to 1 files % serve errors changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http -rolling back last transaction +rolling back to revision 1 (undo serve) % expect authorization error: all users denied abort: authorization failed pushing to http://localhost:$HGPORT/ diff -r 8227a631c6b4 -r 5172261b92af tests/test-qrecord.out --- a/tests/test-qrecord.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-qrecord.out Mon Apr 19 18:59:02 2010 +0200 @@ -17,10 +17,10 @@ pull pull changes from the specified source push push changes to the specified destination remove remove the specified files on the next commit - serve export the repository via HTTP + serve start stand-alone webserver status show changed files in the working directory summary summarize working directory state - update update working directory + update update working directory (or switch revisions) use "hg help" for the full list of commands or "hg -v" for details % help (mq present) @@ -80,28 +80,34 @@ % qrecord a.patch diff --git a/1.txt b/1.txt 2 hunks, 4 lines changed -examine changes to '1.txt'? [Ynsfdaq?] @@ -1,3 +1,3 @@ +examine changes to '1.txt'? [Ynsfdaq?] +@@ -1,3 +1,3 @@ 1 -2 +2 2 3 -record change 1/6 to '1.txt'? [Ynsfdaq?] @@ -3,3 +3,3 @@ +record change 1/6 to '1.txt'? [Ynsfdaq?] +@@ -3,3 +3,3 @@ 3 -4 +4 4 5 -record change 2/6 to '1.txt'? [Ynsfdaq?] diff --git a/2.txt b/2.txt +record change 2/6 to '1.txt'? [Ynsfdaq?] +diff --git a/2.txt b/2.txt 1 hunks, 2 lines changed -examine changes to '2.txt'? [Ynsfdaq?] @@ -1,5 +1,5 @@ +examine changes to '2.txt'? [Ynsfdaq?] +@@ -1,5 +1,5 @@ a -b +b b c d e -record change 4/6 to '2.txt'? [Ynsfdaq?] diff --git a/dir/a.txt b/dir/a.txt +record change 4/6 to '2.txt'? [Ynsfdaq?] +diff --git a/dir/a.txt b/dir/a.txt 1 hunks, 2 lines changed examine changes to 'dir/a.txt'? [Ynsfdaq?] + % after qrecord a.patch 'tip' changeset: 1:5d1ca63427ee tag: qtip @@ -157,22 +163,26 @@ % qrecord b.patch diff --git a/1.txt b/1.txt 1 hunks, 2 lines changed -examine changes to '1.txt'? [Ynsfdaq?] @@ -1,5 +1,5 @@ +examine changes to '1.txt'? [Ynsfdaq?] +@@ -1,5 +1,5 @@ 1 2 2 3 -4 +4 4 5 -record change 1/3 to '1.txt'? [Ynsfdaq?] diff --git a/dir/a.txt b/dir/a.txt +record change 1/3 to '1.txt'? [Ynsfdaq?] +diff --git a/dir/a.txt b/dir/a.txt 1 hunks, 2 lines changed -examine changes to 'dir/a.txt'? [Ynsfdaq?] @@ -1,4 +1,4 @@ +examine changes to 'dir/a.txt'? [Ynsfdaq?] +@@ -1,4 +1,4 @@ -hello world +hello world! someone up record change 3/3 to 'dir/a.txt'? [Ynsfdaq?] + % after qrecord b.patch 'tip' changeset: 2:b056198bf878 tag: qtip diff -r 8227a631c6b4 -r 5172261b92af tests/test-rebase-pull.out --- a/tests/test-rebase-pull.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-rebase-pull.out Mon Apr 19 18:59:02 2010 +0200 @@ -10,7 +10,6 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) -(run 'hg heads' to see heads, 'hg merge' to merge) saving bundle to adding branch adding changesets @@ -39,8 +38,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files -(run 'hg update' to get a working copy) nothing to rebase +1 files updated, 0 files merged, 0 files removed, 0 files unresolved @ 2 | diff -r 8227a631c6b4 -r 5172261b92af tests/test-record.out --- a/tests/test-record.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-record.out Mon Apr 19 18:59:02 2010 +0200 @@ -39,7 +39,8 @@ % select no files diff --git a/empty-rw b/empty-rw new file mode 100644 -examine changes to 'empty-rw'? [Ynsfdaq?] no changes to record +examine changes to 'empty-rw'? [Ynsfdaq?] +no changes to record changeset: -1:000000000000 tag: tip @@ -50,7 +51,8 @@ % select files but no hunks diff --git a/empty-rw b/empty-rw new file mode 100644 -examine changes to 'empty-rw'? [Ynsfdaq?] abort: empty commit message +examine changes to 'empty-rw'? [Ynsfdaq?] +abort: empty commit message changeset: -1:000000000000 tag: tip @@ -62,6 +64,7 @@ diff --git a/empty-rw b/empty-rw new file mode 100644 examine changes to 'empty-rw'? [Ynsfdaq?] + changeset: 0:c0708cf4e46e tag: tip user: test @@ -74,6 +77,7 @@ rename from empty-rw rename to empty-rename examine changes to 'empty-rw' and 'empty-rename'? [Ynsfdaq?] + changeset: 1:d695e8dcb197 tag: tip user: test @@ -86,6 +90,7 @@ copy from empty-rename copy to empty-copy examine changes to 'empty-rename' and 'empty-copy'? [Ynsfdaq?] + changeset: 2:1d4b90bea524 tag: tip user: test @@ -97,6 +102,7 @@ diff --git a/empty-copy b/empty-copy deleted file mode 100644 examine changes to 'empty-copy'? [Ynsfdaq?] + changeset: 3:b39a238f01a1 tag: tip user: test @@ -110,6 +116,7 @@ new file mode 100644 this is a binary file examine changes to 'tip.bundle'? [Ynsfdaq?] + changeset: 4:ad816da3711e tag: tip user: test @@ -124,6 +131,7 @@ diff --git a/tip.bundle b/tip.bundle this modifies a binary file (all or nothing) examine changes to 'tip.bundle'? [Ynsfdaq?] + changeset: 5:dccd6f3eb485 tag: tip user: test @@ -140,6 +148,7 @@ rename to top.bundle this modifies a binary file (all or nothing) examine changes to 'tip.bundle' and 'top.bundle'? [Ynsfdaq?] + changeset: 6:7fa44105f5b3 tag: tip user: test @@ -155,6 +164,7 @@ diff --git a/plain b/plain new file mode 100644 examine changes to 'plain'? [Ynsfdaq?] + changeset: 7:11fb457c1be4 tag: tip user: test @@ -179,46 +189,55 @@ % modify end of plain file diff --git a/plain b/plain 1 hunks, 1 lines changed -examine changes to 'plain'? [Ynsfdaq?] @@ -8,3 +8,4 @@ +examine changes to 'plain'? [Ynsfdaq?] +@@ -8,3 +8,4 @@ 8 9 10 +11 -record this change to 'plain'? [Ynsfdaq?] % modify end of plain file, no EOL +record this change to 'plain'? [Ynsfdaq?] +% modify end of plain file, no EOL diff --git a/plain b/plain 1 hunks, 1 lines changed -examine changes to 'plain'? [Ynsfdaq?] @@ -9,3 +9,4 @@ +examine changes to 'plain'? [Ynsfdaq?] +@@ -9,3 +9,4 @@ 9 10 11 +7264f99c5f5ff3261504828afa4fb4d406c3af54 \ No newline at end of file -record this change to 'plain'? [Ynsfdaq?] % modify end of plain file, add EOL +record this change to 'plain'? [Ynsfdaq?] +% modify end of plain file, add EOL diff --git a/plain b/plain 1 hunks, 2 lines changed -examine changes to 'plain'? [Ynsfdaq?] @@ -9,4 +9,4 @@ +examine changes to 'plain'? [Ynsfdaq?] +@@ -9,4 +9,4 @@ 9 10 11 -7264f99c5f5ff3261504828afa4fb4d406c3af54 \ No newline at end of file +7264f99c5f5ff3261504828afa4fb4d406c3af54 -record this change to 'plain'? [Ynsfdaq?] % modify beginning, trim end, record both +record this change to 'plain'? [Ynsfdaq?] +% modify beginning, trim end, record both diff --git a/plain b/plain 2 hunks, 4 lines changed -examine changes to 'plain'? [Ynsfdaq?] @@ -1,4 +1,4 @@ +examine changes to 'plain'? [Ynsfdaq?] +@@ -1,4 +1,4 @@ -1 +2 2 3 4 -record change 1/2 to 'plain'? [Ynsfdaq?] @@ -8,5 +8,3 @@ +record change 1/2 to 'plain'? [Ynsfdaq?] +@@ -8,5 +8,3 @@ 8 9 10 -11 -7264f99c5f5ff3261504828afa4fb4d406c3af54 record change 2/2 to 'plain'? [Ynsfdaq?] + changeset: 11:efca65c9b09e tag: tip user: test @@ -245,7 +264,8 @@ % record end diff --git a/plain b/plain 2 hunks, 5 lines changed -examine changes to 'plain'? [Ynsfdaq?] @@ -1,9 +1,6 @@ +examine changes to 'plain'? [Ynsfdaq?] +@@ -1,9 +1,6 @@ -2 -2 -3 @@ -255,7 +275,8 @@ 7 8 9 -record change 1/2 to 'plain'? [Ynsfdaq?] @@ -4,7 +1,7 @@ +record change 1/2 to 'plain'? [Ynsfdaq?] +@@ -4,7 +1,7 @@ 4 5 6 @@ -265,6 +286,7 @@ -10 +10.new record change 2/2 to 'plain'? [Ynsfdaq?] + changeset: 12:7d1e66983c15 tag: tip user: test @@ -284,7 +306,8 @@ % record beginning diff --git a/plain b/plain 1 hunks, 3 lines changed -examine changes to 'plain'? [Ynsfdaq?] @@ -1,6 +1,3 @@ +examine changes to 'plain'? [Ynsfdaq?] +@@ -1,6 +1,3 @@ -2 -2 -3 @@ -292,6 +315,7 @@ 5 6 record this change to 'plain'? [Ynsfdaq?] + changeset: 13:a09fc62a0e61 tag: tip user: test @@ -313,7 +337,8 @@ % record end diff --git a/plain b/plain 2 hunks, 4 lines changed -examine changes to 'plain'? [Ynsfdaq?] @@ -1,6 +1,9 @@ +examine changes to 'plain'? [Ynsfdaq?] +@@ -1,6 +1,9 @@ +1 +2 +3 @@ -323,7 +348,8 @@ 7 8 9 -record change 1/2 to 'plain'? [Ynsfdaq?] @@ -1,7 +4,6 @@ +record change 1/2 to 'plain'? [Ynsfdaq?] +@@ -1,7 +4,6 @@ 4 5 6 @@ -331,17 +357,20 @@ 8 9 -10.new -record change 2/2 to 'plain'? [Ynsfdaq?] % add to beginning, middle, end +record change 2/2 to 'plain'? [Ynsfdaq?] +% add to beginning, middle, end % record beginning, middle diff --git a/plain b/plain 3 hunks, 7 lines changed -examine changes to 'plain'? [Ynsfdaq?] @@ -1,2 +1,5 @@ +examine changes to 'plain'? [Ynsfdaq?] +@@ -1,2 +1,5 @@ +1 +2 +3 4 5 -record change 1/3 to 'plain'? [Ynsfdaq?] @@ -1,6 +4,8 @@ +record change 1/3 to 'plain'? [Ynsfdaq?] +@@ -1,6 +4,8 @@ 4 5 +5.new @@ -350,7 +379,8 @@ 7 8 9 -record change 2/3 to 'plain'? [Ynsfdaq?] @@ -3,4 +8,6 @@ +record change 2/3 to 'plain'? [Ynsfdaq?] +@@ -3,4 +8,6 @@ 6 7 8 @@ -358,6 +388,7 @@ +10 +11 record change 3/3 to 'plain'? [Ynsfdaq?] + changeset: 15:7d137997f3a6 tag: tip user: test @@ -382,13 +413,15 @@ % record end diff --git a/plain b/plain 1 hunks, 2 lines changed -examine changes to 'plain'? [Ynsfdaq?] @@ -9,3 +9,5 @@ +examine changes to 'plain'? [Ynsfdaq?] +@@ -9,3 +9,5 @@ 7 8 9 +10 +11 record this change to 'plain'? [Ynsfdaq?] + changeset: 16:4959e3ff13eb tag: tip user: test @@ -408,10 +441,12 @@ adding subdir/a diff --git a/subdir/a b/subdir/a 1 hunks, 1 lines changed -examine changes to 'subdir/a'? [Ynsfdaq?] @@ -1,1 +1,2 @@ +examine changes to 'subdir/a'? [Ynsfdaq?] +@@ -1,1 +1,2 @@ a +a record this change to 'subdir/a'? [Ynsfdaq?] + changeset: 18:40698cd490b2 tag: tip user: test @@ -428,7 +463,8 @@ % help, quit diff --git a/subdir/f1 b/subdir/f1 1 hunks, 1 lines changed -examine changes to 'subdir/f1'? [Ynsfdaq?] y - record this change +examine changes to 'subdir/f1'? [Ynsfdaq?] +y - record this change n - skip this change s - skip remaining changes to this file f - record remaining changes to this file @@ -436,31 +472,38 @@ a - record all changes to all remaining files q - quit, recording no changes ? - display help -examine changes to 'subdir/f1'? [Ynsfdaq?] abort: user quit +examine changes to 'subdir/f1'? [Ynsfdaq?] +abort: user quit % skip diff --git a/subdir/f1 b/subdir/f1 1 hunks, 1 lines changed -examine changes to 'subdir/f1'? [Ynsfdaq?] diff --git a/subdir/f2 b/subdir/f2 +examine changes to 'subdir/f1'? [Ynsfdaq?] +diff --git a/subdir/f2 b/subdir/f2 1 hunks, 1 lines changed examine changes to 'subdir/f2'? [Ynsfdaq?] abort: response expected % no diff --git a/subdir/f1 b/subdir/f1 1 hunks, 1 lines changed -examine changes to 'subdir/f1'? [Ynsfdaq?] diff --git a/subdir/f2 b/subdir/f2 +examine changes to 'subdir/f1'? [Ynsfdaq?] +diff --git a/subdir/f2 b/subdir/f2 1 hunks, 1 lines changed examine changes to 'subdir/f2'? [Ynsfdaq?] abort: response expected % f, quit diff --git a/subdir/f1 b/subdir/f1 1 hunks, 1 lines changed -examine changes to 'subdir/f1'? [Ynsfdaq?] diff --git a/subdir/f2 b/subdir/f2 +examine changes to 'subdir/f1'? [Ynsfdaq?] +diff --git a/subdir/f2 b/subdir/f2 1 hunks, 1 lines changed -examine changes to 'subdir/f2'? [Ynsfdaq?] abort: user quit +examine changes to 'subdir/f2'? [Ynsfdaq?] +abort: user quit % s, all diff --git a/subdir/f1 b/subdir/f1 1 hunks, 1 lines changed -examine changes to 'subdir/f1'? [Ynsfdaq?] diff --git a/subdir/f2 b/subdir/f2 +examine changes to 'subdir/f1'? [Ynsfdaq?] +diff --git a/subdir/f2 b/subdir/f2 1 hunks, 1 lines changed examine changes to 'subdir/f2'? [Ynsfdaq?] + changeset: 20:d2d8c25276a8 tag: tip user: test @@ -478,6 +521,7 @@ diff --git a/subdir/f1 b/subdir/f1 1 hunks, 1 lines changed examine changes to 'subdir/f1'? [Ynsfdaq?] + changeset: 21:1013f51ce32f tag: tip user: test @@ -496,11 +540,13 @@ old mode 100644 new mode 100755 1 hunks, 1 lines changed -examine changes to 'subdir/f1'? [Ynsfdaq?] @@ -1,2 +1,3 @@ +examine changes to 'subdir/f1'? [Ynsfdaq?] +@@ -1,2 +1,3 @@ a a +a record this change to 'subdir/f1'? [Ynsfdaq?] + changeset: 22:5df857735621 tag: tip user: test @@ -520,12 +566,14 @@ % preserve execute permission on original diff --git a/subdir/f1 b/subdir/f1 1 hunks, 1 lines changed -examine changes to 'subdir/f1'? [Ynsfdaq?] @@ -1,3 +1,4 @@ +examine changes to 'subdir/f1'? [Ynsfdaq?] +@@ -1,3 +1,4 @@ a a a +b record this change to 'subdir/f1'? [Ynsfdaq?] + changeset: 23:a4ae36a78715 tag: tip user: test @@ -546,12 +594,14 @@ old mode 100755 new mode 100644 1 hunks, 1 lines changed -examine changes to 'subdir/f1'? [Ynsfdaq?] @@ -2,3 +2,4 @@ +examine changes to 'subdir/f1'? [Ynsfdaq?] +@@ -2,3 +2,4 @@ a a b +c record this change to 'subdir/f1'? [Ynsfdaq?] + changeset: 24:1460f6e47966 tag: tip user: test @@ -572,12 +622,14 @@ % with win32ext diff --git a/subdir/f1 b/subdir/f1 1 hunks, 1 lines changed -examine changes to 'subdir/f1'? [Ynsfdaq?] @@ -3,3 +3,4 @@ +examine changes to 'subdir/f1'? [Ynsfdaq?] +@@ -3,3 +3,4 @@ a b c +d record this change to 'subdir/f1'? [Ynsfdaq?] + changeset: 25:5bacc1f6e9cf tag: tip user: test diff -r 8227a631c6b4 -r 5172261b92af tests/test-rename-after-merge.out --- a/tests/test-rename-after-merge.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-rename-after-merge.out Mon Apr 19 18:59:02 2010 +0200 @@ -34,7 +34,7 @@ (branch merge, don't forget to commit) % commit issue 1476 copies: c2 (c1) -rolling back last transaction +rolling back to revision 3 (undo commit) 2 files updated, 0 files merged, 2 files removed, 0 files unresolved % merge heads again 2 files updated, 0 files merged, 0 files removed, 0 files unresolved diff -r 8227a631c6b4 -r 5172261b92af tests/test-rollback.out --- a/tests/test-rollback.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-rollback.out Mon Apr 19 18:59:02 2010 +0200 @@ -9,7 +9,7 @@ date: Mon Jan 12 13:46:40 1970 +0000 summary: test -rolling back last transaction +rolling back to revision 0 (undo commit) checking changesets checking manifests crosschecking files in changesets and manifests @@ -18,14 +18,14 @@ A a % Test issue 902 marked working directory as branch test -rolling back last transaction +rolling back to revision 0 (undo commit) default % Test issue 1635 (commit message saved) .hg/last-message.txt: test2 % Test rollback of hg before issue 902 was fixed marked working directory as branch test -rolling back last transaction +rolling back to revision 0 (undo commit) Named branch could not be reset, current branch still is: test test % rollback by pretxncommit saves commit message (issue 1635) diff -r 8227a631c6b4 -r 5172261b92af tests/test-serve --- a/tests/test-serve Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-serve Mon Apr 19 18:59:02 2010 +0200 @@ -2,8 +2,10 @@ hgserve() { - hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -E errors.log -v $@ \ - | sed -e 's/:[0-9][0-9]*//g' -e 's/http:\/\/[^/]*\//http:\/\/localhost\//' + hg serve -a localhost -d --pid-file=hg.pid -E errors.log -v $@ \ + | sed -e "s/:$HGPORT1\\([^0-9]\\)/:HGPORT1\1/g" \ + -e "s/:$HGPORT2\\([^0-9]\\)/:HGPORT2\1/g" \ + -e 's/http:\/\/[^/]*\//http:\/\/localhost\//' cat hg.pid >> "$DAEMON_PIDS" echo % errors cat errors.log @@ -17,6 +19,7 @@ echo '[web]' > .hg/hgrc echo 'accesslog = access.log' >> .hg/hgrc +echo "port = $HGPORT1" >> .hg/hgrc echo % Without -v hg serve -a localhost -p $HGPORT -d --pid-file=hg.pid -E errors.log @@ -30,6 +33,9 @@ echo % With -v hgserve +echo % With -v and -p HGPORT2 +hgserve -p "$HGPORT2" + echo % With --prefix foo hgserve --prefix foo diff -r 8227a631c6b4 -r 5172261b92af tests/test-serve.out --- a/tests/test-serve.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-serve.out Mon Apr 19 18:59:02 2010 +0200 @@ -2,17 +2,20 @@ access log created - .hg/hgrc respected % errors % With -v -listening at http://localhost/ (bound to 127.0.0.1) +listening at http://localhost/ (bound to 127.0.0.1:HGPORT1) +% errors +% With -v and -p HGPORT2 +listening at http://localhost/ (bound to 127.0.0.1:HGPORT2) % errors % With --prefix foo -listening at http://localhost/foo/ (bound to 127.0.0.1) +listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1) % errors % With --prefix /foo -listening at http://localhost/foo/ (bound to 127.0.0.1) +listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1) % errors % With --prefix foo/ -listening at http://localhost/foo/ (bound to 127.0.0.1) +listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1) % errors % With --prefix /foo/ -listening at http://localhost/foo/ (bound to 127.0.0.1) +listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1) % errors diff -r 8227a631c6b4 -r 5172261b92af tests/test-status-inprocess.py --- a/tests/test-status-inprocess.py Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-status-inprocess.py Mon Apr 19 18:59:02 2010 +0200 @@ -1,5 +1,4 @@ #!/usr/bin/python -import os from mercurial.ui import ui from mercurial.localrepo import localrepository from mercurial.commands import add, commit, status diff -r 8227a631c6b4 -r 5172261b92af tests/test-strict.out --- a/tests/test-strict.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-strict.out Mon Apr 19 18:59:02 2010 +0200 @@ -18,10 +18,10 @@ pull pull changes from the specified source push push changes to the specified destination remove remove the specified files on the next commit - serve export the repository via HTTP + serve start stand-alone webserver status show changed files in the working directory summary summarize working directory state - update update working directory + update update working directory (or switch revisions) use "hg help" for the full list of commands or "hg -v" for details 0: a diff -r 8227a631c6b4 -r 5172261b92af tests/test-subrepo --- a/tests/test-subrepo Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-subrepo Mon Apr 19 18:59:02 2010 +0200 @@ -78,7 +78,7 @@ echo % clone cd .. -hg clone t tc +hg clone t tc | sed 's|from .*/sub|from .../sub|g' cd tc hg debugsub @@ -102,7 +102,8 @@ echo % pull cd ../tc hg pull | sed 's/ .*sub/ ...sub/g' -hg up # should pull t +# should pull t +hg up | sed 's|from .*/sub|from .../sub|g' cat t/t echo % bogus subrepo path aborts diff -r 8227a631c6b4 -r 5172261b92af tests/test-subrepo.out --- a/tests/test-subrepo.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-subrepo.out Mon Apr 19 18:59:02 2010 +0200 @@ -108,19 +108,19 @@ >>>>>>> other % clone updating to branch default -pulling subrepo s +pulling subrepo s from .../sub/t/s requesting all changes adding changesets adding manifests adding file changes added 4 changesets with 5 changes to 3 files -pulling subrepo ss +pulling subrepo ss from .../sub/t/s/ss requesting all changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files -pulling subrepo t +pulling subrepo t from .../sub/t/t requesting all changes adding changesets adding manifests @@ -197,7 +197,7 @@ adding file changes added 1 changesets with 1 changes to 1 files (run 'hg update' to get a working copy) -pulling subrepo t +pulling subrepo t from .../sub/t/t searching for changes adding changesets adding manifests diff -r 8227a631c6b4 -r 5172261b92af tests/test-tags.out --- a/tests/test-tags.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-tags.out Mon Apr 19 18:59:02 2010 +0200 @@ -111,7 +111,7 @@ summary: Removed tag bar % rollback undoes tag operation -rolling back last transaction +rolling back to revision 5 (undo commit) tip 4:0c192d7d5e6b bar 1:78391a272241 tip 4:0c192d7d5e6b diff -r 8227a631c6b4 -r 5172261b92af tests/test-url-rev.out --- a/tests/test-url-rev.out Mon Apr 19 18:57:16 2010 +0200 +++ b/tests/test-url-rev.out Mon Apr 19 18:59:02 2010 +0200 @@ -75,7 +75,7 @@ % rolling back -rolling back last transaction +rolling back to revision 2 (undo push) % incoming 2:faba9097cad4 % pull @@ -104,7 +104,7 @@ % no new revs, no update 0:1f0dee641bb7 % rollback -rolling back last transaction +rolling back to revision 2 (undo pull) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 0:1f0dee641bb7 % pull -u takes us back to branch foo @@ -116,7 +116,7 @@ summary: new head of branch foo % rollback -rolling back last transaction +rolling back to revision 2 (undo pull) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved % parents 0:1f0dee641bb7