# HG changeset patch # User Patrick Mezard # Date 1254691014 -7200 # Node ID 53a95a74481248a92ea4faf10c302d1e948b7968 # Parent cad36e496640e55c19d0960c258a82540c98d501# Parent b3c13e721593b991c9b4b8f336fb09f70b09bf36 Merge with crew-stable diff -r b3c13e721593 -r 53a95a744812 Makefile --- a/Makefile Sun Oct 04 23:06:14 2009 +0200 +++ b/Makefile Sun Oct 04 23:16:54 2009 +0200 @@ -79,16 +79,16 @@ update-pot: i18n/hg.pot -i18n/hg.pot: $(PYTHON_FILES) +i18n/hg.pot: $(PYTHON_FILES) help/*.txt $(PYTHON) i18n/hggettext mercurial/commands.py \ - hgext/*.py hgext/*/__init__.py > i18n/hg.pot + hgext/*.py hgext/*/__init__.py help/*.txt > i18n/hg.pot # All strings marked for translation in Mercurial contain # ASCII characters only. But some files contain string # literals like this '\037\213'. xgettext thinks it has to # parse them even though they are not marked for translation. # Extracting with an explicit encoding of ISO-8859-1 will make # xgettext "parse" and ignore them. - echo $^ | xargs \ + echo $(PYTHON_FILES) | xargs \ xgettext --package-name "Mercurial" \ --msgid-bugs-address "" \ --copyright-holder "Matt Mackall and others" \ diff -r b3c13e721593 -r 53a95a744812 contrib/bash_completion --- a/contrib/bash_completion Sun Oct 04 23:06:14 2009 +0200 +++ b/contrib/bash_completion Sun Oct 04 23:16:54 2009 +0200 @@ -530,3 +530,20 @@ return } +# shelve +_hg_shelves() +{ + local shelves="$("$hg" unshelve -l . 2>/dev/null)" + local IFS=$'\n' + COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$shelves' -- "$cur")) +} + +_hg_cmd_shelve() +{ + _hg_status "mard" +} + +_hg_cmd_unshelve() +{ + _hg_shelves +} diff -r b3c13e721593 -r 53a95a744812 contrib/hgdiff --- a/contrib/hgdiff Sun Oct 04 23:06:14 2009 +0200 +++ b/contrib/hgdiff Sun Oct 04 23:16:54 2009 +0200 @@ -38,13 +38,13 @@ def diff_files(file1, file2): if file1 is None: - b = file(file2).read().splitlines(1) + 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(1) + a = file(file1).read().splitlines(True) l1 = "--- %s\n" % (file1) l2 = "+++ %s\n" % (file1) l3 = "@@ -1,%d +0,0 @@\n" % len(a) @@ -52,8 +52,8 @@ else: t1 = file(file1).read() t2 = file(file2).read() - l1 = t1.splitlines(1) - l2 = t2.splitlines(1) + l1 = t1.splitlines(True) + l2 = t2.splitlines(True) if options.difflib: l = difflib.unified_diff(l1, l2, file1, file2) else: diff -r b3c13e721593 -r 53a95a744812 contrib/perf.py --- a/contrib/perf.py Sun Oct 04 23:06:14 2009 +0200 +++ b/contrib/perf.py Sun Oct 04 23:16:54 2009 +0200 @@ -51,7 +51,7 @@ def t(): repo.changelog = mercurial.changelog.changelog(repo.sopener) repo.manifest = mercurial.manifest.manifest(repo.sopener) - repo.tagscache = None + repo._tags = None return len(repo.tags()) timer(t) diff -r b3c13e721593 -r 53a95a744812 contrib/shrink-revlog.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contrib/shrink-revlog.py Sun Oct 04 23:16:54 2009 +0200 @@ -0,0 +1,218 @@ +#!/usr/bin/env python + +"""\ +Reorder a revlog (by default the the manifest file in the current +repository) to save space. Specifically, this topologically sorts the +revisions in the revlog so that revisions on the same branch are adjacent +as much as possible. This is a workaround for the fact that Mercurial +computes deltas relative to the previous revision rather than relative to a +parent revision. This is *not* safe to run on a changelog. +""" + +# Originally written by Benoit Boissinot +# as a patch to rewrite-log. Cleaned up, refactored, documented, and +# renamed by Greg Ward . + +# XXX would be nice to have a way to verify the repository after shrinking, +# e.g. by comparing "before" and "after" states of random changesets +# (maybe: export before, shrink, export after, diff). + +import sys, os, tempfile +import optparse +from mercurial import ui as ui_, hg, revlog, transaction, node, util + +def toposort(rl): + write = sys.stdout.write + + children = {} + root = [] + # build children and roots + write('reading %d revs ' % len(rl)) + try: + for i in 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) + + if len(parents) == 0: + root.append(i) + + if i % 1000 == 0: + write('.') + finally: + write('\n') + + # XXX this is a reimplementation of the 'branchsort' topo sort + # algorithm in hgext.convert.convcmd... would be nice not to duplicate + # the algorithm + write('sorting ...') + 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 + write('\n') + return ret + +def writerevs(r1, r2, order, tr): + write = sys.stdout.write + write('writing %d revs ' % len(order)) + try: + count = 0 + for rev in order: + n = r1.node(rev) + p1, p2 = r1.parents(n) + l = r1.linkrev(rev) + t = r1.revision(n) + n2 = r2.addrevision(t, tr, l, p1, p2) + + if count % 1000 == 0: + write('.') + count += 1 + finally: + write('\n') + +def report(olddatafn, newdatafn): + oldsize = float(os.stat(olddatafn).st_size) + newsize = float(os.stat(newdatafn).st_size) + + # argh: have to pass an int to %d, because a float >= 2^32 + # blows up under Python 2.5 or earlier + sys.stdout.write('old file size: %12d bytes (%6.1f MiB)\n' + % (int(oldsize), oldsize/1024/1024)) + sys.stdout.write('new file size: %12d bytes (%6.1f MiB)\n' + % (int(newsize), newsize/1024/1024)) + + shrink_percent = (oldsize - newsize) / oldsize * 100 + shrink_factor = oldsize / newsize + sys.stdout.write('shrinkage: %.1f%% (%.1fx)\n' + % (shrink_percent, shrink_factor)) + +def main(): + + # Unbuffer stdout for nice progress output. + sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) + write = sys.stdout.write + + parser = optparse.OptionParser(description=__doc__) + parser.add_option('-R', '--repository', + default=os.path.curdir, + metavar='REPO', + help='repository root directory [default: current dir]') + parser.add_option('--revlog', + metavar='FILE', + help='shrink FILE [default: REPO/hg/store/00manifest.i]') + (options, args) = parser.parse_args() + if args: + parser.error('too many arguments') + + # Open the specified repository. + ui = ui_.ui() + repo = hg.repository(ui, options.repository) + if not repo.local(): + parser.error('not a local repository: %s' % options.repository) + + if options.revlog is None: + indexfn = repo.sjoin('00manifest.i') + else: + if not options.revlog.endswith('.i'): + parser.error('--revlog option must specify the revlog index file ' + '(*.i), not %s' % options.revlog) + + indexfn = os.path.realpath(options.revlog) + store = repo.sjoin('') + if not indexfn.startswith(store): + parser.error('--revlog option must specify a revlog in %s, not %s' + % (store, indexfn)) + + datafn = indexfn[:-2] + '.d' + if not os.path.exists(indexfn): + parser.error('no such file: %s' % indexfn) + if '00changelog' in indexfn: + parser.error('shrinking the changelog will corrupt your repository') + if not os.path.exists(datafn): + # This is just a lazy shortcut because I can't be bothered to + # handle all the special cases that entail from no .d file. + parser.error('%s does not exist: revlog not big enough ' + 'to be worth shrinking' % datafn) + + oldindexfn = indexfn + '.old' + olddatafn = datafn + '.old' + if os.path.exists(oldindexfn) or os.path.exists(olddatafn): + parser.error('one or both of\n' + ' %s\n' + ' %s\n' + 'exists from a previous run; please clean up before ' + 'running again' + % (oldindexfn, olddatafn)) + + write('shrinking %s\n' % indexfn) + prefix = os.path.basename(indexfn)[:-1] + (tmpfd, tmpindexfn) = tempfile.mkstemp(dir=os.path.dirname(indexfn), + prefix=prefix, + suffix='.i') + tmpdatafn = tmpindexfn[:-2] + '.d' + os.close(tmpfd) + + r1 = revlog.revlog(util.opener(os.getcwd(), audit=False), indexfn) + r2 = revlog.revlog(util.opener(os.getcwd(), audit=False), tmpindexfn) + + # Don't use repo.transaction(), because then things get hairy with + # paths: some need to be relative to .hg, and some need to be + # absolute. Doing it this way keeps things simple: everything is an + # absolute path. + lock = repo.lock(wait=False) + tr = transaction.transaction(sys.stderr.write, + open, + repo.sjoin('journal')) + + try: + try: + order = toposort(r1) + writerevs(r1, r2, order, tr) + report(datafn, tmpdatafn) + tr.close() + except: + # Abort transaction first, so we truncate the files before + # deleting them. + tr.abort() + if os.path.exists(tmpindexfn): + os.unlink(tmpindexfn) + if os.path.exists(tmpdatafn): + os.unlink(tmpdatafn) + raise + finally: + lock.release() + + os.link(indexfn, oldindexfn) + os.link(datafn, olddatafn) + os.rename(tmpindexfn, indexfn) + os.rename(tmpdatafn, datafn) + write('note: old revlog saved in:\n' + ' %s\n' + ' %s\n' + '(You can delete those files when you are satisfied that your\n' + 'repository is still sane. ' + 'Running \'hg verify\' is strongly recommended.)\n' + % (oldindexfn, olddatafn)) + +try: + main() +except KeyboardInterrupt: + sys.exit("interrupted") diff -r b3c13e721593 -r 53a95a744812 contrib/win32/mercurial.ini --- a/contrib/win32/mercurial.ini Sun Oct 04 23:06:14 2009 +0200 +++ b/contrib/win32/mercurial.ini Sun Oct 04 23:16:54 2009 +0200 @@ -1,30 +1,71 @@ -; System-wide Mercurial config file. To override these settings on a -; per-user basis, please edit the following file instead, where -; USERNAME is your Windows user name: -; C:\Documents and Settings\USERNAME\Mercurial.ini +; System-wide Mercurial config file. +; +; !!! Do Not Edit This File !!! +; +; This file will be replaced by the installer on every upgrade. +; Editing this file can cause strange side effects on Vista. +; +; http://bitbucket.org/tortoisehg/stable/issue/135 +; +; To change settings you see in this file, override (or enable) them in +; your user Mercurial.ini file, where USERNAME is your Windows user name: +; +; XP or older - C:\Documents and Settings\USERNAME\Mercurial.ini +; Vista or later - C:\Users\USERNAME\Mercurial.ini + [ui] +; editor used to enter commit logs, etc. Most text editors will work. editor = notepad ; show changed files and be a bit more verbose if True ; verbose = True - + ; username data to appear in commits ; it usually takes the form: Joe User ; username = Joe User - -; By default, we try to encode and decode all files that do not -; contain ASCII NUL characters. What this means is that we try to set -; line endings to Windows style on update, and to Unix style on -; commit. This lets us cooperate with Linux and Unix users, so -; everybody sees files with their native line endings. +; In order to push/pull over ssh you must specify an ssh tool +;ssh = "C:\Progra~1\TortoiseSVN\bin\TortoisePlink.exe" -ssh -2 +;ssh = C:\cygwin\bin\ssh +; +; For more information about mercurial extensions, start here +; http://www.selenic.com/mercurial/wiki/index.cgi/UsingExtensions +; +; Extensions shipped with Mercurial +; [extensions] -; The win32text extension is available and installed by default. It -; provides built-in Python hooks to perform line ending conversions. -; This is normally much faster than running an external program. -hgext.win32text = +;acl = +;alias = +;bookmarks = +;bugzilla = +;children = +;churn = +;color = +;convert = +;extdiff = +;fetch = +;gpg = +;graphlog = +;hgcia = +;hgk = +;highlight = +;interhg = +;keyword = +;mq = +;notify = +;pager = +;parentrevspec = +;patchbomb = +;purge = +;rebase = +;record = +;transplant = +;win32mbcs = +;win32text = +;zeroconf = +; To use cleverencode/cleverdecode, you must enable win32text extension [encode] ; Encode files that don't contain NUL characters. @@ -44,10 +85,40 @@ ; Alternatively, you can explicitly specify each file extension that ; you want decoded (any you omit will be left untouched), like this: + ; **.txt = dumbdecode: + +[patch] +; If you enable win32text filtering, you will want to enable this +; line as well to allow patching to work correctly. + +; eol = crlf + + +; +; Define external diff commands +; +[extdiff] +;cmd.bc3diff = C:\Program Files\Beyond Compare 3\BCompare.exe +;cmd.vdiff = C:\Progra~1\TortoiseSVN\bin\TortoiseMerge.exe +;cmd.vimdiff = gvim.exe +;opts.vimdiff = -f '+next' '+execute "DirDiff ".argv(0)." ".argv(1)' + + [hgk] ; Replace the following with your path to hgk, uncomment it and -; install ActiveTcl (or another win32 port) +; install ActiveTcl (or another win32 port like tclkit) ; path="C:\Program Files\Mercurial\Contrib\hgk.tcl" +; vdiff=vdiff + +; +; The git extended diff format can represent binary files, file +; permission changes, and rename information that the normal patch format +; cannot describe. However it is also not compatible with tools which +; expect normal patches. so enable git patches at your own risk. +; +[diff] +;git = false +;nodates = false diff -r b3c13e721593 -r 53a95a744812 contrib/win32/win32-build.txt --- a/contrib/win32/win32-build.txt Sun Oct 04 23:06:14 2009 +0200 +++ b/contrib/win32/win32-build.txt Sun Oct 04 23:16:54 2009 +0200 @@ -36,8 +36,8 @@ add_path (you need only add_path.exe in the zip file) http://www.barisione.org/apps.html#add_path - Asciidoc - optional - http://www.methods.co.nz/asciidoc/ + Docutils + http://docutils.sourceforge.net/ And, of course, Mercurial itself. @@ -82,11 +82,16 @@ Microsoft.VC90.MFC.manifest) Before building the installer, you have to build Mercurial HTML documentation -(or fix mercurial.iss to not reference the doc directory). Assuming you have an -"asciidoc.bat" batch file somewhere in your PATH: +(or fix mercurial.iss to not reference the doc directory). Docutils does not +come with a ready-made script for rst2html.py, so you will have to write your +own and put it in %PATH% like: + + @python c:\pythonXX\scripts\rst2html.py %* + +Then build the documentation with: cd doc - mingw32-make ASCIIDOC=asciidoc.bat html + mingw32-make RST2HTML=rst2html.bat html cd .. If you use ISTool, you open the C:\hg\hg-release\contrib\win32\mercurial.iss @@ -108,7 +113,7 @@ echo compiler=mingw32 >> setup.cfg python setup.py py2exe -b 1 cd doc - mingw32-make ASCIIDOC=asciidoc.bat html + mingw32-make RST2HTML=rst2html.bat html cd .. iscc contrib\win32\mercurial.iss /DVERSION=snapshot diff -r b3c13e721593 -r 53a95a744812 doc/Makefile --- a/doc/Makefile Sun Oct 04 23:06:14 2009 +0200 +++ b/doc/Makefile Sun Oct 04 23:16:54 2009 +0200 @@ -5,7 +5,7 @@ MANDIR=$(PREFIX)/share/man INSTALL=install -c -m 644 PYTHON=python -ASCIIDOC=asciidoc +RST2HTML=$(shell which rst2html 2> /dev/null || which rst2html.py) all: man html @@ -16,22 +16,19 @@ hg.1.txt: hg.1.gendoc.txt touch hg.1.txt -hg.1.gendoc.txt: ../mercurial/commands.py ../mercurial/help.py - ${PYTHON} gendoc.py > $@ +hg.1.gendoc.txt: gendoc.py ../mercurial/commands.py ../mercurial/help.py + ${PYTHON} gendoc.py > $@.tmp + mv $@.tmp $@ -%: %.xml - xmlto man $*.xml && \ - sed -e 's/^\.hg/\\\&.hg/' $* > $*~ && \ - mv $*~ $* +%: %.txt common.txt + $(PYTHON) rst2man.py --halt warning \ + --strip-elements-with-class htmlonly $*.txt $* -%.xml: %.txt - $(ASCIIDOC) -d manpage -b docbook $*.txt - -%.html: %.txt - $(ASCIIDOC) -b html4 $*.txt || $(ASCIIDOC) -b html $*.txt +%.html: %.txt common.txt + $(RST2HTML) --halt warning $*.txt $*.html MANIFEST: man html - # tracked files are already in the main MANIFEST +# tracked files are already in the main MANIFEST $(RM) $@ for i in $(MAN) $(HTML) hg.1.gendoc.txt; do \ echo "doc/$$i" >> $@ ; \ @@ -45,4 +42,4 @@ done clean: - $(RM) $(MAN) $(MAN:%=%.xml) $(MAN:%=%.html) *.[0-9].gendoc.txt MANIFEST + $(RM) $(MAN) $(MAN:%=%.html) *.[0-9].gendoc.txt MANIFEST diff -r b3c13e721593 -r 53a95a744812 doc/README --- a/doc/README Sun Oct 04 23:06:14 2009 +0200 +++ b/doc/README Sun Oct 04 23:16:54 2009 +0200 @@ -1,23 +1,11 @@ -Mercurial's documentation is currently kept in ASCIIDOC format, which -is a simple plain text format that's easy to read and edit. It's also -convertible to a variety of other formats including standard UNIX man -page format and HTML. +Mercurial's documentation is kept in reStructuredText format, which is +a simple plain text format that's easy to read and edit: -To do this, you'll need to install ASCIIDOC: - - http://www.methods.co.nz/asciidoc/ - -To generate the man page: + http://docutils.sourceforge.net/rst.html - asciidoc -d manpage -b docbook hg.1.txt - xmlto man hg.1.xml - -To display: +It's also convertible to a variety of other formats including standard +UNIX man page format and HTML. You'll need to install Docutils: - groff -mandoc -Tascii hg.1 | more - -To create the html page (without stylesheets): + http://docutils.sourceforge.net/ - asciidoc -b html4 hg.1.txt - -(older asciidoc may want html instead of html4 above) +Use the Makefile in this directory to generate the man and HTML pages. diff -r b3c13e721593 -r 53a95a744812 doc/common.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/common.txt Sun Oct 04 23:16:54 2009 +0200 @@ -0,0 +1,8 @@ +.. Common link and substitution definitions. + +.. |hg(1)| replace:: **hg**\ (1) +.. _hg(1): hg.1.html +.. |hgrc(5)| replace:: **hgrc**\ (5) +.. _hgrc(5): hgrc.5.html +.. |hgignore(5)| replace:: **hgignore**\ (5) +.. _hgignore(5): hgignore.5.html diff -r b3c13e721593 -r 53a95a744812 doc/gendoc.py --- a/doc/gendoc.py Sun Oct 04 23:06:14 2009 +0200 +++ b/doc/gendoc.py Sun Oct 04 23:16:54 2009 +0200 @@ -1,9 +1,10 @@ -import os, sys, textwrap +import os, sys # import from the live mercurial repo sys.path.insert(0, "..") # fall back to pure modules if required C extensions are not available sys.path.append(os.path.join('..', 'mercurial', 'pure')) from mercurial import demandimport; demandimport.enable() +from mercurial import encoding from mercurial.commands import table, globalopts from mercurial.i18n import _ from mercurial.help import helptable @@ -54,18 +55,18 @@ return d def show_doc(ui): - def bold(s, text=""): - ui.write("%s\n%s\n%s\n" % (s, "="*len(s), text)) - def underlined(s, text=""): - ui.write("%s\n%s\n%s\n" % (s, "-"*len(s), text)) + def section(s): + ui.write("%s\n%s\n\n" % (s, "-" * encoding.colwidth(s))) + def subsection(s): + ui.write("%s\n%s\n\n" % (s, '"' * encoding.colwidth(s))) # print options - underlined(_("OPTIONS")) + section(_("OPTIONS")) for optstr, desc in get_opts(globalopts): - ui.write("%s::\n %s\n\n" % (optstr, desc)) + ui.write("%s\n %s\n\n" % (optstr, desc)) # print cmds - underlined(_("COMMANDS")) + section(_("COMMANDS")) h = {} for c, attr in table.items(): f = c.split("|")[0] @@ -78,31 +79,32 @@ if f.startswith("debug"): continue d = get_cmd(h[f]) # synopsis - ui.write("[[%s]]\n" % d['cmd']) - ui.write("%s::\n" % d['synopsis'].replace("hg ","", 1)) + ui.write(".. _%s:\n\n" % d['cmd']) + ui.write("``%s``\n" % d['synopsis'].replace("hg ","", 1)) # description ui.write("%s\n\n" % d['desc'][1]) # options opt_output = list(d['opts']) if opt_output: opts_len = max([len(line[0]) for line in opt_output]) - ui.write(_(" options:\n")) + ui.write(_(" options:\n\n")) for optstr, desc in opt_output: if desc: s = "%-*s %s" % (opts_len, optstr, desc) else: s = optstr - s = textwrap.fill(s, initial_indent=4 * " ", - subsequent_indent=(6 + opts_len) * " ") - ui.write("%s\n" % s) + ui.write(" %s\n" % s) ui.write("\n") # aliases if d['aliases']: ui.write(_(" aliases: %s\n\n") % " ".join(d['aliases'])) # print topics - for names, section, doc in helptable: - underlined(section.upper()) + for names, sec, doc in helptable: + for name in names: + ui.write(".. _%s:\n" % name) + ui.write("\n") + section(sec.upper()) if callable(doc): doc = doc() ui.write(doc) diff -r b3c13e721593 -r 53a95a744812 doc/hg.1.txt --- a/doc/hg.1.txt Sun Oct 04 23:06:14 2009 +0200 +++ b/doc/hg.1.txt Sun Oct 04 23:16:54 2009 +0200 @@ -1,64 +1,74 @@ -HG(1) -===== -Matt Mackall -:man source: Mercurial -:man manual: Mercurial Manual +==== + hg +==== + +--------------------------------------- +Mercurial source code management system +--------------------------------------- -NAME ----- -hg - Mercurial source code management system +:Author: Matt Mackall +:Organization: Mercurial +:Manual section: 1 +:Manual group: Mercurial Manual + +.. contents:: + :backlinks: top + :class: htmlonly + SYNOPSIS -------- -*hg* 'command' ['option']... ['argument']... +**hg** *command* [*option*]... [*argument*]... DESCRIPTION ----------- -The *hg* command provides a command line interface to the Mercurial +The **hg** command provides a command line interface to the Mercurial system. COMMAND ELEMENTS ---------------- -files ...:: +files... indicates one or more filename or relative path filenames; see "FILE NAME PATTERNS" for information on pattern matching -path:: +path indicates a path on the local machine -revision:: +revision indicates a changeset which can be specified as a changeset revision number, a tag, or a unique substring of the changeset hash value -repository path:: +repository path either the pathname of a local repository or the URI of a remote repository. -include::hg.1.gendoc.txt[] +.. include:: hg.1.gendoc.txt FILES ----- - `.hgignore`:: + +``.hgignore`` This file contains regular expressions (one per line) that - describe file names that should be ignored by *hg*. For details, - see *hgignore(5)*. + describe file names that should be ignored by **hg**. For details, + see |hgignore(5)|_. - `.hgtags`:: +``.hgtags`` This file contains changeset hash values and text tag names (one of each separated by spaces) that correspond to tagged versions of the repository contents. - `/etc/mercurial/hgrc`, `$HOME/.hgrc`, `.hg/hgrc`:: - This file contains defaults and configuration. Values in `.hg/hgrc` - override those in `$HOME/.hgrc`, and these override settings made in - the global `/etc/mercurial/hgrc` configuration. See *hgrc(5)* for - details of the contents and format of these files. +``/etc/mercurial/hgrc``, ``$HOME/.hgrc``, ``.hg/hgrc`` + This file contains defaults and configuration. Values in + ``.hg/hgrc`` override those in ``$HOME/.hgrc``, and these override + settings made in the global ``/etc/mercurial/hgrc`` configuration. + See |hgrc(5)|_ for details of the contents and format of these + files. -Some commands (e.g. revert) produce backup files ending in `.orig`, if -the `.orig` file already exists and is not tracked by Mercurial, it will -be overwritten. +Some commands (e.g. revert) produce backup files ending in ``.orig``, +if the ``.orig`` file already exists and is not tracked by Mercurial, +it will be overwritten. BUGS ---- @@ -67,7 +77,7 @@ SEE ALSO -------- -*hgignore(5)*, *hgrc(5)* +|hgignore(5)|_, |hgrc(5)|_ AUTHOR ------ @@ -75,14 +85,16 @@ RESOURCES --------- -http://mercurial.selenic.com/[Main Web Site] +Main Web Site: http://mercurial.selenic.com/ -http://selenic.com/hg[Source code repository] +Source code repository: http://selenic.com/hg -http://selenic.com/mailman/listinfo/mercurial[Mailing list] +Mailing list: http://selenic.com/mailman/listinfo/mercurial COPYING ------- Copyright \(C) 2005-2009 Matt Mackall. Free use of this software is granted under the terms of the GNU General -Public License (GPL). +Public License version 2. + +.. include:: common.txt diff -r b3c13e721593 -r 53a95a744812 doc/hgignore.5.txt --- a/doc/hgignore.5.txt Sun Oct 04 23:06:14 2009 +0200 +++ b/doc/hgignore.5.txt Sun Oct 04 23:16:54 2009 +0200 @@ -1,17 +1,20 @@ -HGIGNORE(5) -=========== -Vadim Gelfer -:man source: Mercurial -:man manual: Mercurial Manual +========== + hgignore +========== -NAME ----- -hgignore - syntax for Mercurial ignore files +--------------------------------- +syntax for Mercurial ignore files +--------------------------------- + +:Author: Vadim Gelfer +:Organization: Mercurial +:Manual section: 5 +:Manual group: Mercurial Manual SYNOPSIS -------- -The Mercurial system uses a file called `.hgignore` in the root +The Mercurial system uses a file called ``.hgignore`` in the root directory of a repository to control its behavior when it searches for files that it is not currently tracking. @@ -21,61 +24,61 @@ The working directory of a Mercurial repository will often contain files that should not be tracked by Mercurial. These include backup files created by editors and build products created by compilers. -These files can be ignored by listing them in a `.hgignore` file in -the root of the working directory. The `.hgignore` file must be +These files can be ignored by listing them in a ``.hgignore`` file in +the root of the working directory. The ``.hgignore`` file must be created manually. It is typically put under version control, so that the settings will propagate to other repositories with push and pull. An untracked file is ignored if its path relative to the repository root directory, or any prefix path of that path, is matched against -any pattern in `.hgignore`. +any pattern in ``.hgignore``. -For example, say we have an an untracked file, `file.c`, at -`a/b/file.c` inside our repository. Mercurial will ignore `file.c` if -any pattern in `.hgignore` matches `a/b/file.c`, `a/b` or `a`. +For example, say we have an an untracked file, ``file.c``, at +``a/b/file.c`` inside our repository. Mercurial will ignore ``file.c`` +if any pattern in ``.hgignore`` matches ``a/b/file.c``, ``a/b`` or ``a``. In addition, a Mercurial configuration file can reference a set of -per-user or global ignore files. See the hgrc(5) man page for details +per-user or global ignore files. See the |hgrc(5)|_ man page for details of how to configure these files. Look for the "ignore" entry in the "ui" section. To control Mercurial's handling of files that it manages, see the -hg(1) man page. Look for the "-I" and "-X" options. +|hg(1)|_ man page. Look for the "``-I``" and "``-X``" options. SYNTAX ------ An ignore file is a plain text file consisting of a list of patterns, -with one pattern per line. Empty lines are skipped. The "`#`" -character is treated as a comment character, and the "`\`" character +with one pattern per line. Empty lines are skipped. The "``#``" +character is treated as a comment character, and the "``\``" character is treated as an escape character. Mercurial supports several pattern syntaxes. The default syntax used is Python/Perl-style regular expressions. -To change the syntax used, use a line of the following form: +To change the syntax used, use a line of the following form:: -syntax: NAME + syntax: NAME -where NAME is one of the following: +where ``NAME`` is one of the following: -regexp:: +``regexp`` Regular expression, Python/Perl syntax. -glob:: +``glob`` Shell-style glob. The chosen syntax stays in effect when parsing all patterns that follow, until another syntax is selected. Neither glob nor regexp patterns are rooted. A glob-syntax pattern of -the form "`*.c`" will match a file ending in "`.c`" in any directory, -and a regexp pattern of the form "`\.c$`" will do the same. To root a -regexp pattern, start it with "`^`". +the form "``*.c``" will match a file ending in "``.c``" in any directory, +and a regexp pattern of the form "``\.c$``" will do the same. To root a +regexp pattern, start it with "``^``". EXAMPLE ------- -Here is an example ignore file. +Here is an example ignore file. :: # use glob syntax. syntax: glob @@ -96,11 +99,13 @@ SEE ALSO -------- -hg(1), hgrc(5) +|hg(1)|_, |hgrc(5)|_ COPYING ------- This manual page is copyright 2006 Vadim Gelfer. Mercurial is copyright 2005-2009 Matt Mackall. Free use of this software is granted under the terms of the GNU General -Public License (GPL). +Public License version 2. + +.. include:: common.txt diff -r b3c13e721593 -r 53a95a744812 doc/hgrc.5.txt --- a/doc/hgrc.5.txt Sun Oct 04 23:06:14 2009 +0200 +++ b/doc/hgrc.5.txt Sun Oct 04 23:16:54 2009 +0200 @@ -1,12 +1,20 @@ -HGRC(5) -======= -Bryan O'Sullivan -:man source: Mercurial -:man manual: Mercurial Manual +====== + hgrc +====== + +--------------------------------- +configuration files for Mercurial +--------------------------------- -NAME ----- -hgrc - configuration files for Mercurial +:Author: Bryan O'Sullivan +:Organization: Mercurial +:Manual section: 5 +:Manual group: Mercurial Manual + +.. contents:: + :backlinks: top + :class: htmlonly + SYNOPSIS -------- @@ -19,51 +27,54 @@ Mercurial reads configuration data from several files, if they exist. The names of these files depend on the system on which Mercurial is -installed. `*.rc` files from a single directory are read in +installed. ``*.rc`` files from a single directory are read in alphabetical order, later ones overriding earlier ones. Where multiple paths are given below, settings from later paths override earlier ones. -(Unix) `/etc/mercurial/hgrc.d/*.rc`:: -(Unix) `/etc/mercurial/hgrc`:: +| (Unix) ``/etc/mercurial/hgrc.d/*.rc`` +| (Unix) ``/etc/mercurial/hgrc`` + Per-installation configuration files, searched for in the - directory where Mercurial is installed. `` is the - parent directory of the hg executable (or symlink) being run. For - example, if installed in `/shared/tools/bin/hg`, Mercurial will look - in `/shared/tools/etc/mercurial/hgrc`. Options in these files apply + directory where Mercurial is installed. ```` is the + parent directory of the **hg** executable (or symlink) being run. For + example, if installed in ``/shared/tools/bin/hg``, Mercurial will look + in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply to all Mercurial commands executed by any user in any directory. -(Unix) `/etc/mercurial/hgrc.d/*.rc`:: -(Unix) `/etc/mercurial/hgrc`:: +| (Unix) ``/etc/mercurial/hgrc.d/*.rc`` +| (Unix) ``/etc/mercurial/hgrc`` + Per-system configuration files, for the system on which Mercurial is running. Options in these files apply to all Mercurial commands executed by any user in any directory. Options in these files override per-installation options. -(Windows) `\Mercurial.ini`:: - or else:: -(Windows) `HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`:: - or else:: -(Windows) `C:\Mercurial\Mercurial.ini`:: +| (Windows) ``\Mercurial.ini`` or else +| (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` or else +| (Windows) ``C:\Mercurial\Mercurial.ini`` + Per-installation/system configuration files, for the system on which Mercurial is running. Options in these files apply to all Mercurial commands executed by any user in any directory. Registry keys contain PATH-like strings, every part of which must reference - a `Mercurial.ini` file or be a directory where `*.rc` files will + a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will be read. -(Unix) `$HOME/.hgrc`:: -(Windows) `%HOME%\Mercurial.ini`:: -(Windows) `%HOME%\.hgrc`:: -(Windows) `%USERPROFILE%\Mercurial.ini`:: -(Windows) `%USERPROFILE%\.hgrc`:: +| (Unix) ``$HOME/.hgrc`` +| (Windows) ``%HOME%\Mercurial.ini`` +| (Windows) ``%HOME%\.hgrc`` +| (Windows) ``%USERPROFILE%\Mercurial.ini`` +| (Windows) ``%USERPROFILE%\.hgrc`` + Per-user configuration file(s), for the user running Mercurial. On - Windows 9x, `%HOME%` is replaced by `%APPDATA%`. Options in these + Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these files apply to all Mercurial commands executed by this user in any directory. Options in these files override per-installation and per-system options. -(Unix, Windows) `/.hg/hgrc`:: +| (Unix, Windows) ``/.hg/hgrc`` + Per-repository configuration options that only apply in a particular repository. This file is not version-controlled, and will not get transferred during a "clone" operation. Options in @@ -75,8 +86,10 @@ SYNTAX ------ -A configuration file consists of sections, led by a "`[section]`" header -and followed by "`name: value`" entries; "`name=value`" is also accepted. +A configuration file consists of sections, led by a "``[section]``" header +and followed by "``name: value``" entries; "``name=value``" is also accepted. + +:: [spam] eggs=ham @@ -88,15 +101,15 @@ Leading whitespace is removed from values. Empty lines are skipped. -Lines beginning with "`#`" or "`;`" are ignored and may be used to provide +Lines beginning with "``#``" or "``;``" are ignored and may be used to provide comments. -A line of the form "`%include file`" will include `file` into the +A line of the form "``%include file``" will include ``file`` into the current configuration file. The inclusion is recursive, which means that included files can include other files. Filenames are relative to -the configuration file in which the `%include` directive is found. +the configuration file in which the ``%include`` directive is found. -A line with "`%unset name`" will remove `name` from the current +A line with "``%unset name``" will remove ``name`` from the current section, if it has been set previously. @@ -107,41 +120,39 @@ Mercurial "hgrc" file, the purpose of each section, its possible keys, and their possible values. -[[alias]] -alias:: - Defines command aliases. - Aliases allow you to define your own commands in terms of other - commands (or aliases), optionally including arguments. -+ --- -Alias definitions consist of lines of the form: +``alias`` +""""""""" +Defines command aliases. +Aliases allow you to define your own commands in terms of other +commands (or aliases), optionally including arguments. + +Alias definitions consist of lines of the form:: = [. = -+ --- + where is used to group arguments into authentication entries. -Example: +Example:: foo.prefix = hg.intevation.org/mercurial foo.username = foo @@ -155,26 +166,26 @@ Supported arguments: - prefix;; - Either "\*" or a URI prefix with or without the scheme part. +``prefix`` + Either "``*``" or a URI prefix with or without the scheme part. The authentication entry with the longest matching prefix is used - (where "*" matches everything and counts as a match of length + (where "``*``" matches everything and counts as a match of length 1). If the prefix doesn't include a scheme, the match is performed against the URI with its scheme stripped as well, and the schemes argument, q.v., is then subsequently consulted. - username;; +``username`` Optional. Username to authenticate with. If not given, and the remote site requires basic or digest authentication, the user will be prompted for it. - password;; +``password`` Optional. Password to authenticate with. If not given, and the remote site requires basic or digest authentication, the user will be prompted for it. - key;; +``key`` Optional. PEM encoded client certificate key file. - cert;; +``cert`` Optional. PEM encoded client certificate chain file. - schemes;; +``schemes`` Optional. Space separated list of URI schemes to use this authentication entry with. Only used if the prefix doesn't include a scheme. Supported schemes are http and https. They will match @@ -183,20 +194,19 @@ If no suitable authentication entry is found, the user is prompted for credentials as usual if required by the remote. --- + -[[decode]] -decode/encode:: - Filters for transforming files on checkout/checkin. This would - typically be used for newline processing or other - localization/canonicalization of files. -+ --- +``decode/encode`` +""""""""""""""""" +Filters for transforming files on checkout/checkin. This would +typically be used for newline processing or other +localization/canonicalization of files. + Filters consist of a filter pattern followed by a filter command. Filter patterns are globs by default, rooted at the repository root. -For example, to match any file ending in "`.txt`" in the root -directory only, use the pattern "\*.txt". To match any file ending -in "`.c`" anywhere in the repository, use the pattern "**`.c`". +For example, to match any file ending in "``.txt``" in the root +directory only, use the pattern "``*.txt``". To match any file ending +in "``.c``" anywhere in the repository, use the pattern "``**.c``". The filter command can start with a specifier, either "pipe:" or "tempfile:". If no specifier is given, "pipe:" is used by default. @@ -204,7 +214,7 @@ A "pipe:" command must accept data on stdin and return the transformed data on stdout. -Pipe example: +Pipe example:: [encode] # uncompress gzip files on checkin to improve delta compression @@ -227,7 +237,7 @@ effects and may corrupt the contents of your files. The most common usage is for LF <-> CRLF translation on Windows. For -this, use the "smart" converters which check for binary files: +this, use the "smart" converters which check for binary files:: [extensions] hgext.win32text = @@ -236,7 +246,7 @@ [decode] ** = cleverdecode: -or if you only want to translate certain files: +or if you only want to translate certain files:: [extensions] hgext.win32text = @@ -244,16 +254,16 @@ **.txt = dumbencode: [decode] **.txt = dumbdecode: --- + + +``defaults`` +"""""""""""" -[[defaults]] -defaults:: - Use the [defaults] section to define command defaults, i.e. the - default options/arguments to pass to the specified commands. -+ --- +Use the [defaults] section to define command defaults, i.e. the +default options/arguments to pass to the specified commands. + The following example makes 'hg log' run in verbose mode, and 'hg -status' show only the modified files, by default. +status' show only the modified files, by default:: [defaults] log = -v @@ -262,57 +272,59 @@ The actual commands, instead of their aliases, must be used when defining command defaults. The command defaults will also be applied to the aliases of the commands defined. --- + + +``diff`` +"""""""" -[[diff]] -diff:: - Settings used when displaying diffs. They are all Boolean and - defaults to False. - git;; +Settings used when displaying diffs. They are all Boolean and +defaults to False. + +``git`` Use git extended diff format. - nodates;; +``nodates`` Don't include dates in diff headers. - showfunc;; +``showfunc`` Show which function each change is in. - ignorews;; +``ignorews`` Ignore white space when comparing lines. - ignorewsamount;; +``ignorewsamount`` Ignore changes in the amount of white space. - ignoreblanklines;; +``ignoreblanklines`` Ignore changes whose lines are all blank. -[[email]] -email:: - Settings for extensions that send email messages. - from;; +``email`` +""""""""" +Settings for extensions that send email messages. + +``from`` Optional. Email address to use in "From" header and SMTP envelope of outgoing messages. - to;; +``to`` Optional. Comma-separated list of recipients' email addresses. - cc;; +``cc`` Optional. Comma-separated list of carbon copy recipients' email addresses. - bcc;; +``bcc`` Optional. Comma-separated list of blind carbon copy recipients' email addresses. Cannot be set interactively. - method;; +``method`` Optional. Method to use to send email messages. If value is "smtp" (default), use SMTP (see section "[smtp]" for configuration). Otherwise, use as name of program to run that acts like sendmail (takes "-f" option for sender, list of recipients on command line, message on stdin). Normally, setting this to "sendmail" or "/usr/sbin/sendmail" is enough to use sendmail to send messages. - charsets;; +``charsets`` Optional. Comma-separated list of character sets considered convenient for recipients. Addresses, headers, and parts not containing patches of outgoing messages will be encoded in the first character set to which conversion from local encoding - (`$HGENCODING`, `ui.fallbackencoding`) succeeds. If correct + (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct conversion fails, the text in question is sent as is. Defaults to empty (explicit) list. -+ --- -Order of outgoing email character sets: + +Order of outgoing email character sets:: us-ascii always first, regardless of settings email.charsets in order given by user @@ -320,7 +332,7 @@ $HGENCODING if not in email.charsets utf-8 always last, regardless of settings -Email example: +Email example:: [email] from = Joseph User @@ -328,40 +340,40 @@ # charsets for western Europeans # us-ascii, utf-8 omitted, as they are tried first and last charsets = iso-8859-1, iso-8859-15, windows-1252 --- + + +``extensions`` +"""""""""""""" -[[extensions]] -extensions:: - Mercurial has an extension mechanism for adding new features. To - enable an extension, create an entry for it in this section. -+ --- +Mercurial has an extension mechanism for adding new features. To +enable an extension, create an entry for it in this section. + If you know that the extension is already in Python's search path, -you can give the name of the module, followed by "`=`", with nothing -after the "`=`". +you can give the name of the module, followed by "``=``", with nothing +after the "``=``". -Otherwise, give a name that you choose, followed by "`=`", followed by -the path to the "`.py`" file (including the file name extension) that +Otherwise, give a name that you choose, followed by "``=``", followed by +the path to the "``.py``" file (including the file name extension) that defines the extension. To explicitly disable an extension that is enabled in an hgrc of -broader scope, prepend its path with "`!`", as in -"`hgext.foo = !/ext/path`" or "`hgext.foo = !`" when path is not +broader scope, prepend its path with "``!``", as in +"``hgext.foo = !/ext/path``" or "``hgext.foo = !``" when path is not supplied. -Example for `~/.hgrc`: +Example for ``~/.hgrc``:: [extensions] # (the mq extension will get loaded from Mercurial's path) hgext.mq = # (this extension will get loaded from the file specified) myfeature = ~/.hgext/myfeature.py --- + -[[format]] -format:: +``format`` +"""""""""" - usestore;; +``usestore`` Enable or disable the "store" repository format which improves compatibility with systems that fold case or otherwise mangle filenames. Enabled by default. Disabling this option will allow @@ -369,7 +381,7 @@ compatibility and ensures that the on-disk format of newly created repositories will be compatible with Mercurial before version 0.9.4. - usefncache;; +``usefncache`` Enable or disable the "fncache" repository format which enhances the "store" repository format (which has to be enabled to use fncache) to allow longer filenames and avoids using Windows @@ -377,26 +389,27 @@ option ensures that the on-disk format of newly created repositories will be compatible with Mercurial before version 1.1. -[[merge-patterns]] -merge-patterns:: - This section specifies merge tools to associate with particular file - patterns. Tools matched here will take precedence over the default - merge tool. Patterns are globs by default, rooted at the repository - root. -+ -Example: -+ +``merge-patterns`` +"""""""""""""""""" + +This section specifies merge tools to associate with particular file +patterns. Tools matched here will take precedence over the default +merge tool. Patterns are globs by default, rooted at the repository +root. + +Example:: + [merge-patterns] **.c = kdiff3 **.jpg = myimgmerge -[[merge-tools]] -merge-tools:: - This section configures external merge tools to use for file-level - merges. -+ --- -Example `~/.hgrc`: +``merge-tools`` +""""""""""""""" + +This section configures external merge tools to use for file-level +merges. + +Example ``~/.hgrc``:: [merge-tools] # Override stock tool location @@ -413,64 +426,63 @@ Supported arguments: -priority;; +``priority`` The priority in which to evaluate this tool. Default: 0. -executable;; +``executable`` Either just the name of the executable or its pathname. Default: the tool name. -args;; +``args`` The arguments to pass to the tool executable. You can refer to the files being merged as well as the output file through these - variables: `$base`, `$local`, `$other`, `$output`. - Default: `$local $base $other` -premerge;; + variables: ``$base``, ``$local``, ``$other``, ``$output``. + Default: ``$local $base $other`` +``premerge`` Attempt to run internal non-interactive 3-way merge tool before launching external tool. Default: True -binary;; +``binary`` This tool can merge binary files. Defaults to False, unless tool was selected by file pattern match. -symlink;; +``symlink`` This tool can merge symlinks. Defaults to False, even if tool was selected by file pattern match. -checkconflicts;; +``checkconflicts`` Check whether there are conflicts even though the tool reported success. Default: False -checkchanged;; +``checkchanged`` Check whether outputs were written even though the tool reported success. Default: False -fixeol;; +``fixeol`` Attempt to fix up EOL changes caused by the merge tool. Default: False -gui;; +``gui`` This tool requires a graphical interface to run. Default: False -regkey;; +``regkey`` Windows registry key which describes install location of this tool. Mercurial will search for this key first under - `HKEY_CURRENT_USER` and then under `HKEY_LOCAL_MACHINE`. + ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``. Default: None -regname;; +``regname`` Name of value to read from specified registry key. Defaults to the unnamed (default) value. -regappend;; +``regappend`` String to append to the value read from the registry, typically the executable name of the tool. Default: None --- + -[[hooks]] -hooks:: - Commands or Python functions that get automatically executed by - various actions such as starting or finishing a commit. Multiple - hooks can be run for the same action by appending a suffix to the - action. Overriding a site-wide hook can be done by changing its - value or setting it to an empty string. -+ --- -Example `.hg/hgrc`: +``hooks`` +""""""""" +Commands or Python functions that get automatically executed by +various actions such as starting or finishing a commit. Multiple +hooks can be run for the same action by appending a suffix to the +action. Overriding a site-wide hook can be done by changing its +value or setting it to an empty string. + +Example ``.hg/hgrc``:: [hooks] # do not use the site-wide hook @@ -482,84 +494,84 @@ additional information. For each hook below, the environment variables it is passed are listed with names of the form "$HG_foo". -changegroup;; +``changegroup`` Run after a changegroup has been added via push, pull or unbundle. - ID of the first new changeset is in `$HG_NODE`. URL from which - changes came is in `$HG_URL`. -commit;; + ID of the first new changeset is in ``$HG_NODE``. URL from which + changes came is in ``$HG_URL``. +``commit`` Run after a changeset has been created in the local repository. ID - of the newly created changeset is in `$HG_NODE`. Parent changeset - IDs are in `$HG_PARENT1` and `$HG_PARENT2`. -incoming;; + of the newly created changeset is in ``$HG_NODE``. Parent changeset + IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. +``incoming`` Run after a changeset has been pulled, pushed, or unbundled into the local repository. The ID of the newly arrived changeset is in - `$HG_NODE`. URL that was source of changes came is in `$HG_URL`. -outgoing;; + ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``. +``outgoing`` Run after sending changes from local repository to another. ID of - first changeset sent is in `$HG_NODE`. Source of operation is in - `$HG_SOURCE`; see "preoutgoing" hook for description. -post-;; + first changeset sent is in ``$HG_NODE``. Source of operation is in + ``$HG_SOURCE``; see "preoutgoing" hook for description. +``post-`` Run after successful invocations of the associated command. The - contents of the command line are passed as `$HG_ARGS` and the result - code in `$HG_RESULT`. Hook failure is ignored. -pre-;; + contents of the command line are passed as ``$HG_ARGS`` and the result + code in ``$HG_RESULT``. Hook failure is ignored. +``pre-`` Run before executing the associated command. The contents of the - command line are passed as `$HG_ARGS`. If the hook returns failure, + command line are passed as ``$HG_ARGS``. If the hook returns failure, the command doesn't execute and Mercurial returns the failure code. -prechangegroup;; +``prechangegroup`` Run before a changegroup is added via push, pull or unbundle. Exit status 0 allows the changegroup to proceed. Non-zero status will cause the push, pull or unbundle to fail. URL from which changes - will come is in `$HG_URL`. -precommit;; + will come is in ``$HG_URL``. +``precommit`` Run before starting a local commit. Exit status 0 allows the commit to proceed. Non-zero status will cause the commit to fail. - Parent changeset IDs are in `$HG_PARENT1` and `$HG_PARENT2`. -preoutgoing;; + Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. +``preoutgoing`` Run before collecting changes to send from the local repository to another. Non-zero status will cause failure. This lets you prevent pull over HTTP or SSH. Also prevents against local pull, push (outbound) or bundle commands, but not effective, since you can just copy files instead then. Source of operation is in - `$HG_SOURCE`. If "serve", operation is happening on behalf of remote + ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote SSH or HTTP repository. If "push", "pull" or "bundle", operation is happening on behalf of repository on same system. -pretag;; +``pretag`` Run before creating a tag. Exit status 0 allows the tag to be created. Non-zero status will cause the tag to fail. ID of - changeset to tag is in `$HG_NODE`. Name of tag is in `$HG_TAG`. Tag is - local if `$HG_LOCAL=1`, in repository if `$HG_LOCAL=0`. -pretxnchangegroup;; + changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is + local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``. +``pretxnchangegroup`` Run after a changegroup has been added via push, pull or unbundle, but before the transaction has been committed. Changegroup is visible to hook program. This lets you validate incoming changes before accepting them. Passed the ID of the first new changeset in - `$HG_NODE`. Exit status 0 allows the transaction to commit. Non-zero + ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero status will cause the transaction to be rolled back and the push, pull or unbundle will fail. URL that was source of changes is in - `$HG_URL`. -pretxncommit;; + ``$HG_URL``. +``pretxncommit`` Run after a changeset has been created but the transaction not yet committed. Changeset is visible to hook program. This lets you validate commit message and changes. Exit status 0 allows the commit to proceed. Non-zero status will cause the transaction to - be rolled back. ID of changeset is in `$HG_NODE`. Parent changeset - IDs are in `$HG_PARENT1` and `$HG_PARENT2`. -preupdate;; + be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset + IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``. +``preupdate`` Run before updating the working directory. Exit status 0 allows the update to proceed. Non-zero status will prevent the update. - Changeset ID of first new parent is in `$HG_PARENT1`. If merge, ID - of second new parent is in `$HG_PARENT2`. -tag;; - Run after a tag is created. ID of tagged changeset is in `$HG_NODE`. - Name of tag is in `$HG_TAG`. Tag is local if `$HG_LOCAL=1`, in - repository if `$HG_LOCAL=0`. -update;; + Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID + of second new parent is in ``$HG_PARENT2``. +``tag`` + Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``. + Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in + repository if ``$HG_LOCAL=0``. +``update`` Run after updating the working directory. Changeset ID of first - new parent is in `$HG_PARENT1`. If merge, ID of second new parent is - in `$HG_PARENT2`. If the update succeeded, `$HG_ERROR=0`. If the - update failed (e.g. because conflicts not resolved), `$HG_ERROR=1`. + new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is + in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the + update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``. NOTE: it is generally better to use standard hooks rather than the generic pre- and post- command hooks as they are guaranteed to be @@ -568,11 +580,11 @@ generate a commit (e.g. tag) and not just the commit command. NOTE: Environment variables with empty values may not be passed to -hooks on platforms such as Windows. As an example, `$HG_PARENT2` will +hooks on platforms such as Windows. As an example, ``$HG_PARENT2`` will have an empty value under Unix-like platforms for non-merge changesets, while it will not be available at all under Windows. -The syntax for Python hooks is as follows: +The syntax for Python hooks is as follows:: hookname = python:modulename.submodule.callable hookname = python:/path/to/python/module.py:callable @@ -582,101 +594,111 @@ "ui"), a repository object (keyword "repo"), and a "hooktype" keyword that tells what kind of hook is used. Arguments listed as environment variables above are passed as keyword arguments, with no -"HG_" prefix, and names in lower case. +"``HG_``" prefix, and names in lower case. If a Python hook returns a "true" value or raises an exception, this is treated as a failure. --- + -[[http_proxy]] -http_proxy:: - Used to access web-based Mercurial repositories through a HTTP - proxy. - host;; +``http_proxy`` +"""""""""""""" +Used to access web-based Mercurial repositories through a HTTP +proxy. + +``host`` Host name and (optional) port of the proxy server, for example "myproxy:8000". - no;; +``no`` Optional. Comma-separated list of host names that should bypass the proxy. - passwd;; +``passwd`` Optional. Password to authenticate with at the proxy server. - user;; +``user`` Optional. User name to authenticate with at the proxy server. -[[smtp]] -smtp:: - Configuration for extensions that need to send email messages. - host;; +``smtp`` +"""""""" +Configuration for extensions that need to send email messages. + +``host`` Host name of mail server, e.g. "mail.example.com". - port;; +``port`` Optional. Port to connect to on mail server. Default: 25. - tls;; +``tls`` Optional. Whether to connect to mail server using TLS. True or False. Default: False. - username;; +``username`` Optional. User name to authenticate to SMTP server with. If username is specified, password must also be specified. Default: none. - password;; +``password`` Optional. Password to authenticate to SMTP server with. If username is specified, password must also be specified. Default: none. - local_hostname;; +``local_hostname`` Optional. It's the hostname that the sender can use to identify itself to the MTA. -[[patch]] -patch:: - Settings used when applying patches, for instance through the 'import' - command or with Mercurial Queues extension. - eol;; + +``patch`` +""""""""" +Settings used when applying patches, for instance through the 'import' +command or with Mercurial Queues extension. + +``eol`` When set to 'strict' patch content and patched files end of lines are preserved. When set to 'lf' or 'crlf', both files end of lines are ignored when patching and the result line endings are normalized to either LF (Unix) or CRLF (Windows). Default: strict. -[[paths]] -paths:: - Assigns symbolic names to repositories. The left side is the - symbolic name, and the right gives the directory or URL that is the - location of the repository. Default paths can be declared by setting - the following entries. - default;; + +``paths`` +""""""""" +Assigns symbolic names to repositories. The left side is the +symbolic name, and the right gives the directory or URL that is the +location of the repository. Default paths can be declared by setting +the following entries. + +``default`` Directory or URL to use when pulling if no source is specified. Default is set to repository from which the current repository was cloned. - default-push;; +``default-push`` Optional. Directory or URL to use when pushing if no destination is specified. -[[profiling]] -profiling:: - Specifies profiling format and file output. In this section - description, 'profiling data' stands for the raw data collected - during profiling, while 'profiling report' stands for a statistical - text report generated from the profiling data. The profiling is done - using lsprof. - format;; + +``profiling`` +""""""""""""" +Specifies profiling format and file output. In this section +description, 'profiling data' stands for the raw data collected +during profiling, while 'profiling report' stands for a statistical +text report generated from the profiling data. The profiling is done +using lsprof. + +``format`` Profiling format. Default: text. - text;; + + ``text`` Generate a profiling report. When saving to a file, it should be noted that only the report is saved, and the profiling data is not kept. - kcachegrind;; + ``kcachegrind`` Format profiling data for kcachegrind use: when saving to a file, the generated file can directly be loaded into kcachegrind. - output;; +``output`` File path where profiling data or report should be saved. If the file exists, it is replaced. Default: None, data is printed on stderr -[[server]] -server:: - Controls generic server settings. - uncompressed;; +``server`` +"""""""""" +Controls generic server settings. + +``uncompressed`` Whether to allow clients to clone a repository using the uncompressed streaming protocol. This transfers about 40% more data than a regular clone, but uses less memory and CPU on both @@ -686,174 +708,175 @@ about 6 Mbps), uncompressed streaming is slower, because of the extra data transfer overhead. Default is False. -[[trusted]] -trusted:: - For security reasons, Mercurial will not use the settings in the - `.hg/hgrc` file from a repository if it doesn't belong to a trusted - user or to a trusted group. The main exception is the web interface, - which automatically uses some safe settings, since it's common to - serve repositories from different users. -+ --- + +``trusted`` +""""""""""" +For security reasons, Mercurial will not use the settings in the +``.hg/hgrc`` file from a repository if it doesn't belong to a trusted +user or to a trusted group. The main exception is the web interface, +which automatically uses some safe settings, since it's common to +serve repositories from different users. + This section specifies what users and groups are trusted. The current user is always trusted. To trust everybody, list a user or a -group with name "`*`". +group with name "``*``". -users;; +``users`` Comma-separated list of trusted users. -groups;; +``groups`` Comma-separated list of trusted groups. --- + -[[ui]] -ui:: - User interface controls. -+ --- - archivemeta;; +``ui`` +"""""" + +User interface controls. + +``archivemeta`` Whether to include the .hg_archival.txt file containing meta data (hashes for the repository base and for tip) in archives created by the hg archive command or downloaded via hgweb. Default is true. - askusername;; +``askusername`` Whether to prompt for a username when committing. If True, and - neither `$HGUSER` nor `$EMAIL` has been specified, then the user will + neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will be prompted to enter a username. If no username is entered, the default USER@HOST is used instead. Default is False. - debug;; +``debug`` Print debugging information. True or False. Default is False. - editor;; - The editor to use during a commit. Default is `$EDITOR` or "vi". - fallbackencoding;; +``editor`` + The editor to use during a commit. Default is ``$EDITOR`` or "vi". +``fallbackencoding`` Encoding to try if it's not possible to decode the changelog using UTF-8. Default is ISO-8859-1. - ignore;; +``ignore`` A file to read per-user ignore patterns from. This file should be in the same format as a repository-wide .hgignore file. This option supports hook syntax, so if you want to specify multiple ignore files, you can do so by setting something like - "ignore.other = ~/.hgignore2". For details of the ignore file - format, see the hgignore(5) man page. - interactive;; + "``ignore.other = ~/.hgignore2``". For details of the ignore file + format, see the |hgignore(5)|_ man page. +``interactive`` Allow to prompt the user. True or False. Default is True. - logtemplate;; +``logtemplate`` Template string for commands that print changesets. - merge;; +``merge`` The conflict resolution program to use during a manual merge. There are some internal tools available: -+ - internal:local;; + + ``internal:local`` keep the local version - internal:other;; + ``internal:other`` use the other version - internal:merge;; + ``internal:merge`` use the internal non-interactive merge tool - internal:fail;; + ``internal:fail`` fail to merge -+ + For more information on configuring merge tools see the merge-tools section. - patch;; +``patch`` command to use to apply patches. Look for 'gpatch' or 'patch' in PATH if unset. - quiet;; +``quiet`` Reduce the amount of output printed. True or False. Default is False. - remotecmd;; +``remotecmd`` remote command to use for clone/push/pull operations. Default is 'hg'. - report_untrusted;; - Warn if a `.hg/hgrc` file is ignored due to not being owned by a +``report_untrusted`` + Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a trusted user or group. True or False. Default is True. - slash;; - Display paths using a slash ("`/`") as the path separator. This +``slash`` + Display paths using a slash ("``/``") as the path separator. This only makes a difference on systems where the default path separator is not the slash character (e.g. Windows uses the - backslash character ("`\`")). + backslash character ("``\``")). Default is False. - ssh;; +``ssh`` command to use for SSH connections. Default is 'ssh'. - strict;; +``strict`` Require exact command names, instead of allowing unambiguous abbreviations. True or False. Default is False. - style;; +``style`` Name of style to use for command output. - timeout;; +``timeout`` The timeout used when a lock is held (in seconds), a negative value means no timeout. Default is 600. - username;; +``username`` The committer of a changeset created when running "commit". Typically a person's name and email address, e.g. "Fred Widget - ". Default is `$EMAIL` or username@hostname. If + ". Default is ``$EMAIL`` or username@hostname. If the username in hgrc is empty, it has to be specified manually or - in a different hgrc file (e.g. `$HOME/.hgrc`, if the admin set + in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set "username =" in the system hgrc). - verbose;; +``verbose`` Increase the amount of output printed. True or False. Default is False. --- + -[[web]] -web:: - Web interface configuration. - accesslog;; +``web`` +""""""" +Web interface configuration. + +``accesslog`` Where to output the access log. Default is stdout. - address;; +``address`` Interface address to bind to. Default is all. - allow_archive;; +``allow_archive`` List of archive format (bz2, gz, zip) allowed for downloading. Default is empty. - allowbz2;; +``allowbz2`` (DEPRECATED) Whether to allow .tar.bz2 downloading of repository revisions. Default is false. - allowgz;; +``allowgz`` (DEPRECATED) Whether to allow .tar.gz downloading of repository revisions. Default is false. - allowpull;; +``allowpull`` Whether to allow pulling from the repository. Default is true. - allow_push;; +``allow_push`` Whether to allow pushing to the repository. If empty or not set, - push is not allowed. If the special value "`*`", any remote user can + push is not allowed. If the special value "``*``", any remote user can push, including unauthenticated users. Otherwise, the remote user must have been authenticated, and the authenticated user name must be present in this list (separated by whitespace or ","). The contents of the allow_push list are examined after the deny_push list. - allow_read;; +``allow_read`` If the user has not already been denied repository access due to the contents of deny_read, this list determines whether to grant repository access to the user. If this list is not empty, and the user is unauthenticated or not present in the list (separated by whitespace or ","), then access is denied for the user. If the list is empty or not set, then access is permitted to all users by - default. Setting allow_read to the special value "`*`" is equivalent + default. Setting allow_read to the special value "``*``" is equivalent to it not being set (i.e. access is permitted to all users). The contents of the allow_read list are examined after the deny_read list. - allowzip;; +``allowzip`` (DEPRECATED) Whether to allow .zip downloading of repository revisions. Default is false. This feature creates temporary files. - baseurl;; +``baseurl`` Base URL to use when publishing URLs in other locations, so third-party tools like email notification hooks can construct URLs. Example: "http://hgserver/repos/" - contact;; +``contact`` Name or email address of the person in charge of the repository. - Defaults to ui.username or `$EMAIL` or "unknown" if unset or empty. - deny_push;; + Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty. +``deny_push`` Whether to deny pushing to the repository. If empty or not set, - push is not denied. If the special value "`*`", all remote users are + push is not denied. If the special value "``*``", all remote users are denied push. Otherwise, unauthenticated users are all denied, and any authenticated user name present in this list (separated by whitespace or ",") is also denied. The contents of the deny_push list are examined before the allow_push list. - deny_read;; +``deny_read`` Whether to deny reading/viewing of the repository. If this list is not empty, unauthenticated users are all denied, and any authenticated user name present in this list (separated by whitespace or ",") is also denied access to the repository. If set - to the special value "`*`", all remote users are denied access + to the special value "``*``", all remote users are denied access (rarely needed ;). If deny_read is empty or not set, the determination of repository access depends on the presence and content of the allow_read list (see description). If both @@ -863,44 +886,48 @@ the list of repositories. The contents of the deny_read list have priority over (are examined before) the contents of the allow_read list. - description;; +``descend`` + hgwebdir indexes will not descend into subdirectories. Only repositories + directly in the current path will be shown (other repositories are still + available from the index corresponding to their containing path). +``description`` Textual description of the repository's purpose or contents. Default is "unknown". - encoding;; +``encoding`` Character encoding name. Example: "UTF-8" - errorlog;; +``errorlog`` Where to output the error log. Default is stderr. - hidden;; +``hidden`` Whether to hide the repository in the hgwebdir index. Default is false. - ipv6;; +``ipv6`` Whether to use IPv6. Default is false. - name;; +``name`` Repository name to use in the web interface. Default is current working directory. - maxchanges;; +``maxchanges`` Maximum number of changes to list on the changelog. Default is 10. - maxfiles;; +``maxfiles`` Maximum number of files to list per changeset. Default is 10. - port;; +``port`` Port to listen on. Default is 8000. - prefix;; +``prefix`` Prefix path to serve from. Default is '' (server root). - push_ssl;; +``push_ssl`` Whether to require that inbound pushes be transported over SSL to prevent password sniffing. Default is true. - staticurl;; +``staticurl`` Base URL to use for static files. If unset, static files (e.g. the hgicon.png favicon) will be served by the CGI script itself. Use this setting to serve them directly with the HTTP server. Example: "http://hgserver/static/" - stripes;; +``stripes`` How many lines a "zebra stripe" should span in multiline output. Default is 1; set to 0 to disable. - style;; +``style`` Which template map style to use. - templates;; +``templates`` Where to find the HTML templates. Default is install path. @@ -912,11 +939,13 @@ SEE ALSO -------- -hg(1), hgignore(5) +|hg(1)|_, |hgignore(5)|_ COPYING ------- This manual page is copyright 2005 Bryan O'Sullivan. Mercurial is copyright 2005-2009 Matt Mackall. Free use of this software is granted under the terms of the GNU General -Public License (GPL). +Public License version 2. + +.. include:: common.txt diff -r b3c13e721593 -r 53a95a744812 doc/rst2man.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/rst2man.py Sun Oct 04 23:16:54 2009 +0200 @@ -0,0 +1,1112 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# $Id: manpage.py 6110 2009-08-31 14:40:33Z grubert $ +# Author: Engelbert Gruber +# Copyright: This module is put into the public domain. + +""" +Simple man page writer for reStructuredText. + +Man pages (short for "manual pages") contain system documentation on unix-like +systems. The pages are grouped in numbered sections: + + 1 executable programs and shell commands + 2 system calls + 3 library functions + 4 special files + 5 file formats + 6 games + 7 miscellaneous + 8 system administration + +Man pages are written *troff*, a text file formatting system. + +See http://www.tldp.org/HOWTO/Man-Page for a start. + +Man pages have no subsection only parts. +Standard parts + + NAME , + SYNOPSIS , + DESCRIPTION , + OPTIONS , + FILES , + SEE ALSO , + BUGS , + +and + + AUTHOR . + +A unix-like system keeps an index of the DESCRIPTIONs, which is accesable +by the command whatis or apropos. + +""" + +__docformat__ = 'reStructuredText' + +import sys +import os +import time +import re +from types import ListType + +import docutils +from docutils import nodes, utils, writers, languages +import roman + +FIELD_LIST_INDENT = 7 +DEFINITION_LIST_INDENT = 7 +OPTION_LIST_INDENT = 7 +BLOCKQOUTE_INDENT = 3.5 + +# Define two macros so man/roff can calculate the +# indent/unindent margins by itself +MACRO_DEF = (r""". +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +""") + +class Writer(writers.Writer): + + supported = ('manpage') + """Formats this writer supports.""" + + output = None + """Final translated form of `document`.""" + + def __init__(self): + writers.Writer.__init__(self) + self.translator_class = Translator + + def translate(self): + visitor = self.translator_class(self.document) + self.document.walkabout(visitor) + self.output = visitor.astext() + + +class Table: + def __init__(self): + self._rows = [] + self._options = ['center', ] + self._tab_char = '\t' + self._coldefs = [] + def new_row(self): + self._rows.append([]) + def append_separator(self, separator): + """Append the separator for table head.""" + self._rows.append([separator]) + def append_cell(self, cell_lines): + """cell_lines is an array of lines""" + start = 0 + if len(cell_lines)>0 and cell_lines[0] == '.sp\n': + start = 1 + self._rows[-1].append(cell_lines[start:]) + if len(self._coldefs) < len(self._rows[-1]): + self._coldefs.append('l') + def _minimize_cell(self, cell_lines): + """Remove leading and trailing blank and ``.sp`` lines""" + while (cell_lines and cell_lines[0] in ('\n', '.sp\n')): + del cell_lines[0] + while (cell_lines and cell_lines[-1] in ('\n', '.sp\n')): + del cell_lines[-1] + def as_list(self): + text = ['.TS\n'] + text.append(' '.join(self._options) + ';\n') + text.append('|%s|.\n' % ('|'.join(self._coldefs))) + for row in self._rows: + # row = array of cells. cell = array of lines. + text.append('_\n') # line above + text.append('T{\n') + for i in range(len(row)): + cell = row[i] + self._minimize_cell(cell) + text.extend(cell) + if not text[-1].endswith('\n'): + text[-1] += '\n' + if i < len(row)-1: + text.append('T}'+self._tab_char+'T{\n') + else: + text.append('T}\n') + text.append('_\n') + text.append('.TE\n') + return text + +class Translator(nodes.NodeVisitor): + """""" + + words_and_spaces = re.compile(r'\S+| +|\n') + document_start = """Man page generated from reStructeredText.""" + + def __init__(self, document): + nodes.NodeVisitor.__init__(self, document) + self.settings = settings = document.settings + lcode = settings.language_code + self.language = languages.get_language(lcode) + self.head = [] + self.body = [] + self.foot = [] + self.section_level = 0 + self.context = [] + self.topic_class = '' + self.colspecs = [] + self.compact_p = 1 + self.compact_simple = None + # the list style "*" bullet or "#" numbered + self._list_char = [] + # writing the header .TH and .SH NAME is postboned after + # docinfo. + self._docinfo = { + "title" : "", "title_upper": "", + "subtitle" : "", + "manual_section" : "", "manual_group" : "", + "author" : [], + "date" : "", + "copyright" : "", + "version" : "", + } + self._docinfo_keys = [] # a list to keep the sequence as in source. + self._docinfo_names = {} # to get name from text not normalized. + self._in_docinfo = None + self._active_table = None + self._in_literal = False + self.header_written = 0 + self._line_block = 0 + self.authors = [] + self.section_level = 0 + self._indent = [0] + # central definition of simple processing rules + # what to output on : visit, depart + # Do not use paragraph requests ``.PP`` because these set indentation. + # use ``.sp``. Remove superfluous ``.sp`` in ``astext``. + # + # Fonts are put on a stack, the top one is used. + # ``.ft P`` or ``\\fP`` pop from stack. + # ``B`` bold, ``I`` italic, ``R`` roman should be available. + # Hopefully ``C`` courier too. + self.defs = { + 'indent' : ('.INDENT %.1f\n', '.UNINDENT\n'), + 'definition_list_item' : ('.TP', ''), + 'field_name' : ('.TP\n.B ', '\n'), + 'literal' : ('\\fC', '\\fP'), + 'literal_block' : ('.sp\n.nf\n.ft C\n', '\n.ft P\n.fi\n'), + + 'option_list_item' : ('.TP\n', ''), + + 'reference' : (r'\fI\%', r'\fP'), + 'emphasis': ('\\fI', '\\fP'), + 'strong' : ('\\fB', '\\fP'), + 'term' : ('\n.B ', '\n'), + 'title_reference' : ('\\fI', '\\fP'), + + 'topic-title' : ('.SS ', ), + 'sidebar-title' : ('.SS ', ), + + 'problematic' : ('\n.nf\n', '\n.fi\n'), + } + # NOTE dont specify the newline before a dot-command, but ensure + # it is there. + + def comment_begin(self, text): + """Return commented version of the passed text WITHOUT end of + line/comment.""" + prefix = '.\\" ' + out_text = ''.join( + [(prefix + in_line + '\n') + for in_line in text.split('\n')]) + return out_text + + def comment(self, text): + """Return commented version of the passed text.""" + return self.comment_begin(text)+'.\n' + + def ensure_eol(self): + """Ensure the last line in body is terminated by new line.""" + if self.body[-1][-1] != '\n': + self.body.append('\n') + + def astext(self): + """Return the final formatted document as a string.""" + if not self.header_written: + # ensure we get a ".TH" as viewers require it. + self.head.append(self.header()) + # filter body + for i in xrange(len(self.body)-1,0,-1): + # remove superfluous vertical gaps. + if self.body[i] == '.sp\n': + if self.body[i-1][:4] in ('.BI ','.IP '): + self.body[i] = '.\n' + elif (self.body[i-1][:3] == '.B ' and + self.body[i-2][:4] == '.TP\n'): + self.body[i] = '.\n' + elif (self.body[i-1] == '\n' and + self.body[i-2][0] != '.' and + (self.body[i-3][:7] == '.TP\n.B ' + or self.body[i-3][:4] == '\n.B ') + ): + self.body[i] = '.\n' + return ''.join(self.head + self.body + self.foot) + + def deunicode(self, text): + text = text.replace(u'\xa0', '\\ ') + text = text.replace(u'\u2020', '\\(dg') + return text + + def visit_Text(self, node): + text = node.astext() + text = text.replace('\\','\\e') + replace_pairs = [ + (u'-', ur'\-'), + (u'\'', ur'\(aq'), + (u'´', ur'\''), + (u'`', ur'\(ga'), + ] + for (in_char, out_markup) in replace_pairs: + text = text.replace(in_char, out_markup) + # unicode + text = self.deunicode(text) + if self._in_literal: + # prevent interpretation of "." at line start + if text[0] == '.': + text = '\\&' + text + text = text.replace('\n.', '\n\\&.') + self.body.append(text) + + def depart_Text(self, node): + pass + + def list_start(self, node): + class enum_char: + enum_style = { + 'bullet' : '\\(bu', + 'emdash' : '\\(em', + } + + def __init__(self, style): + self._style = style + if node.has_key('start'): + self._cnt = node['start'] - 1 + else: + self._cnt = 0 + self._indent = 2 + if style == 'arabic': + # indentation depends on number of childrens + # and start value. + self._indent = len(str(len(node.children))) + self._indent += len(str(self._cnt)) + 1 + elif style == 'loweralpha': + self._cnt += ord('a') - 1 + self._indent = 3 + elif style == 'upperalpha': + self._cnt += ord('A') - 1 + self._indent = 3 + elif style.endswith('roman'): + self._indent = 5 + + def next(self): + if self._style == 'bullet': + return self.enum_style[self._style] + elif self._style == 'emdash': + return self.enum_style[self._style] + self._cnt += 1 + # TODO add prefix postfix + if self._style == 'arabic': + return "%d." % self._cnt + elif self._style in ('loweralpha', 'upperalpha'): + return "%c." % self._cnt + elif self._style.endswith('roman'): + res = roman.toRoman(self._cnt) + '.' + if self._style.startswith('upper'): + return res.upper() + return res.lower() + else: + return "%d." % self._cnt + def get_width(self): + return self._indent + def __repr__(self): + return 'enum_style-%s' % list(self._style) + + if node.has_key('enumtype'): + self._list_char.append(enum_char(node['enumtype'])) + else: + self._list_char.append(enum_char('bullet')) + if len(self._list_char) > 1: + # indent nested lists + self.indent(self._list_char[-2].get_width()) + else: + self.indent(self._list_char[-1].get_width()) + + def list_end(self): + self.dedent() + self._list_char.pop() + + def header(self): + tmpl = (".TH %(title_upper)s %(manual_section)s" + " \"%(date)s\" \"%(version)s\" \"%(manual_group)s\"\n" + ".SH NAME\n" + "%(title)s \- %(subtitle)s\n") + return tmpl % self._docinfo + + def append_header(self): + """append header with .TH and .SH NAME""" + # NOTE before everything + # .TH title_upper section date source manual + if self.header_written: + return + self.body.append(self.header()) + self.body.append(MACRO_DEF) + self.header_written = 1 + + def visit_address(self, node): + self.visit_docinfo_item(node, 'address') + + def depart_address(self, node): + pass + + def visit_admonition(self, node, name=None): + if name: + self.body.append('.IP %s\n' % + self.language.labels.get(name, name)) + + def depart_admonition(self, node): + self.body.append('.RE\n') + + def visit_attention(self, node): + self.visit_admonition(node, 'attention') + + depart_attention = depart_admonition + + def visit_docinfo_item(self, node, name): + if name == 'author': + self._docinfo[name].append(node.astext()) + else: + self._docinfo[name] = node.astext() + self._docinfo_keys.append(name) + raise nodes.SkipNode + + def depart_docinfo_item(self, node): + pass + + def visit_author(self, node): + self.visit_docinfo_item(node, 'author') + + depart_author = depart_docinfo_item + + def visit_authors(self, node): + # _author is called anyway. + pass + + def depart_authors(self, node): + pass + + def visit_block_quote(self, node): + # BUG/HACK: indent alway uses the _last_ indention, + # thus we need two of them. + self.indent(BLOCKQOUTE_INDENT) + self.indent(0) + + def depart_block_quote(self, node): + self.dedent() + self.dedent() + + def visit_bullet_list(self, node): + self.list_start(node) + + def depart_bullet_list(self, node): + self.list_end() + + def visit_caption(self, node): + pass + + def depart_caption(self, node): + pass + + def visit_caution(self, node): + self.visit_admonition(node, 'caution') + + depart_caution = depart_admonition + + def visit_citation(self, node): + num,text = node.astext().split(None,1) + num = num.strip() + self.body.append('.IP [%s] 5\n' % num) + + def depart_citation(self, node): + pass + + def visit_citation_reference(self, node): + self.body.append('['+node.astext()+']') + raise nodes.SkipNode + + def visit_classifier(self, node): + pass + + def depart_classifier(self, node): + pass + + def visit_colspec(self, node): + self.colspecs.append(node) + + def depart_colspec(self, node): + pass + + def write_colspecs(self): + self.body.append("%s.\n" % ('L '*len(self.colspecs))) + + def visit_comment(self, node, + sub=re.compile('-(?=-)').sub): + self.body.append(self.comment(node.astext())) + raise nodes.SkipNode + + def visit_contact(self, node): + self.visit_docinfo_item(node, 'contact') + + depart_contact = depart_docinfo_item + + def visit_container(self, node): + pass + + def depart_container(self, node): + pass + + def visit_compound(self, node): + pass + + def depart_compound(self, node): + pass + + def visit_copyright(self, node): + self.visit_docinfo_item(node, 'copyright') + + def visit_danger(self, node): + self.visit_admonition(node, 'danger') + + depart_danger = depart_admonition + + def visit_date(self, node): + self.visit_docinfo_item(node, 'date') + + def visit_decoration(self, node): + pass + + def depart_decoration(self, node): + pass + + def visit_definition(self, node): + pass + + def depart_definition(self, node): + pass + + def visit_definition_list(self, node): + self.indent(DEFINITION_LIST_INDENT) + + def depart_definition_list(self, node): + self.dedent() + + def visit_definition_list_item(self, node): + self.body.append(self.defs['definition_list_item'][0]) + + def depart_definition_list_item(self, node): + self.body.append(self.defs['definition_list_item'][1]) + + def visit_description(self, node): + pass + + def depart_description(self, node): + pass + + def visit_docinfo(self, node): + self._in_docinfo = 1 + + def depart_docinfo(self, node): + self._in_docinfo = None + # NOTE nothing should be written before this + self.append_header() + + def visit_doctest_block(self, node): + self.body.append(self.defs['literal_block'][0]) + self._in_literal = True + + def depart_doctest_block(self, node): + self._in_literal = False + self.body.append(self.defs['literal_block'][1]) + + def visit_document(self, node): + # no blank line between comment and header. + self.body.append(self.comment(self.document_start).rstrip()+'\n') + # writing header is postboned + self.header_written = 0 + + def depart_document(self, node): + if self._docinfo['author']: + self.body.append('.SH AUTHOR\n%s\n' + % ', '.join(self._docinfo['author'])) + skip = ('author', 'copyright', 'date', + 'manual_group', 'manual_section', + 'subtitle', + 'title', 'title_upper', 'version') + for name in self._docinfo_keys: + if name == 'address': + self.body.append("\n%s:\n%s%s.nf\n%s\n.fi\n%s%s" % ( + self.language.labels.get(name, name), + self.defs['indent'][0] % 0, + self.defs['indent'][0] % BLOCKQOUTE_INDENT, + self._docinfo[name], + self.defs['indent'][1], + self.defs['indent'][1], + ) ) + elif not name in skip: + if name in self._docinfo_names: + label = self._docinfo_names[name] + else: + label = self.language.labels.get(name, name) + self.body.append("\n%s: %s\n" % (label, self._docinfo[name]) ) + if self._docinfo['copyright']: + self.body.append('.SH COPYRIGHT\n%s\n' + % self._docinfo['copyright']) + self.body.append( self.comment( + 'Generated by docutils manpage writer.\n' ) ) + + def visit_emphasis(self, node): + self.body.append(self.defs['emphasis'][0]) + + def depart_emphasis(self, node): + self.body.append(self.defs['emphasis'][1]) + + def visit_entry(self, node): + # a cell in a table row + if 'morerows' in node: + self.document.reporter.warning('"table row spanning" not supported', + base_node=node) + if 'morecols' in node: + self.document.reporter.warning( + '"table cell spanning" not supported', base_node=node) + self.context.append(len(self.body)) + + def depart_entry(self, node): + start = self.context.pop() + self._active_table.append_cell(self.body[start:]) + del self.body[start:] + + def visit_enumerated_list(self, node): + self.list_start(node) + + def depart_enumerated_list(self, node): + self.list_end() + + def visit_error(self, node): + self.visit_admonition(node, 'error') + + depart_error = depart_admonition + + def visit_field(self, node): + pass + + def depart_field(self, node): + pass + + def visit_field_body(self, node): + if self._in_docinfo: + name_normalized = self._field_name.lower().replace(" ","_") + self._docinfo_names[name_normalized] = self._field_name + self.visit_docinfo_item(node, name_normalized) + raise nodes.SkipNode + + def depart_field_body(self, node): + pass + + def visit_field_list(self, node): + self.indent(FIELD_LIST_INDENT) + + def depart_field_list(self, node): + self.dedent() + + def visit_field_name(self, node): + if self._in_docinfo: + self._field_name = node.astext() + raise nodes.SkipNode + else: + self.body.append(self.defs['field_name'][0]) + + def depart_field_name(self, node): + self.body.append(self.defs['field_name'][1]) + + def visit_figure(self, node): + self.indent(2.5) + self.indent(0) + + def depart_figure(self, node): + self.dedent() + self.dedent() + + def visit_footer(self, node): + self.document.reporter.warning('"footer" not supported', + base_node=node) + + def depart_footer(self, node): + pass + + def visit_footnote(self, node): + num,text = node.astext().split(None,1) + num = num.strip() + self.body.append('.IP [%s] 5\n' % self.deunicode(num)) + + def depart_footnote(self, node): + pass + + def footnote_backrefs(self, node): + self.document.reporter.warning('"footnote_backrefs" not supported', + base_node=node) + + def visit_footnote_reference(self, node): + self.body.append('['+self.deunicode(node.astext())+']') + raise nodes.SkipNode + + def depart_footnote_reference(self, node): + pass + + def visit_generated(self, node): + pass + + def depart_generated(self, node): + pass + + def visit_header(self, node): + raise NotImplementedError, node.astext() + + def depart_header(self, node): + pass + + def visit_hint(self, node): + self.visit_admonition(node, 'hint') + + depart_hint = depart_admonition + + def visit_subscript(self, node): + self.body.append('\\s-2\\d') + + def depart_subscript(self, node): + self.body.append('\\u\\s0') + + def visit_superscript(self, node): + self.body.append('\\s-2\\u') + + def depart_superscript(self, node): + self.body.append('\\d\\s0') + + def visit_attribution(self, node): + self.body.append('\\(em ') + + def depart_attribution(self, node): + self.body.append('\n') + + def visit_image(self, node): + self.document.reporter.warning('"image" not supported', + base_node=node) + text = [] + if 'alt' in node.attributes: + text.append(node.attributes['alt']) + if 'uri' in node.attributes: + text.append(node.attributes['uri']) + self.body.append('[image: %s]\n' % ('/'.join(text))) + raise nodes.SkipNode + + def visit_important(self, node): + self.visit_admonition(node, 'important') + + depart_important = depart_admonition + + def visit_label(self, node): + # footnote and citation + if (isinstance(node.parent, nodes.footnote) + or isinstance(node.parent, nodes.citation)): + raise nodes.SkipNode + self.document.reporter.warning('"unsupported "label"', + base_node=node) + self.body.append('[') + + def depart_label(self, node): + self.body.append(']\n') + + def visit_legend(self, node): + pass + + def depart_legend(self, node): + pass + + # WHAT should we use .INDENT, .UNINDENT ? + def visit_line_block(self, node): + self._line_block += 1 + if self._line_block == 1: + self.body.append('.nf\n') + else: + self.body.append('.in +2\n') + + def depart_line_block(self, node): + self._line_block -= 1 + if self._line_block == 0: + self.body.append('.fi\n') + self.body.append('.sp\n') + else: + self.body.append('.in -2\n') + + def visit_line(self, node): + pass + + def depart_line(self, node): + self.body.append('\n') + + def visit_list_item(self, node): + # man 7 man argues to use ".IP" instead of ".TP" + self.body.append('.IP %s %d\n' % ( + self._list_char[-1].next(), + self._list_char[-1].get_width(),) ) + + def depart_list_item(self, node): + pass + + def visit_literal(self, node): + self.body.append(self.defs['literal'][0]) + + def depart_literal(self, node): + self.body.append(self.defs['literal'][1]) + + def visit_literal_block(self, node): + self.body.append(self.defs['literal_block'][0]) + self._in_literal = True + + def depart_literal_block(self, node): + self._in_literal = False + self.body.append(self.defs['literal_block'][1]) + + def visit_meta(self, node): + raise NotImplementedError, node.astext() + + def depart_meta(self, node): + pass + + def visit_note(self, node): + self.visit_admonition(node, 'note') + + depart_note = depart_admonition + + def indent(self, by=0.5): + # if we are in a section ".SH" there already is a .RS + step = self._indent[-1] + self._indent.append(by) + self.body.append(self.defs['indent'][0] % step) + + def dedent(self): + self._indent.pop() + self.body.append(self.defs['indent'][1]) + + def visit_option_list(self, node): + self.indent(OPTION_LIST_INDENT) + + def depart_option_list(self, node): + self.dedent() + + def visit_option_list_item(self, node): + # one item of the list + self.body.append(self.defs['option_list_item'][0]) + + def depart_option_list_item(self, node): + self.body.append(self.defs['option_list_item'][1]) + + def visit_option_group(self, node): + # as one option could have several forms it is a group + # options without parameter bold only, .B, -v + # options with parameter bold italic, .BI, -f file + # + # we do not know if .B or .BI + self.context.append('.B') # blind guess + self.context.append(len(self.body)) # to be able to insert later + self.context.append(0) # option counter + + def depart_option_group(self, node): + self.context.pop() # the counter + start_position = self.context.pop() + text = self.body[start_position:] + del self.body[start_position:] + self.body.append('%s%s\n' % (self.context.pop(), ''.join(text))) + + def visit_option(self, node): + # each form of the option will be presented separately + if self.context[-1]>0: + self.body.append(', ') + if self.context[-3] == '.BI': + self.body.append('\\') + self.body.append(' ') + + def depart_option(self, node): + self.context[-1] += 1 + + def visit_option_string(self, node): + # do not know if .B or .BI + pass + + def depart_option_string(self, node): + pass + + def visit_option_argument(self, node): + self.context[-3] = '.BI' # bold/italic alternate + if node['delimiter'] != ' ': + self.body.append('\\fB%s ' % node['delimiter'] ) + elif self.body[len(self.body)-1].endswith('='): + # a blank only means no blank in output, just changing font + self.body.append(' ') + else: + # blank backslash blank, switch font then a blank + self.body.append(' \\ ') + + def depart_option_argument(self, node): + pass + + def visit_organization(self, node): + self.visit_docinfo_item(node, 'organization') + + def depart_organization(self, node): + pass + + def visit_paragraph(self, node): + # ``.PP`` : Start standard indented paragraph. + # ``.LP`` : Start block paragraph, all except the first. + # ``.P [type]`` : Start paragraph type. + # NOTE dont use paragraph starts because they reset indentation. + # ``.sp`` is only vertical space + self.ensure_eol() + self.body.append('.sp\n') + + def depart_paragraph(self, node): + self.body.append('\n') + + def visit_problematic(self, node): + self.body.append(self.defs['problematic'][0]) + + def depart_problematic(self, node): + self.body.append(self.defs['problematic'][1]) + + def visit_raw(self, node): + if node.get('format') == 'manpage': + self.body.append(node.astext() + "\n") + # Keep non-manpage raw text out of output: + raise nodes.SkipNode + + def visit_reference(self, node): + """E.g. link or email address.""" + self.body.append(self.defs['reference'][0]) + + def depart_reference(self, node): + self.body.append(self.defs['reference'][1]) + + def visit_revision(self, node): + self.visit_docinfo_item(node, 'revision') + + depart_revision = depart_docinfo_item + + def visit_row(self, node): + self._active_table.new_row() + + def depart_row(self, node): + pass + + def visit_section(self, node): + self.section_level += 1 + + def depart_section(self, node): + self.section_level -= 1 + + def visit_status(self, node): + self.visit_docinfo_item(node, 'status') + + depart_status = depart_docinfo_item + + def visit_strong(self, node): + self.body.append(self.defs['strong'][0]) + + def depart_strong(self, node): + self.body.append(self.defs['strong'][1]) + + def visit_substitution_definition(self, node): + """Internal only.""" + raise nodes.SkipNode + + def visit_substitution_reference(self, node): + self.document.reporter.warning('"substitution_reference" not supported', + base_node=node) + + def visit_subtitle(self, node): + if isinstance(node.parent, nodes.sidebar): + self.body.append(self.defs['strong'][0]) + elif isinstance(node.parent, nodes.document): + self.visit_docinfo_item(node, 'subtitle') + elif isinstance(node.parent, nodes.section): + self.body.append(self.defs['strong'][0]) + + def depart_subtitle(self, node): + # document subtitle calls SkipNode + self.body.append(self.defs['strong'][1]+'\n.PP\n') + + def visit_system_message(self, node): + # TODO add report_level + #if node['level'] < self.document.reporter['writer'].report_level: + # Level is too low to display: + # raise nodes.SkipNode + attr = {} + backref_text = '' + if node.hasattr('id'): + attr['name'] = node['id'] + if node.hasattr('line'): + line = ', line %s' % node['line'] + else: + line = '' + self.body.append('.IP "System Message: %s/%s (%s:%s)"\n' + % (node['type'], node['level'], node['source'], line)) + + def depart_system_message(self, node): + pass + + def visit_table(self, node): + self._active_table = Table() + + def depart_table(self, node): + self.ensure_eol() + self.body.extend(self._active_table.as_list()) + self._active_table = None + + def visit_target(self, node): + # targets are in-document hyper targets, without any use for man-pages. + raise nodes.SkipNode + + def visit_tbody(self, node): + pass + + def depart_tbody(self, node): + pass + + def visit_term(self, node): + self.body.append(self.defs['term'][0]) + + def depart_term(self, node): + self.body.append(self.defs['term'][1]) + + def visit_tgroup(self, node): + pass + + def depart_tgroup(self, node): + pass + + def visit_thead(self, node): + # MAYBE double line '=' + pass + + def depart_thead(self, node): + # MAYBE double line '=' + pass + + def visit_tip(self, node): + self.visit_admonition(node, 'tip') + + depart_tip = depart_admonition + + def visit_title(self, node): + if isinstance(node.parent, nodes.topic): + self.body.append(self.defs['topic-title'][0]) + elif isinstance(node.parent, nodes.sidebar): + self.body.append(self.defs['sidebar-title'][0]) + elif isinstance(node.parent, nodes.admonition): + self.body.append('.IP "') + elif self.section_level == 0: + self._docinfo['title'] = node.astext() + # document title for .TH + self._docinfo['title_upper'] = node.astext().upper() + raise nodes.SkipNode + elif self.section_level == 1: + self.body.append('.SH ') + else: + self.body.append('.SS ') + + def depart_title(self, node): + if isinstance(node.parent, nodes.admonition): + self.body.append('"') + self.body.append('\n') + + def visit_title_reference(self, node): + """inline citation reference""" + self.body.append(self.defs['title_reference'][0]) + + def depart_title_reference(self, node): + self.body.append(self.defs['title_reference'][1]) + + def visit_topic(self, node): + pass + + def depart_topic(self, node): + pass + + def visit_sidebar(self, node): + pass + + def depart_sidebar(self, node): + pass + + def visit_rubric(self, node): + pass + + def depart_rubric(self, node): + pass + + def visit_transition(self, node): + # .PP Begin a new paragraph and reset prevailing indent. + # .sp N leaves N lines of blank space. + # .ce centers the next line + self.body.append('\n.sp\n.ce\n----\n') + + def depart_transition(self, node): + self.body.append('\n.ce 0\n.sp\n') + + def visit_version(self, node): + self.visit_docinfo_item(node, 'version') + + def visit_warning(self, node): + self.visit_admonition(node, 'warning') + + depart_warning = depart_admonition + + def unimplemented_visit(self, node): + raise NotImplementedError('visiting unimplemented node type: %s' + % node.__class__.__name__) + +# The following part is taken from the Docutils rst2man.py script: +if __name__ == "__main__": + from docutils.core import publish_cmdline, default_description + description = ("Generates plain unix manual documents. " + + default_description) + publish_cmdline(writer=Writer(), description=description) + +# vim: set fileencoding=utf-8 et ts=4 ai : diff -r b3c13e721593 -r 53a95a744812 help/dates.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/help/dates.txt Sun Oct 04 23:16:54 2009 +0200 @@ -0,0 +1,36 @@ +Some commands allow the user to specify a date, e.g.: + +- backout, commit, import, tag: Specify the commit date. +- log, revert, update: Select revision(s) by date. + +Many date formats are valid. Here are some examples:: + + "Wed Dec 6 13:18:29 2006" (local timezone assumed) + "Dec 6 13:18 -0600" (year assumed, time offset provided) + "Dec 6 13:18 UTC" (UTC and GMT are aliases for +0000) + "Dec 6" (midnight) + "13:18" (today assumed) + "3:39" (3:39AM assumed) + "3:39pm" (15:39) + "2006-12-06 13:18:29" (ISO 8601 format) + "2006-12-6 13:18" + "2006-12-6" + "12-6" + "12/6" + "12/6/6" (Dec 6 2006) + +Lastly, there is Mercurial's internal format:: + + "1165432709 0" (Wed Dec 6 13:18:29 2006 UTC) + +This is the internal representation format for dates. unixtime is the +number of seconds since the epoch (1970-01-01 00:00 UTC). offset is +the offset of the local timezone, in seconds west of UTC (negative if +the timezone is east of UTC). + +The log command also accepts date ranges:: + + "<{datetime}" - at or before a given date/time + ">{datetime}" - on or after a given date/time + "{datetime} to {datetime}" - a date range, inclusive + "-{days}" - within a given number of days of today diff -r b3c13e721593 -r 53a95a744812 help/diffs.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/help/diffs.txt Sun Oct 04 23:16:54 2009 +0200 @@ -0,0 +1,29 @@ +Mercurial's default format for showing changes between two versions of +a file is compatible with the unified format of GNU diff, which can be +used by GNU patch and many other standard tools. + +While this standard format is often enough, it does not encode the +following information: + +- executable status and other permission bits +- copy or rename information +- changes in binary files +- creation or deletion of empty files + +Mercurial also supports the extended diff format from the git VCS +which addresses these limitations. The git diff format is not produced +by default because a few widespread tools still do not understand this +format. + +This means that when generating diffs from a Mercurial repository +(e.g. with "hg export"), you should be careful about things like file +copies and renames or other things mentioned above, because when +applying a standard diff to a different repository, this extra +information is lost. Mercurial's internal operations (like push and +pull) are not affected by this, because they use an internal binary +format for communicating changes. + +To make Mercurial produce the git extended diff format, use the --git +option available for many commands, or set 'git = True' in the [diff] +section of your hgrc. You do not need to set this option when +importing diffs in this format or using them in the mq extension. diff -r b3c13e721593 -r 53a95a744812 help/environment.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/help/environment.txt Sun Oct 04 23:16:54 2009 +0200 @@ -0,0 +1,76 @@ +HG + Path to the 'hg' executable, automatically passed when running + hooks, extensions or external tools. If unset or empty, this is + the hg executable's name if it's frozen, or an executable named + 'hg' (with %PATHEXT% [defaulting to COM/EXE/BAT/CMD] extensions on + Windows) is searched. + +HGEDITOR + This is the name of the editor to run when committing. See EDITOR. + + (deprecated, use .hgrc) + +HGENCODING + This overrides the default locale setting detected by Mercurial. + This setting is used to convert data including usernames, + changeset descriptions, tag names, and branches. This setting can + be overridden with the --encoding command-line option. + +HGENCODINGMODE + This sets Mercurial's behavior for handling unknown characters + while transcoding user input. The default is "strict", which + causes Mercurial to abort if it can't map a character. Other + settings include "replace", which replaces unknown characters, and + "ignore", which drops them. This setting can be overridden with + the --encodingmode command-line option. + +HGMERGE + An executable to use for resolving merge conflicts. The program + will be executed with three arguments: local file, remote file, + ancestor file. + + (deprecated, use .hgrc) + +HGRCPATH + A list of files or directories to search for hgrc files. Item + separator is ":" on Unix, ";" on Windows. If HGRCPATH is not set, + platform default search path is used. If empty, only the .hg/hgrc + from the current repository is read. + + For each element in HGRCPATH: + + - if it's a directory, all files ending with .rc are added + - otherwise, the file itself will be added + +HGUSER + This is the string used as the author of a commit. If not set, + available values will be considered in this order: + + - HGUSER (deprecated) + - hgrc files from the HGRCPATH + - EMAIL + - interactive prompt + - LOGNAME (with '@hostname' appended) + + (deprecated, use .hgrc) + +EMAIL + May be used as the author of a commit; see HGUSER. + +LOGNAME + May be used as the author of a commit; see HGUSER. + +VISUAL + This is the name of the editor to use when committing. See EDITOR. + +EDITOR + Sometimes Mercurial needs to open a text file in an editor for a + user to modify, for example when writing commit messages. The + editor it uses is determined by looking at the environment + variables HGEDITOR, VISUAL and EDITOR, in that order. The first + non-empty one is chosen. If all of them are empty, the editor + defaults to 'vi'. + +PYTHONPATH + This is used by Python to find imported modules and may need to be + set appropriately if this Mercurial is not installed system-wide. diff -r b3c13e721593 -r 53a95a744812 help/extensions.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/help/extensions.txt Sun Oct 04 23:16:54 2009 +0200 @@ -0,0 +1,33 @@ +Mercurial has the ability to add new features through the use of +extensions. Extensions may add new commands, add options to +existing commands, change the default behavior of commands, or +implement hooks. + +Extensions are not loaded by default for a variety of reasons: +they can increase startup overhead; they may be meant for advanced +usage only; they may provide potentially dangerous abilities (such +as letting you destroy or modify history); they might not be ready +for prime time; or they may alter some usual behaviors of stock +Mercurial. It is thus up to the user to activate extensions as +needed. + +To enable the "foo" extension, either shipped with Mercurial or in +the Python search path, create an entry for it in your hgrc, like +this:: + + [extensions] + foo = + +You may also specify the full path to an extension:: + + [extensions] + myfeature = ~/.hgext/myfeature.py + +To explicitly disable an extension enabled in an hgrc of broader +scope, prepend its path with !:: + + [extensions] + # disabling extension bar residing in /path/to/extension/bar.py + hgext.bar = !/path/to/extension/bar.py + # ditto, but no path was supplied for extension baz + hgext.baz = ! diff -r b3c13e721593 -r 53a95a744812 help/multirevs.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/help/multirevs.txt Sun Oct 04 23:16:54 2009 +0200 @@ -0,0 +1,13 @@ +When Mercurial accepts more than one revision, they may be specified +individually, or provided as a topologically continuous range, +separated by the ":" character. + +The syntax of range notation is [BEGIN]:[END], where BEGIN and END are +revision identifiers. Both BEGIN and END are optional. If BEGIN is not +specified, it defaults to revision number 0. If END is not specified, +it defaults to the tip. The range ":" thus means "all revisions". + +If BEGIN is greater than END, revisions are treated in reverse order. + +A range acts as a closed interval. This means that a range of 3:5 +gives 3, 4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6. diff -r b3c13e721593 -r 53a95a744812 help/patterns.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/help/patterns.txt Sun Oct 04 23:16:54 2009 +0200 @@ -0,0 +1,41 @@ +Mercurial accepts several notations for identifying one or more files +at a time. + +By default, Mercurial treats filenames as shell-style extended glob +patterns. + +Alternate pattern notations must be specified explicitly. + +To use a plain path name without any pattern matching, start it with +"path:". These path names must completely match starting at the +current repository root. + +To use an extended glob, start a name with "glob:". Globs are rooted +at the current directory; a glob such as "``*.c``" will only match +files in the current directory ending with ".c". + +The supported glob syntax extensions are "``**``" to match any string +across path separators and "{a,b}" to mean "a or b". + +To use a Perl/Python regular expression, start a name with "re:". +Regexp pattern matching is anchored at the root of the repository. + +Plain examples:: + + path:foo/bar a name bar in a directory named foo in the root + of the repository + path:path:name a file or directory named "path:name" + +Glob examples:: + + glob:*.c any name ending in ".c" in the current directory + *.c any name ending in ".c" in the current directory + **.c any name ending in ".c" in any subdirectory of the + current directory including itself. + foo/*.c any name ending in ".c" in the directory foo + foo/**.c any name ending in ".c" in any subdirectory of foo + including itself. + +Regexp examples:: + + re:.*\.c$ any name ending in ".c", anywhere in the repository diff -r b3c13e721593 -r 53a95a744812 help/revisions.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/help/revisions.txt Sun Oct 04 23:16:54 2009 +0200 @@ -0,0 +1,29 @@ +Mercurial supports several ways to specify individual revisions. + +A plain integer is treated as a revision number. Negative integers are +treated as sequential offsets from the tip, with -1 denoting the tip, +-2 denoting the revision prior to the tip, and so forth. + +A 40-digit hexadecimal string is treated as a unique revision +identifier. + +A hexadecimal string less than 40 characters long is treated as a +unique revision identifier and is referred to as a short-form +identifier. A short-form identifier is only valid if it is the prefix +of exactly one full-length identifier. + +Any other string is treated as a tag or branch name. A tag name is a +symbolic name associated with a revision identifier. A branch name +denotes the tipmost revision of that branch. Tag and branch names must +not contain the ":" character. + +The reserved name "tip" is a special tag that always identifies the +most recent revision. + +The reserved name "null" indicates the null revision. This is the +revision of an empty repository, and the parent of revision 0. + +The reserved name "." indicates the working directory parent. If no +working directory is checked out, it is equivalent to null. If an +uncommitted merge is in progress, "." is the revision of the first +parent. diff -r b3c13e721593 -r 53a95a744812 help/templates.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/help/templates.txt Sun Oct 04 23:16:54 2009 +0200 @@ -0,0 +1,113 @@ +Mercurial allows you to customize output of commands through +templates. You can either pass in a template from the command +line, via the --template option, or select an existing +template-style (--style). + +You can customize output for any "log-like" command: log, +outgoing, incoming, tip, parents, heads and glog. + +Three styles are packaged with Mercurial: default (the style used +when no explicit preference is passed), compact and changelog. +Usage:: + + $ hg log -r1 --style changelog + +A template is a piece of text, with markup to invoke variable +expansion:: + + $ hg log -r1 --template "{node}\n" + b56ce7b07c52de7d5fd79fb89701ea538af65746 + +Strings in curly braces are called keywords. The availability of +keywords depends on the exact context of the templater. These +keywords are usually available for templating a log-like command: + +:author: String. The unmodified author of the changeset. +:branches: String. The name of the branch on which the changeset + was committed. Will be empty if the branch name was + default. +:date: Date information. The date when the changeset was + committed. +:desc: String. The text of the changeset description. +:diffstat: String. Statistics of changes with the following + format: "modified files: +added/-removed lines" +:files: List of strings. All files modified, added, or removed + by this changeset. +:file_adds: List of strings. Files added by this changeset. +:file_mods: List of strings. Files modified by this changeset. +:file_dels: List of strings. Files removed by this changeset. +:node: String. The changeset identification hash, as a + 40-character hexadecimal string. +:parents: List of strings. The parents of the changeset. +:rev: Integer. The repository-local changeset revision + number. +:tags: List of strings. Any tags associated with the + changeset. +:latesttag: String. Most recent global tag in the ancestors of this + changeset. +:latesttagdistance: Integer. Longest path to the latest tag. + +The "date" keyword does not produce human-readable output. If you +want to use a date in your output, you can use a filter to process +it. Filters are functions which return a string based on the input +variable. You can also use a chain of filters to get the desired +output:: + + $ hg tip --template "{date|isodate}\n" + 2008-08-21 18:22 +0000 + +List of filters: + +:addbreaks: Any text. Add an XHTML "
" tag before the end of + every line except the last. +:age: Date. Returns a human-readable date/time difference + between the given date/time and the current + date/time. +:basename: Any text. Treats the text as a path, and returns the + last component of the path after splitting by the + path separator (ignoring trailing separators). For + example, "foo/bar/baz" becomes "baz" and "foo/bar//" + becomes "bar". +:stripdir: Treat the text as path and strip a directory level, + if possible. For example, "foo" and "foo/bar" becomes + "foo". +:date: Date. Returns a date in a Unix date format, including + the timezone: "Mon Sep 04 15:13:13 2006 0700". +:domain: Any text. Finds the first string that looks like an + email address, and extracts just the domain + component. Example: 'User ' becomes + 'example.com'. +:email: Any text. Extracts the first string that looks like + an email address. Example: 'User ' + becomes 'user@example.com'. +:escape: Any text. Replaces the special XML/XHTML characters + "&", "<" and ">" with XML entities. +:fill68: Any text. Wraps the text to fit in 68 columns. +:fill76: Any text. Wraps the text to fit in 76 columns. +:firstline: Any text. Returns the first line of text. +:nonempty: Any text. Returns '(none)' if the string is empty. +:hgdate: Date. Returns the date as a pair of numbers: + "1157407993 25200" (Unix timestamp, timezone offset). +:isodate: Date. Returns the date in ISO 8601 format: + "2009-08-18 13:00 +0200". +:isodatesec: Date. Returns the date in ISO 8601 format, including + seconds: "2009-08-18 13:00:13 +0200". See also the + rfc3339date filter. +:localdate: Date. Converts a date to local date. +:obfuscate: Any text. Returns the input text rendered as a + sequence of XML entities. +:person: Any text. Returns the text before an email address. +:rfc822date: Date. Returns a date using the same format used in + email headers: "Tue, 18 Aug 2009 13:00:13 +0200". +:rfc3339date: Date. Returns a date using the Internet date format + specified in RFC 3339: "2009-08-18T13:00:13+02:00". +:short: Changeset hash. Returns the short form of a changeset + hash, i.e. a 12-byte hexadecimal string. +:shortdate: Date. Returns a date like "2006-09-18". +:strip: Any text. Strips all leading and trailing whitespace. +:tabindent: Any text. Returns the text, with every line except + the first starting with a tab character. +:urlescape: Any text. Escapes all "special" characters. For + example, "foo bar" becomes "foo%20bar". +:user: Any text. Returns the user portion of an email + address. diff -r b3c13e721593 -r 53a95a744812 help/urls.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/help/urls.txt Sun Oct 04 23:16:54 2009 +0200 @@ -0,0 +1,63 @@ +Valid URLs are of the form:: + + local/filesystem/path[#revision] + file://local/filesystem/path[#revision] + http://[user[:pass]@]host[:port]/[path][#revision] + https://[user[:pass]@]host[:port]/[path][#revision] + ssh://[user[:pass]@]host[:port]/[path][#revision] + +Paths in the local filesystem can either point to Mercurial +repositories or to bundle files (as created by 'hg bundle' or 'hg +incoming --bundle'). + +An optional identifier after # indicates a particular branch, tag, or +changeset to use from the remote repository. See also 'hg help +revisions'. + +Some features, such as pushing to http:// and https:// URLs are only +possible if the feature is explicitly enabled on the remote Mercurial +server. + +Some notes about using SSH with Mercurial: + +- SSH requires an accessible shell account on the destination machine + and a copy of hg in the remote path or specified with as remotecmd. +- path is relative to the remote user's home directory by default. Use + an extra slash at the start of a path to specify an absolute path:: + + ssh://example.com//tmp/repository + +- Mercurial doesn't use its own compression via SSH; the right thing + to do is to configure it in your ~/.ssh/config, e.g.:: + + Host *.mylocalnetwork.example.com + Compression no + Host * + Compression yes + + Alternatively specify "ssh -C" as your ssh command in your hgrc or + with the --ssh command line option. + +These URLs can all be stored in your hgrc with path aliases under the +[paths] section like so:: + + [paths] + alias1 = URL1 + alias2 = URL2 + ... + +You can then use the alias for any command that uses a URL (for +example 'hg pull alias1' would pull from the 'alias1' path). + +Two path aliases are special because they are used as defaults when +you do not provide the URL to a command: + +default: + When you create a repository with hg clone, the clone command saves + the location of the source repository as the new repository's + 'default' path. This is then used when you omit path from push- and + pull-like commands (including incoming and outgoing). + +default-push: + The push command will look for a path named 'default-push', and + prefer it over 'default' if both are defined. diff -r b3c13e721593 -r 53a95a744812 hgext/acl.py --- a/hgext/acl.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/acl.py Sun Oct 04 23:16:54 2009 +0200 @@ -22,7 +22,7 @@ Nor is it safe if remote users share an account, because then there is no way to distinguish them. -To use this hook, configure the acl extension in your hgrc like this: +To use this hook, configure the acl extension in your hgrc like this:: [extensions] hgext.acl = @@ -35,10 +35,10 @@ # ("serve" == ssh or http, "push", "pull", "bundle") sources = serve -The allow and deny sections take a subtree pattern as key (with a -glob syntax by default), and a comma separated list of users as -the corresponding value. The deny list is checked before the allow -list is. +The allow and deny sections take a subtree pattern as key (with a glob +syntax by default), and a comma separated list of users as the +corresponding value. The deny list is checked before the allow list +is. :: [acl.allow] # If acl.allow is not present, all users are allowed by default. @@ -60,12 +60,12 @@ def buildmatch(ui, repo, user, key): '''return tuple of (match function, list enabled).''' if not ui.has_section(key): - ui.debug(_('acl: %s not enabled\n') % key) + ui.debug('acl: %s not enabled\n' % key) return None pats = [pat for pat, users in ui.configitems(key) if user in users.replace(',', ' ').split()] - ui.debug(_('acl: %s enabled, %d entries for user %s\n') % + ui.debug('acl: %s enabled, %d entries for user %s\n' % (key, len(pats), user)) if pats: return match.match(repo.root, '', pats) @@ -77,7 +77,7 @@ raise util.Abort(_('config error - hook type "%s" cannot stop ' 'incoming changesets') % hooktype) if source not in ui.config('acl', 'sources', 'serve').split(): - ui.debug(_('acl: changes have source "%s" - skipping\n') % source) + ui.debug('acl: changes have source "%s" - skipping\n' % source) return user = None @@ -99,9 +99,9 @@ ctx = repo[rev] for f in ctx.files(): if deny and deny(f): - ui.debug(_('acl: user %s denied on %s\n') % (user, f)) + ui.debug('acl: user %s denied on %s\n' % (user, f)) raise util.Abort(_('acl: access denied for changeset %s') % ctx) if allow and not allow(f): - ui.debug(_('acl: user %s not allowed on %s\n') % (user, f)) + ui.debug('acl: user %s not allowed on %s\n' % (user, f)) raise util.Abort(_('acl: access denied for changeset %s') % ctx) - ui.debug(_('acl: allowing changeset %s\n') % ctx) + ui.debug('acl: allowing changeset %s\n' % ctx) diff -r b3c13e721593 -r 53a95a744812 hgext/bookmarks.py --- a/hgext/bookmarks.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/bookmarks.py Sun Oct 04 23:16:54 2009 +0200 @@ -9,16 +9,16 @@ Bookmarks are local movable markers to changesets. Every bookmark points to a changeset identified by its hash. If you commit a -changeset that is based on a changeset that has a bookmark on it, -the bookmark shifts to the new changeset. +changeset that is based on a changeset that has a bookmark on it, the +bookmark shifts to the new changeset. -It is possible to use bookmark names in every revision lookup -(e.g. hg merge, hg update). +It is possible to use bookmark names in every revision lookup (e.g. hg +merge, hg update). By default, when several bookmarks point to the same changeset, they will all move forward together. It is possible to obtain a more git-like experience by adding the following configuration option to -your .hgrc: +your .hgrc:: [bookmarks] track.current = True @@ -249,12 +249,12 @@ key = self._bookmarks[key] return super(bookmark_repo, self).lookup(key) - def commit(self, *k, **kw): + def commitctx(self, ctx, error=False): """Add a revision to the repository and move the bookmark""" wlock = self.wlock() # do both commit and bookmark with lock held try: - node = super(bookmark_repo, self).commit(*k, **kw) + node = super(bookmark_repo, self).commitctx(ctx, error) if node is None: return None parents = self.changelog.parents(node) @@ -262,12 +262,13 @@ parents = (parents[0],) marks = parse(self) update = False - for mark, n in marks.items(): - if ui.configbool('bookmarks', 'track.current'): - if mark == current(self) and n in parents: - marks[mark] = node - update = True - else: + if ui.configbool('bookmarks', 'track.current'): + mark = current(self) + if mark and marks[mark] in parents: + marks[mark] = node + update = True + else: + for mark, n in marks.items(): if n in parents: marks[mark] = node update = True @@ -288,22 +289,25 @@ node = self.changelog.tip() marks = parse(self) update = False - for mark, n in marks.items(): - if n in parents: + if ui.configbool('bookmarks', 'track.current'): + mark = current(self) + if mark and marks[mark] in parents: marks[mark] = node update = True + else: + for mark, n in marks.items(): + if n in parents: + marks[mark] = node + update = True if update: write(self, marks) return result - def tags(self): + def _findtags(self): """Merge bookmarks with normal tags""" - if self.tagscache: - return self.tagscache - - tagscache = super(bookmark_repo, self).tags() - tagscache.update(parse(self)) - return tagscache + (tags, tagtypes) = super(bookmark_repo, self)._findtags() + tags.update(parse(self)) + return (tags, tagtypes) repo.__class__ = bookmark_repo diff -r b3c13e721593 -r 53a95a744812 hgext/bugzilla.py --- a/hgext/bugzilla.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/bugzilla.py Sun Oct 04 23:16:54 2009 +0200 @@ -21,65 +21,86 @@ be run by Mercurial as the user pushing the change; you will need to ensure the Bugzilla install file permissions are set appropriately. -Configuring the extension: +The extension is configured through three different configuration +sections. These keys are recognized in the [bugzilla] section: + +host + Hostname of the MySQL server holding the Bugzilla database. + +db + Name of the Bugzilla database in MySQL. Default 'bugs'. + +user + Username to use to access MySQL server. Default 'bugs'. + +password + Password to use to access MySQL server. + +timeout + Database connection timeout (seconds). Default 5. - [bugzilla] +version + Bugzilla version. Specify '3.0' for Bugzilla versions 3.0 and later, + '2.18' for Bugzilla versions from 2.18 and '2.16' for versions prior + to 2.18. + +bzuser + Fallback Bugzilla user name to record comments with, if changeset + committer cannot be found as a Bugzilla user. + +bzdir + Bugzilla install directory. Used by default notify. Default + '/var/www/html/bugzilla'. + +notify + The command to run to get Bugzilla to send bug change notification + emails. Substitutes from a map with 3 keys, 'bzdir', 'id' (bug id) + and 'user' (committer bugzilla email). Default depends on version; + from 2.18 it is "cd %(bzdir)s && perl -T contrib/sendbugmail.pl + %(id)s %(user)s". - host Hostname of the MySQL server holding the Bugzilla - database. - db Name of the Bugzilla database in MySQL. Default 'bugs'. - user Username to use to access MySQL server. Default 'bugs'. - password Password to use to access MySQL server. - timeout Database connection timeout (seconds). Default 5. - version Bugzilla version. Specify '3.0' for Bugzilla versions - 3.0 and later, '2.18' for Bugzilla versions from 2.18 - and '2.16' for versions prior to 2.18. - bzuser Fallback Bugzilla user name to record comments with, if - changeset committer cannot be found as a Bugzilla user. - bzdir Bugzilla install directory. Used by default notify. - Default '/var/www/html/bugzilla'. - notify The command to run to get Bugzilla to send bug change - notification emails. Substitutes from a map with 3 - keys, 'bzdir', 'id' (bug id) and 'user' (committer - bugzilla email). Default depends on version; from 2.18 - it is "cd %(bzdir)s && perl -T contrib/sendbugmail.pl - %(id)s %(user)s". - regexp Regular expression to match bug IDs in changeset commit - message. Must contain one "()" group. The default - expression matches 'Bug 1234', 'Bug no. 1234', 'Bug - number 1234', 'Bugs 1234,5678', 'Bug 1234 and 5678' and - variations thereof. Matching is case insensitive. - style The style file to use when formatting comments. - template Template to use when formatting comments. Overrides - style if specified. In addition to the usual Mercurial - keywords, the extension specifies: - {bug} The Bugzilla bug ID. - {root} The full pathname of the Mercurial - repository. - {webroot} Stripped pathname of the Mercurial - repository. - {hgweb} Base URL for browsing Mercurial - repositories. - Default 'changeset {node|short} in repo {root} refers ' - 'to bug {bug}.\\ndetails:\\n\\t{desc|tabindent}' - strip The number of slashes to strip from the front of {root} - to produce {webroot}. Default 0. - usermap Path of file containing Mercurial committer ID to - Bugzilla user ID mappings. If specified, the file - should contain one mapping per line, - "committer"="Bugzilla user". See also the [usermap] - section. +regexp + Regular expression to match bug IDs in changeset commit message. + Must contain one "()" group. The default expression matches 'Bug + 1234', 'Bug no. 1234', 'Bug number 1234', 'Bugs 1234,5678', 'Bug + 1234 and 5678' and variations thereof. Matching is case insensitive. + +style + The style file to use when formatting comments. + +template + Template to use when formatting comments. Overrides style if + specified. In addition to the usual Mercurial keywords, the + extension specifies:: + + {bug} The Bugzilla bug ID. + {root} The full pathname of the Mercurial repository. + {webroot} Stripped pathname of the Mercurial repository. + {hgweb} Base URL for browsing Mercurial repositories. - [usermap] - Any entries in this section specify mappings of Mercurial - committer ID to Bugzilla user ID. See also [bugzilla].usermap. - "committer"="Bugzilla user" + Default 'changeset {node|short} in repo {root} refers ' + 'to bug {bug}.\\ndetails:\\n\\t{desc|tabindent}' + +strip + The number of slashes to strip from the front of {root} to produce + {webroot}. Default 0. + +usermap + Path of file containing Mercurial committer ID to Bugzilla user ID + mappings. If specified, the file should contain one mapping per + line, "committer"="Bugzilla user". See also the [usermap] section. - [web] - baseurl Base URL for browsing Mercurial repositories. Reference - from templates as {hgweb}. +The [usermap] section is used to specify mappings of Mercurial +committer ID to Bugzilla user ID. See also [bugzilla].usermap. +"committer"="Bugzilla user" + +Finally, the [web] section supports one entry: -Activating the extension: +baseurl + Base URL for browsing Mercurial repositories. Reference from + templates as {hgweb}. + +Activating the extension:: [extensions] hgext.bugzilla = @@ -92,7 +113,7 @@ This example configuration is for a collection of Mercurial repositories in /var/local/hg/repos/ used with a local Bugzilla 3.2 -installation in /opt/bugzilla-3.2. +installation in /opt/bugzilla-3.2. :: [bugzilla] host=localhost @@ -100,7 +121,9 @@ version=3.0 bzuser=unknown@domain.com bzdir=/opt/bugzilla-3.2 - template=Changeset {node|short} in {root|basename}.\\n{hgweb}/{webroot}/rev/{node|short}\\n\\n{desc}\\n + template=Changeset {node|short} in {root|basename}. + {hgweb}/{webroot}/rev/{node|short}\\n + {desc}\\n strip=5 [web] @@ -109,7 +132,7 @@ [usermap] user@emaildomain.com=user.name@bugzilladomain.com -Commits add a comment to the Bugzilla bug record of the form: +Commits add a comment to the Bugzilla bug record of the form:: Changeset 3b16791d6642 in repository-name. http://dev.domain.com/hg/repository-name/rev/3b16791d6642 diff -r b3c13e721593 -r 53a95a744812 hgext/children.py diff -r b3c13e721593 -r 53a95a744812 hgext/churn.py --- a/hgext/churn.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/churn.py Sun Oct 04 23:16:54 2009 +0200 @@ -24,7 +24,7 @@ def changedlines(ui, repo, ctx1, ctx2, fns): lines = 0 - fmatch = cmdutil.match(repo, pats=fns) + fmatch = cmdutil.matchfiles(repo, fns) diff = ''.join(patch.diff(repo, ctx1.node(), ctx2.node(), fmatch)) for l in diff.split('\n'): if (l.startswith("+") and not l.startswith("+++ ") or @@ -53,15 +53,17 @@ if opts.get('date'): df = util.matchdate(opts['date']) - get = util.cachefunc(lambda r: repo[r].changeset()) + get = util.cachefunc(lambda r: repo[r]) changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts) for st, rev, fns in changeiter: + if not st == 'add': continue - if df and not df(get(rev)[2][0]): # doesn't match date format + + ctx = get(rev) + if df and not df(ctx.date()[0]): # doesn't match date format continue - ctx = repo[rev] key = getkey(ctx) key = amap.get(key, key) # alias remap if opts.get('changesets'): @@ -104,7 +106,7 @@ alternatively the number of matching revisions if the --changesets option is specified. - Examples: + Examples:: # display count of changed lines for every committer hg churn -t '{author|email}' @@ -119,12 +121,12 @@ hg churn -f '%Y' -s It is possible to map alternate email addresses to a main address - by providing a file using the following format: + by providing a file using the following format:: - + - Such a file may be specified with the --aliases option, otherwise a - .hgchurn file will be looked for in the working directory root. + Such a file may be specified with the --aliases option, otherwise + a .hgchurn file will be looked for in the working directory root. ''' def pad(s, l): return (s + " " * l)[:l] @@ -143,15 +145,15 @@ if not rate: return - sortfn = ((not opts.get('sort')) and (lambda a, b: cmp(b[1], a[1])) or None) - rate.sort(sortfn) + sortkey = ((not opts.get('sort')) and (lambda x: -x[1]) or None) + rate.sort(key=sortkey) # Be careful not to have a zero maxcount (issue833) - maxcount = float(max([v for k, v in rate])) or 1.0 - maxname = max([len(k) for k, v in rate]) + maxcount = float(max(v for k, v in rate)) or 1.0 + maxname = max(len(k) for k, v in rate) ttywidth = util.termwidth() - ui.debug(_("assuming %i character terminal\n") % ttywidth) + ui.debug("assuming %i character terminal\n" % ttywidth) width = ttywidth - maxname - 2 - 6 - 2 - 2 for date, count in rate: diff -r b3c13e721593 -r 53a95a744812 hgext/color.py --- a/hgext/color.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/color.py Sun Oct 04 23:16:54 2009 +0200 @@ -29,33 +29,33 @@ function (aka ANSI escape codes). This module also provides the render_text function, which can be used to add effects to any text. -Default effects may be overridden from the .hgrc file: +Default effects may be overridden from the .hgrc file:: -[color] -status.modified = blue bold underline red_background -status.added = green bold -status.removed = red bold blue_background -status.deleted = cyan bold underline -status.unknown = magenta bold underline -status.ignored = black bold + [color] + status.modified = blue bold underline red_background + status.added = green bold + status.removed = red bold blue_background + status.deleted = cyan bold underline + status.unknown = magenta bold underline + status.ignored = black bold -# 'none' turns off all effects -status.clean = none -status.copied = none + # 'none' turns off all effects + status.clean = none + status.copied = none -qseries.applied = blue bold underline -qseries.unapplied = black bold -qseries.missing = red bold + qseries.applied = blue bold underline + qseries.unapplied = black bold + qseries.missing = red bold -diff.diffline = bold -diff.extended = cyan bold -diff.file_a = red bold -diff.file_b = green bold -diff.hunk = magenta -diff.deleted = red -diff.inserted = green -diff.changed = white -diff.trailingwhitespace = bold red_background + diff.diffline = bold + diff.extended = cyan bold + diff.file_a = red bold + diff.file_b = green bold + diff.hunk = magenta + diff.deleted = red + diff.inserted = green + diff.changed = white + diff.trailingwhitespace = bold red_background ''' import os, sys @@ -142,14 +142,10 @@ '''run the qseries command with colored output''' ui.pushbuffer() retval = orig(ui, repo, **opts) - patches = ui.popbuffer().splitlines() - for patch in patches: - patchname = patch - if opts['summary']: - patchname = patchname.split(': ')[0] - if ui.verbose: - patchname = patchname.split(' ', 2)[-1] + 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. @@ -158,13 +154,14 @@ effects = _patch_effects['applied'] else: effects = _patch_effects['unapplied'] - ui.write(render_effects(patch, effects) + '\n') + + 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'], } - + 'missing': ['red', 'bold'], + 'unapplied': ['black', 'bold'], } def colorwrap(orig, s): '''wrap ui.write for colored diff output''' lines = s.split('\n') @@ -220,12 +217,8 @@ 'changed': ['white'], 'trailingwhitespace': ['bold', 'red_background']} -_ui = None - def uisetup(ui): '''Initialize the extension.''' - global _ui - _ui = ui _setupcmd(ui, 'diff', commands.table, colordiff, _diff_effects) _setupcmd(ui, 'incoming', commands.table, None, _diff_effects) _setupcmd(ui, 'log', commands.table, None, _diff_effects) @@ -233,17 +226,10 @@ _setupcmd(ui, 'tip', commands.table, None, _diff_effects) _setupcmd(ui, 'status', commands.table, colorstatus, _status_effects) -def extsetup(): try: mq = extensions.find('mq') - try: - # If we are loaded after mq, we must wrap commands.table - _setupcmd(_ui, 'qdiff', commands.table, colordiff, _diff_effects) - _setupcmd(_ui, 'qseries', commands.table, colorqseries, _patch_effects) - except error.UnknownCommand: - # Otherwise we wrap mq.cmdtable - _setupcmd(_ui, 'qdiff', mq.cmdtable, colordiff, _diff_effects) - _setupcmd(_ui, 'qseries', mq.cmdtable, colorqseries, _patch_effects) + _setupcmd(ui, 'qdiff', mq.cmdtable, colordiff, _diff_effects) + _setupcmd(ui, 'qseries', mq.cmdtable, colorqseries, _patch_effects) except KeyError: # The mq extension is not enabled pass @@ -269,7 +255,7 @@ 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")), + ('', 'no-color', None, _("don't colorize output (DEPRECATED)")), ]) for status in effectsmap: diff -r b3c13e721593 -r 53a95a744812 hgext/convert/__init__.py --- a/hgext/convert/__init__.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/convert/__init__.py Sun Oct 04 23:16:54 2009 +0200 @@ -19,6 +19,7 @@ """convert a foreign SCM repository to a Mercurial one. Accepted source formats [identifiers]: + - Mercurial [hg] - CVS [cvs] - Darcs [darcs] @@ -30,6 +31,7 @@ - Perforce [p4] Accepted destination formats [identifiers]: + - Mercurial [hg] - Subversion [svn] (history on branches is not preserved) @@ -41,23 +43,28 @@ basename of the source with '-hg' appended. If the destination repository doesn't exist, it will be created. - By default, all sources except Mercurial will use - --branchsort. Mercurial uses --sourcesort to preserve original - revision numbers order. Sort modes have the following effects: - --branchsort: convert from parent to child revision when - possible, which means branches are usually converted one after - the other. It generates more compact repositories. - --datesort: sort revisions by date. Converted repositories have - good-looking changelogs but are often an order of magnitude - larger than the same ones generated by --branchsort. - --sourcesort: try to preserve source revisions order, only - supported by Mercurial sources. + By default, all sources except Mercurial will use --branchsort. + Mercurial uses --sourcesort to preserve original revision numbers + order. Sort modes have the following effects: + + --branchsort convert from parent to child revision when possible, + which means branches are usually converted one after + the other. It generates more compact repositories. + + --datesort sort revisions by date. Converted repositories have + good-looking changelogs but are often an order of + magnitude larger than the same ones generated by + --branchsort. + + --sourcesort try to preserve source revisions order, only + supported by Mercurial sources. If isn't given, it will be put in a default location (/.hg/shamap by default). The is a simple text file that maps each source commit ID to the destination ID for that - revision, like so: - + revision, like so:: + + If the file doesn't exist, it's automatically created. It's updated on each commit copied, so convert-repo can be interrupted @@ -71,7 +78,7 @@ The filemap is a file that allows filtering and remapping of files and directories. Comment lines start with '#'. Each line can - contain one of the following directives: + contain one of the following directives:: include path/to/file @@ -81,11 +88,11 @@ The 'include' directive causes a file, or all files under a directory, to be included in the destination repository, and the - exclusion of all other files and directories not explicitly included. - The 'exclude' directive causes files or directories to be omitted. - The 'rename' directive renames a file or directory. To rename from - a subdirectory into the root of the repository, use '.' as the - path to rename to. + exclusion of all other files and directories not explicitly + included. The 'exclude' directive causes files or directories to + be omitted. The 'rename' directive renames a file or directory. To + rename from a subdirectory into the root of the repository, use + '.' as the path to rename to. The splicemap is a file that allows insertion of synthetic history, letting you specify the parents of a revision. This is @@ -110,7 +117,7 @@ in one repository from "default" to a named branch. Mercurial Source - ----------------- + ---------------- --config convert.hg.ignoreerrors=False (boolean) ignore integrity errors when reading. Use it to fix Mercurial @@ -138,40 +145,43 @@ Because CVS does not have changesets, it is necessary to collect individual commits to CVS and merge them into changesets. CVS source uses its internal changeset merging code by default but can - be configured to call the external 'cvsps' program by setting: - --config convert.cvsps='cvsps -A -u --cvs-direct -q' + be configured to call the external 'cvsps' program by setting:: + + --config convert.cvsps='cvsps -A -u --cvs-direct -q' + This option is deprecated and will be removed in Mercurial 1.4. The options shown are the defaults. - Internal cvsps is selected by setting - --config convert.cvsps=builtin + Internal cvsps is selected by setting :: + + --config convert.cvsps=builtin + and has a few more configurable options: - --config convert.cvsps.cache=True (boolean) - Set to False to disable remote log caching, for testing and - debugging purposes. - --config convert.cvsps.fuzz=60 (integer) - Specify the maximum time (in seconds) that is allowed - between commits with identical user and log message in a - single changeset. When very large files were checked in as - part of a changeset then the default may not be long - enough. - --config convert.cvsps.mergeto='{{mergetobranch ([-\\w]+)}}' - Specify a regular expression to which commit log messages - are matched. If a match occurs, then the conversion - process will insert a dummy revision merging the branch on - which this log message occurs to the branch indicated in - the regex. - --config convert.cvsps.mergefrom='{{mergefrombranch ([-\\w]+)}}' - Specify a regular expression to which commit log messages - are matched. If a match occurs, then the conversion - process will add the most recent revision on the branch - indicated in the regex as the second parent of the - changeset. - The hgext/convert/cvsps wrapper script allows the builtin + --config convert.cvsps.cache=True (boolean) + Set to False to disable remote log caching, for testing and + debugging purposes. + --config convert.cvsps.fuzz=60 (integer) + Specify the maximum time (in seconds) that is allowed between + commits with identical user and log message in a single + changeset. When very large files were checked in as part of a + changeset then the default may not be long enough. + --config convert.cvsps.mergeto='{{mergetobranch ([-\\w]+)}}' + Specify a regular expression to which commit log messages are + matched. If a match occurs, then the conversion process will + insert a dummy revision merging the branch on which this log + message occurs to the branch indicated in the regex. + --config convert.cvsps.mergefrom='{{mergefrombranch ([-\\w]+)}}' + Specify a regular expression to which commit log messages are + matched. If a match occurs, then the conversion process will + add the most recent revision on the branch indicated in the + regex as the second parent of the changeset. + + An additional "debugcvsps" Mercurial command allows the builtin changeset merging code to be run without doing a conversion. Its - parameters and output are similar to that of cvsps 2.1. + parameters and output are similar to that of cvsps 2.1. Please see + the command help for more details. Subversion Source ----------------- @@ -217,7 +227,6 @@ --config convert.p4.startrev=0 (perforce changelist number) specify initial Perforce revision. - Mercurial Destination --------------------- diff -r b3c13e721593 -r 53a95a744812 hgext/convert/common.py --- a/hgext/convert/common.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/convert/common.py Sun Oct 04 23:16:54 2009 +0200 @@ -266,7 +266,7 @@ def _run(self, cmd, *args, **kwargs): cmdline = self._cmdline(cmd, *args, **kwargs) - self.ui.debug(_('running: %s\n') % (cmdline,)) + self.ui.debug('running: %s\n' % (cmdline,)) self.prerun() try: return util.popen(cmdline) diff -r b3c13e721593 -r 53a95a744812 hgext/convert/cvs.py --- a/hgext/convert/cvs.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/convert/cvs.py Sun Oct 04 23:16:54 2009 +0200 @@ -38,8 +38,8 @@ self.lastbranch = {} self.parent = {} self.socket = None - self.cvsroot = file(os.path.join(cvs, "Root")).read()[:-1] - self.cvsrepo = file(os.path.join(cvs, "Repository")).read()[:-1] + self.cvsroot = open(os.path.join(cvs, "Root")).read()[:-1] + self.cvsrepo = open(os.path.join(cvs, "Repository")).read()[:-1] self.encoding = locale.getpreferredencoding() self._connect() diff -r b3c13e721593 -r 53a95a744812 hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/convert/cvsps.py Sun Oct 04 23:16:54 2009 +0200 @@ -12,13 +12,6 @@ from mercurial import util from mercurial.i18n import _ -def listsort(list, key): - "helper to sort by key in Python 2.3" - try: - list.sort(key=key) - except TypeError: - list.sort(lambda l, r: cmp(key(l), key(r))) - class logentry(object): '''Class logentry has the following attributes: .author - author name as CVS knows it @@ -130,7 +123,7 @@ # Get the real directory in the repository try: - prefix = file(os.path.join('CVS','Repository')).read().strip() + prefix = open(os.path.join('CVS','Repository')).read().strip() if prefix == ".": prefix = "" directory = prefix @@ -142,7 +135,7 @@ # Use the Root file in the sandbox, if it exists try: - root = file(os.path.join('CVS','Root')).read().strip() + root = open(os.path.join('CVS','Root')).read().strip() except IOError: pass @@ -175,7 +168,7 @@ if cache == 'update': try: ui.note(_('reading cvs log cache %s\n') % cachefile) - oldlog = pickle.load(file(cachefile)) + oldlog = pickle.load(open(cachefile)) ui.note(_('cache has %d log entries\n') % len(oldlog)) except Exception, e: ui.note(_('error reading cache: %r\n') % e) @@ -206,7 +199,7 @@ cmd = [util.shellquote(arg) for arg in cmd] ui.note(_("running %s\n") % (' '.join(cmd))) - ui.debug(_("prefix=%r directory=%r root=%r\n") % (prefix, directory, root)) + ui.debug("prefix=%r directory=%r root=%r\n" % (prefix, directory, root)) pfp = util.popen(' '.join(cmd)) peek = pfp.readline() @@ -385,7 +378,7 @@ e.revision[-1] == 1 and # 1.1 or 1.1.x.1 len(e.comment) == 1 and file_added_re.match(e.comment[0])): - ui.debug(_('found synthetic revision in %s: %r\n') + ui.debug('found synthetic revision in %s: %r\n' % (e.rcs, e.comment[0])) e.synthetic = True @@ -419,7 +412,7 @@ if len(log) % 100 == 0: ui.status(util.ellipsis('%d %s' % (len(log), e.file), 80)+'\n') - listsort(log, key=lambda x:(x.rcs, x.revision)) + log.sort(key=lambda x: (x.rcs, x.revision)) # find parent revisions of individual files versions = {} @@ -435,7 +428,7 @@ if cache: if log: # join up the old and new logs - listsort(log, key=lambda x:x.date) + log.sort(key=lambda x: x.date) if oldlog and oldlog[-1].date >= log[0].date: raise logerror('Log cache overlaps with new log entries,' @@ -445,7 +438,7 @@ # write the new cachefile ui.note(_('writing cvs log cache %s\n') % cachefile) - pickle.dump(log, file(cachefile, 'w')) + pickle.dump(log, open(cachefile, 'w')) else: log = oldlog @@ -484,7 +477,7 @@ # Merge changesets - listsort(log, key=lambda x:(x.comment, x.author, x.branch, x.date)) + log.sort(key=lambda x: (x.comment, x.author, x.branch, x.date)) changesets = [] files = set() diff -r b3c13e721593 -r 53a95a744812 hgext/convert/darcs.py --- a/hgext/convert/darcs.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/convert/darcs.py Sun Oct 04 23:16:54 2009 +0200 @@ -75,7 +75,7 @@ self.parents[child] = [] def after(self): - self.ui.debug(_('cleaning up %s\n') % self.tmppath) + self.ui.debug('cleaning up %s\n' % self.tmppath) shutil.rmtree(self.tmppath, ignore_errors=True) def xml(self, cmd, **kwargs): diff -r b3c13e721593 -r 53a95a744812 hgext/convert/gnuarch.py --- a/hgext/convert/gnuarch.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/convert/gnuarch.py Sun Oct 04 23:16:54 2009 +0200 @@ -125,7 +125,7 @@ break def after(self): - self.ui.debug(_('cleaning up %s\n') % self.tmppath) + self.ui.debug('cleaning up %s\n' % self.tmppath) shutil.rmtree(self.tmppath, ignore_errors=True) def getheads(self): @@ -195,7 +195,7 @@ return os.system(cmdline) def _update(self, rev): - self.ui.debug(_('applying revision %s...\n') % rev) + self.ui.debug('applying revision %s...\n' % rev) changeset, status = self.runlines('replay', '-d', self.tmppath, rev) if status: @@ -205,7 +205,7 @@ self._obtainrevision(rev) else: old_rev = self.parents[rev][0] - self.ui.debug(_('computing changeset between %s and %s...\n') + self.ui.debug('computing changeset between %s and %s...\n' % (old_rev, rev)) self._parsechangeset(changeset, rev) @@ -254,10 +254,10 @@ return changes, copies def _obtainrevision(self, rev): - self.ui.debug(_('obtaining revision %s...\n') % rev) + self.ui.debug('obtaining revision %s...\n' % rev) output = self._execute('get', rev, self.tmppath) self.checkexit(output) - self.ui.debug(_('analyzing revision %s...\n') % rev) + self.ui.debug('analyzing revision %s...\n' % rev) files = self._readcontents(self.tmppath) self.changes[rev].add_files += files @@ -284,7 +284,7 @@ self.changes[rev].summary = self.recode(self.changes[rev].summary) # Commit revision origin when dealing with a branch or tag - if catlog.has_key('Continuation-of'): + if 'Continuation-of' in catlog: self.changes[rev].continuationof = self.recode(catlog['Continuation-of']) except Exception: raise util.Abort(_('could not parse cat-log of %s') % rev) diff -r b3c13e721593 -r 53a95a744812 hgext/convert/hg.py --- a/hgext/convert/hg.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/convert/hg.py Sun Oct 04 23:16:54 2009 +0200 @@ -55,12 +55,12 @@ self.filemapmode = False def before(self): - self.ui.debug(_('run hg sink pre-conversion action\n')) + self.ui.debug('run hg sink pre-conversion action\n') self.wlock = self.repo.wlock() self.lock = self.repo.lock() def after(self): - self.ui.debug(_('run hg sink post-conversion action\n')) + self.ui.debug('run hg sink post-conversion action\n') self.lock.release() self.wlock.release() @@ -183,7 +183,7 @@ tagparent = nullid try: - oldlines = sorted(parentctx['.hgtags'].data().splitlines(1)) + oldlines = sorted(parentctx['.hgtags'].data().splitlines(True)) except: oldlines = [] @@ -348,10 +348,10 @@ self.convertfp.flush() def before(self): - self.ui.debug(_('run hg source pre-conversion action\n')) + self.ui.debug('run hg source pre-conversion action\n') def after(self): - self.ui.debug(_('run hg source post-conversion action\n')) + self.ui.debug('run hg source post-conversion action\n') def hasnativeorder(self): return True diff -r b3c13e721593 -r 53a95a744812 hgext/convert/p4.py --- a/hgext/convert/p4.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/convert/p4.py Sun Oct 04 23:16:54 2009 +0200 @@ -92,7 +92,7 @@ # list with depot pathnames, longest first vieworder = views.keys() - vieworder.sort(key=lambda x: -len(x)) + vieworder.sort(key=len, reverse=True) # handle revision limiting startrev = self.ui.config('convert', 'p4.startrev', default=0) diff -r b3c13e721593 -r 53a95a744812 hgext/convert/subversion.py --- a/hgext/convert/subversion.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/convert/subversion.py Sun Oct 04 23:16:54 2009 +0200 @@ -2,7 +2,6 @@ # # Copyright(C) 2007 Daniel Holth et al -import locale import os import re import sys @@ -23,6 +22,7 @@ from common import commandline, converter_source, converter_sink, mapfile try: + raise ImportError("SVN support disabled due to license incompatibility") from svn.core import SubversionException, Pool import svn import svn.client @@ -153,11 +153,13 @@ def issvnurl(url): try: proto, path = url.split('://', 1) - path = urllib.url2pathname(path) + if proto == 'file': + path = urllib.url2pathname(path) except ValueError: proto = 'file' path = os.path.abspath(url) - path = path.replace(os.sep, '/') + if proto == 'file': + path = path.replace(os.sep, '/') check = protomap.get(proto, lambda p, p2: False) while '/' in path: if check(path, proto): @@ -312,7 +314,7 @@ self.module += '/' + trunk self.head = self.latest(self.module, self.last_changed) if not self.head: - raise util.Abort(_('no revision found in module %s') + raise util.Abort(_('no revision found in module %s') % self.module) # First head in the list is the module's head @@ -455,8 +457,8 @@ # Here/tags/tag.1 discarded as well as its children. # It happens with tools like cvs2svn. Such tags cannot # be represented in mercurial. - addeds = dict((p, e.copyfrom_path) for p, e - in origpaths.iteritems() + addeds = dict((p, e.copyfrom_path) for p, e + in origpaths.iteritems() if e.action == 'A' and e.copyfrom_path) badroots = set() for destroot in addeds: @@ -532,7 +534,7 @@ """ if not path.startswith(self.rootmodule): # Requests on foreign branches may be forbidden at server level - self.ui.debug(_('ignoring foreign branch %r\n') % path) + self.ui.debug('ignoring foreign branch %r\n' % path) return None if not stop: @@ -560,7 +562,7 @@ if not path.startswith(p) or not paths[p].copyfrom_path: continue newpath = paths[p].copyfrom_path + path[len(p):] - self.ui.debug(_("branch renamed from %s to %s at %d\n") % + self.ui.debug("branch renamed from %s to %s at %d\n" % (path, newpath, revnum)) path = newpath break @@ -568,7 +570,7 @@ stream.close() if not path.startswith(self.rootmodule): - self.ui.debug(_('ignoring foreign branch %r\n') % path) + self.ui.debug('ignoring foreign branch %r\n' % path) return None return self.revid(dirent.created_rev, path) @@ -580,7 +582,7 @@ prevmodule = self.prevmodule if prevmodule is None: prevmodule = '' - self.ui.debug(_("reparent to %s\n") % svnurl) + self.ui.debug("reparent to %s\n" % svnurl) svn.ra.reparent(self.ra, svnurl) self.prevmodule = module return prevmodule @@ -613,14 +615,14 @@ copyfrom_path = self.getrelpath(ent.copyfrom_path, pmodule) if not copyfrom_path: continue - self.ui.debug(_("copied to %s from %s@%s\n") % + self.ui.debug("copied to %s from %s@%s\n" % (entrypath, copyfrom_path, ent.copyfrom_rev)) copies[self.recode(entrypath)] = self.recode(copyfrom_path) elif kind == 0: # gone, but had better be a deleted *file* - self.ui.debug(_("gone from %s\n") % ent.copyfrom_rev) + self.ui.debug("gone from %s\n" % ent.copyfrom_rev) pmodule, prevnum = self.revsplit(parents[0])[1:] parentpath = pmodule + "/" + entrypath - self.ui.debug(_("entry %s\n") % parentpath) + self.ui.debug("entry %s\n" % parentpath) # We can avoid the reparent calls if the module has # not changed but it probably does not worth the pain. @@ -647,7 +649,7 @@ del copies[childpath] entries.append(childpath) else: - self.ui.debug(_('unknown path in revision %d: %s\n') % \ + self.ui.debug('unknown path in revision %d: %s\n' % \ (revnum, path)) elif kind == svn.core.svn_node_dir: # If the directory just had a prop change, @@ -680,7 +682,7 @@ if not copyfrompath: continue copyfrom[path] = ent - self.ui.debug(_("mark %s came from %s:%d\n") + self.ui.debug("mark %s came from %s:%d\n" % (path, copyfrompath, ent.copyfrom_rev)) children = self._find_children(ent.copyfrom_path, ent.copyfrom_rev) children.sort() @@ -704,7 +706,7 @@ """Return the parsed commit object or None, and True if the revision is a branch root. """ - self.ui.debug(_("parsing revision %d (%d changes)\n") % + self.ui.debug("parsing revision %d (%d changes)\n" % (revnum, len(orig_paths))) branched = False @@ -733,7 +735,7 @@ self.ui.note(_('found parent of branch %s at %d: %s\n') % (self.module, prevnum, prevmodule)) else: - self.ui.debug(_("no copyfrom path, don't know what to do.\n")) + self.ui.debug("no copyfrom path, don't know what to do.\n") paths = [] # filter out unrelated paths @@ -786,7 +788,7 @@ lastonbranch = True break if not paths: - self.ui.debug(_('revision %d has no entries\n') % revnum) + self.ui.debug('revision %d has no entries\n' % revnum) continue cset, lastonbranch = parselogentry(paths, revnum, author, date, message) @@ -868,7 +870,7 @@ return relative # The path is outside our tracked tree... - self.ui.debug(_('%r is not under %r, ignoring\n') % (path, module)) + self.ui.debug('%r is not under %r, ignoring\n' % (path, module)) return None def _checkpath(self, path, revnum): diff -r b3c13e721593 -r 53a95a744812 hgext/extdiff.py --- a/hgext/extdiff.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/extdiff.py Sun Oct 04 23:16:54 2009 +0200 @@ -7,14 +7,14 @@ '''command to allow external programs to compare revisions -The `extdiff' Mercurial extension allows you to use external programs -to compare revisions, or revision with working directory. The external diff -programs are called with a configurable set of options and two +The extdiff Mercurial extension allows you to use external programs +to compare revisions, or revision with working directory. The external +diff programs are called with a configurable set of options and two non-option arguments: paths to directories containing snapshots of files to compare. -The `extdiff' extension also allows to configure new diff commands, so -you do not need to type "hg extdiff -p kdiff3" always. +The extdiff extension also allows to configure new diff commands, so +you do not need to type "hg extdiff -p kdiff3" always. :: [extdiff] # add new command that runs GNU diff(1) in 'context diff' mode @@ -30,21 +30,21 @@ meld = # add new command called vimdiff, runs gvimdiff with DirDiff plugin - # (see http://www.vim.org/scripts/script.php?script_id=102) - # Non English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in + # (see http://www.vim.org/scripts/script.php?script_id=102) Non + # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in # your .vimrc vimdiff = gvim -f '+next' '+execute "DirDiff" argv(0) argv(1)' You can use -I/-X and list of file or directory names like normal "hg -diff" command. The `extdiff' extension makes snapshots of only needed +diff" command. The extdiff extension makes snapshots of only needed files, so running the external diff program will actually be pretty fast (at least faster than having to compare the entire tree). ''' from mercurial.i18n import _ -from mercurial.node import short +from mercurial.node import short, nullid from mercurial import cmdutil, util, commands -import os, shlex, shutil, tempfile +import os, shlex, shutil, tempfile, re def snapshot(ui, repo, files, node, tmproot): '''snapshot files as of some revision @@ -69,7 +69,7 @@ for fn in files: wfn = util.pconvert(fn) if not wfn in ctx: - # skipping new file after a merge ? + # File doesn't exist; could be a bogus modify continue ui.note(' %s\n' % wfn) dest = os.path.join(base, wfn) @@ -96,59 +96,102 @@ revs = opts.get('rev') change = opts.get('change') + args = ' '.join(diffopts) + do3way = '$parent2' in args if revs and change: msg = _('cannot specify --rev and --change at the same time') raise util.Abort(msg) elif change: node2 = repo.lookup(change) - node1 = repo[node2].parents()[0].node() + node1a, node1b = repo.changelog.parents(node2) else: - node1, node2 = cmdutil.revpair(repo, revs) + node1a, node2 = cmdutil.revpair(repo, revs) + if not revs: + node1b = repo.dirstate.parents()[1] + else: + node1b = nullid + + # Disable 3-way merge if there is only one parent + if do3way: + if node1b == nullid: + do3way = False matcher = cmdutil.match(repo, pats, opts) - modified, added, removed = repo.status(node1, node2, matcher)[:3] - if not (modified or added or removed): - return 0 + mod_a, add_a, rem_a = map(set, repo.status(node1a, node2, matcher)[:3]) + if do3way: + mod_b, add_b, rem_b = map(set, repo.status(node1b, node2, matcher)[:3]) + else: + mod_b, add_b, rem_b = set(), set(), set() + modadd = mod_a | add_a | mod_b | add_b + common = modadd | rem_a | rem_b + if not common: + return 0 tmproot = tempfile.mkdtemp(prefix='extdiff.') - dir2root = '' try: - # Always make a copy of node1 - dir1 = snapshot(ui, repo, modified + removed, node1, tmproot)[0] - changes = len(modified) + len(removed) + len(added) + # Always make a copy of node1a (and node1b, if applicable) + dir1a_files = mod_a | rem_a | ((mod_b | add_b) - add_a) + dir1a = snapshot(ui, repo, dir1a_files, node1a, tmproot)[0] + if do3way: + dir1b_files = mod_b | rem_b | ((mod_a | add_a) - add_b) + dir1b = snapshot(ui, repo, dir1b_files, node1b, tmproot)[0] + else: + dir1b = None + + fns_and_mtime = [] # If node2 in not the wc or there is >1 change, copy it - if node2 or changes > 1: - dir2, fns_and_mtime = snapshot(ui, repo, modified + added, node2, tmproot) + dir2root = '' + if node2: + dir2 = snapshot(ui, repo, modadd, node2, tmproot)[0] + elif len(common) > 1: + #we only actually need to get the files to copy back to the working + #dir in this case (because the other cases are: diffing 2 revisions + #or single file -- in which case the file is already directly passed + #to the diff tool). + dir2, fns_and_mtime = snapshot(ui, repo, modadd, None, tmproot) else: # This lets the diff tool open the changed file directly dir2 = '' dir2root = repo.root - fns_and_mtime = [] # If only one change, diff the files instead of the directories - if changes == 1 : - if len(modified): - dir1 = os.path.join(dir1, util.localpath(modified[0])) - dir2 = os.path.join(dir2root, dir2, util.localpath(modified[0])) - elif len(removed) : - dir1 = os.path.join(dir1, util.localpath(removed[0])) - dir2 = os.devnull - else: - dir1 = os.devnull - dir2 = os.path.join(dir2root, dir2, util.localpath(added[0])) + # Handle bogus modifies correctly by checking if the files exist + if len(common) == 1: + common_file = util.localpath(common.pop()) + dir1a = os.path.join(dir1a, common_file) + if not os.path.isfile(os.path.join(tmproot, dir1a)): + dir1a = os.devnull + if do3way: + dir1b = os.path.join(dir1b, common_file) + if not os.path.isfile(os.path.join(tmproot, dir1b)): + dir1b = os.devnull + dir2 = os.path.join(dir2root, dir2, common_file) - cmdline = ('%s %s %s %s' % - (util.shellquote(diffcmd), ' '.join(diffopts), - util.shellquote(dir1), util.shellquote(dir2))) - ui.debug(_('running %r in %s\n') % (cmdline, tmproot)) + # Function to quote file/dir names in the argument string + # When not operating in 3-way mode, an empty string is returned for parent2 + replace = dict(parent=dir1a, parent1=dir1a, parent2=dir1b, child=dir2) + def quote(match): + key = match.group()[1:] + if not do3way and key == 'parent2': + return '' + return util.shellquote(replace[key]) + + # Match parent2 first, so 'parent1?' will match both parent1 and parent + regex = '\$(parent2|parent1?|child)' + if not do3way and not re.search(regex, args): + args += ' $parent1 $child' + args = re.sub(regex, quote, args) + cmdline = util.shellquote(diffcmd) + ' ' + args + + ui.debug('running %r in %s\n' % (cmdline, tmproot)) util.system(cmdline, cwd=tmproot) for copy_fn, working_fn, mtime in fns_and_mtime: if os.path.getmtime(copy_fn) != mtime: - ui.debug(_('file changed while diffing. ' - 'Overwriting: %s (src: %s)\n') % (working_fn, copy_fn)) + ui.debug('file changed while diffing. ' + 'Overwriting: %s (src: %s)\n' % (working_fn, copy_fn)) util.copyfile(copy_fn, working_fn) return 1 @@ -173,11 +216,11 @@ that revision is compared to the working directory, and, when no revisions are specified, the working directory files are compared to its parent.''' - program = opts['program'] or 'diff' - if opts['program']: - option = opts['option'] - else: - option = opts['option'] or ['-Npru'] + program = opts.get('program') + option = opts.get('option') + if not program: + program = 'diff' + option = option or ['-Npru'] return dodiff(ui, repo, program, option, pats, opts) cmdtable = { @@ -211,18 +254,17 @@ '''use closure to save diff command to use''' def mydiff(ui, repo, *pats, **opts): return dodiff(ui, repo, path, diffopts, pats, opts) - mydiff.__doc__ = '''use %(path)s to diff repository (or selected files) + mydiff.__doc__ = _('''\ +use %(path)s to diff repository (or selected files) - Show differences between revisions for the specified - files, using the %(path)s program. + Show differences between revisions for the specified files, using the + %(path)s program. - When two revision arguments are given, then changes are - shown between those revisions. If only one revision is - specified then that revision is compared to the working - directory, and, when no revisions are specified, the - working directory files are compared to its parent.''' % { - 'path': util.uirepr(path), - } + When two revision arguments are given, then changes are shown between + those revisions. If only one revision is specified then that revision is + compared to the working directory, and, when no revisions are specified, + the working directory files are compared to its parent.\ +''') % dict(path=util.uirepr(path)) return mydiff cmdtable[cmd] = (save(cmd, path, diffopts), cmdtable['extdiff'][1][1:], diff -r b3c13e721593 -r 53a95a744812 hgext/fetch.py diff -r b3c13e721593 -r 53a95a744812 hgext/graphlog.py --- a/hgext/graphlog.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/graphlog.py Sun Oct 04 23:16:54 2009 +0200 @@ -22,48 +22,31 @@ ASCIIDATA = 'ASC' -def asciiformat(ui, repo, revdag, opts, parentrepo=None): - """formats a changelog DAG walk for ASCII output""" - if parentrepo is None: - parentrepo = repo - showparents = [ctx.node() for ctx in parentrepo[None].parents()] - displayer = show_changeset(ui, repo, opts, buffered=True) - for (id, type, ctx, parentids) in revdag: - if type != graphmod.CHANGESET: - continue - displayer.show(ctx) - lines = displayer.hunk.pop(ctx.rev()).split('\n')[:-1] - char = ctx.node() in showparents and '@' or 'o' - yield (id, ASCIIDATA, (char, lines), parentids) - -def asciiedges(nodes): +def asciiedges(seen, rev, parents): """adds edge info to changelog DAG walk suitable for ascii()""" - seen = [] - for node, type, data, parents in nodes: - if node not in seen: - seen.append(node) - nodeidx = seen.index(node) + if rev not in seen: + seen.append(rev) + nodeidx = seen.index(rev) + + knownparents = [] + newparents = [] + for parent in parents: + if parent in seen: + knownparents.append(parent) + else: + newparents.append(parent) - knownparents = [] - newparents = [] - for parent in parents: - if parent in seen: - knownparents.append(parent) - else: - newparents.append(parent) + ncols = len(seen) + seen[nodeidx:nodeidx + 1] = newparents + edges = [(nodeidx, seen.index(p)) for p in knownparents] - ncols = len(seen) - nextseen = seen[:] - nextseen[nodeidx:nodeidx + 1] = newparents - edges = [(nodeidx, nextseen.index(p)) for p in knownparents] + if len(newparents) > 0: + edges.append((nodeidx, nodeidx)) + if len(newparents) > 1: + edges.append((nodeidx, nodeidx + 1)) - if len(newparents) > 0: - edges.append((nodeidx, nodeidx)) - if len(newparents) > 1: - edges.append((nodeidx, nodeidx + 1)) - nmorecols = len(nextseen) - ncols - seen = nextseen - yield (nodeidx, type, data, edges, ncols, nmorecols) + nmorecols = len(seen) - ncols + return nodeidx, edges, ncols, nmorecols def fix_long_right_edges(edges): for (i, (start, end)) in enumerate(edges): @@ -95,7 +78,7 @@ else: nodeline[2 * end] = "+" if start > end: - (start, end) = (end,start) + (start, end) = (end, start) for i in range(2 * start + 1, 2 * end): if nodeline[i] != "+": nodeline[i] = "-" @@ -117,11 +100,13 @@ line.extend(["|", " "] * (n_columns - ni - 1)) return line -def ascii(ui, dag): +def ascii(ui, base, type, char, text, coldata): """prints an ASCII graph of the DAG - dag is a generator that emits tuples with the following elements: + takes the following arguments (one call per node in the graph): + - ui to write to + - A list we can keep the needed state in - Column of the current node in the set of ongoing edges. - Type indicator of node data == ASCIIDATA. - Payload: (char, lines): @@ -135,91 +120,87 @@ in the current revision. That is: -1 means one column removed; 0 means no columns added or removed; 1 means one column added. """ - prev_n_columns_diff = 0 - prev_node_index = 0 - for (node_index, type, (node_ch, node_lines), edges, n_columns, n_columns_diff) in dag: - assert -2 < n_columns_diff < 2 - if n_columns_diff == -1: - # Transform - # - # | | | | | | - # o | | into o---+ - # |X / |/ / - # | | | | - fix_long_right_edges(edges) - - # add_padding_line says whether to rewrite + idx, edges, ncols, coldiff = coldata + assert -2 < coldiff < 2 + if coldiff == -1: + # Transform # - # | | | | | | | | - # | o---+ into | o---+ - # | / / | | | # <--- padding line - # o | | | / / - # o | | - add_padding_line = (len(node_lines) > 2 and - n_columns_diff == -1 and - [x for (x, y) in edges if x + 1 < y]) + # | | | | | | + # o | | into o---+ + # |X / |/ / + # | | | | + fix_long_right_edges(edges) + + # add_padding_line says whether to rewrite + # + # | | | | | | | | + # | o---+ into | o---+ + # | / / | | | # <--- padding line + # o | | | / / + # o | | + add_padding_line = (len(text) > 2 and coldiff == -1 and + [x for (x, y) in edges if x + 1 < y]) - # fix_nodeline_tail says whether to rewrite - # - # | | o | | | | o | | - # | | |/ / | | |/ / - # | o | | into | o / / # <--- fixed nodeline tail - # | |/ / | |/ / - # o | | o | | - fix_nodeline_tail = len(node_lines) <= 2 and not add_padding_line + # fix_nodeline_tail says whether to rewrite + # + # | | o | | | | o | | + # | | |/ / | | |/ / + # | o | | into | o / / # <--- fixed nodeline tail + # | |/ / | |/ / + # o | | o | | + fix_nodeline_tail = len(text) <= 2 and not add_padding_line - # nodeline is the line containing the node character (typically o) - nodeline = ["|", " "] * node_index - nodeline.extend([node_ch, " "]) + # nodeline is the line containing the node character (typically o) + nodeline = ["|", " "] * idx + nodeline.extend([char, " "]) - nodeline.extend( - get_nodeline_edges_tail( - node_index, prev_node_index, n_columns, n_columns_diff, - prev_n_columns_diff, fix_nodeline_tail)) + nodeline.extend( + get_nodeline_edges_tail(idx, base[1], ncols, coldiff, + base[0], fix_nodeline_tail)) - # shift_interline is the line containing the non-vertical - # edges between this entry and the next - shift_interline = ["|", " "] * node_index - if n_columns_diff == -1: - n_spaces = 1 - edge_ch = "/" - elif n_columns_diff == 0: - n_spaces = 2 - edge_ch = "|" - else: - n_spaces = 3 - edge_ch = "\\" - shift_interline.extend(n_spaces * [" "]) - shift_interline.extend([edge_ch, " "] * (n_columns - node_index - 1)) + # shift_interline is the line containing the non-vertical + # edges between this entry and the next + shift_interline = ["|", " "] * idx + if coldiff == -1: + n_spaces = 1 + edge_ch = "/" + elif coldiff == 0: + n_spaces = 2 + edge_ch = "|" + else: + n_spaces = 3 + edge_ch = "\\" + shift_interline.extend(n_spaces * [" "]) + shift_interline.extend([edge_ch, " "] * (ncols - idx - 1)) - # draw edges from the current node to its parents - draw_edges(edges, nodeline, shift_interline) + # draw edges from the current node to its parents + draw_edges(edges, nodeline, shift_interline) - # lines is the list of all graph lines to print - lines = [nodeline] - if add_padding_line: - lines.append(get_padding_line(node_index, n_columns, edges)) - lines.append(shift_interline) + # lines is the list of all graph lines to print + lines = [nodeline] + if add_padding_line: + lines.append(get_padding_line(idx, ncols, edges)) + lines.append(shift_interline) - # make sure that there are as many graph lines as there are - # log strings - while len(node_lines) < len(lines): - node_lines.append("") - if len(lines) < len(node_lines): - extra_interline = ["|", " "] * (n_columns + n_columns_diff) - while len(lines) < len(node_lines): - lines.append(extra_interline) + # make sure that there are as many graph lines as there are + # log strings + while len(text) < len(lines): + text.append("") + if len(lines) < len(text): + extra_interline = ["|", " "] * (ncols + coldiff) + while len(lines) < len(text): + lines.append(extra_interline) - # print lines - indentation_level = max(n_columns, n_columns + n_columns_diff) - for (line, logstr) in zip(lines, node_lines): - ln = "%-*s %s" % (2 * indentation_level, "".join(line), logstr) - ui.write(ln.rstrip() + '\n') + # print lines + indentation_level = max(ncols, ncols + coldiff) + for (line, logstr) in zip(lines, text): + ln = "%-*s %s" % (2 * indentation_level, "".join(line), logstr) + ui.write(ln.rstrip() + '\n') - # ... and start over - prev_node_index = node_index - prev_n_columns_diff = n_columns_diff + # ... and start over + base[0] = coldiff + base[1] = idx def get_revs(repo, rev_opt): if rev_opt: @@ -235,6 +216,14 @@ if op in opts and opts[op]: raise util.Abort(_("--graph option is incompatible with --%s") % op) +def generate(ui, dag, displayer, showparents, edgefn): + seen, base = [], [0, 0] + for rev, type, ctx, parents in dag: + char = ctx.node() in showparents and '@' or 'o' + displayer.show(ctx) + lines = displayer.hunk.pop(rev).split('\n')[:-1] + ascii(ui, base, type, char, lines, edgefn(seen, rev, parents)) + def graphlog(ui, repo, path=None, **opts): """show revision history alongside an ASCII revision graph @@ -259,8 +248,9 @@ else: revdag = graphmod.revisions(repo, start, stop) - fmtdag = asciiformat(ui, repo, revdag, opts) - ascii(ui, asciiedges(fmtdag)) + displayer = show_changeset(ui, repo, opts, buffered=True) + showparents = [ctx.node() for ctx in repo[None].parents()] + generate(ui, revdag, displayer, showparents, asciiedges) def graphrevs(repo, nodes, opts): limit = cmdutil.loglimit(opts) @@ -294,8 +284,9 @@ o = repo.changelog.nodesbetween(o, revs)[0] revdag = graphrevs(repo, o, opts) - fmtdag = asciiformat(ui, repo, revdag, opts) - ascii(ui, asciiedges(fmtdag)) + displayer = show_changeset(ui, repo, opts, buffered=True) + showparents = [ctx.node() for ctx in repo[None].parents()] + generate(ui, revdag, displayer, showparents, asciiedges) def gincoming(ui, repo, source="default", **opts): """show the incoming changesets alongside an ASCII revision graph @@ -343,8 +334,9 @@ chlist = other.changelog.nodesbetween(incoming, revs)[0] revdag = graphrevs(other, chlist, opts) - fmtdag = asciiformat(ui, other, revdag, opts, parentrepo=repo) - ascii(ui, asciiedges(fmtdag)) + displayer = show_changeset(ui, other, opts, buffered=True) + showparents = [ctx.node() for ctx in repo[None].parents()] + generate(ui, revdag, displayer, showparents, asciiedges) finally: if hasattr(other, 'close'): diff -r b3c13e721593 -r 53a95a744812 hgext/hgcia.py --- a/hgext/hgcia.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/hgcia.py Sun Oct 04 23:16:54 2009 +0200 @@ -3,38 +3,38 @@ """hooks for integrating with the CIA.vc notification service -This is meant to be run as a changegroup or incoming hook. -To configure it, set the following options in your hgrc: +This is meant to be run as a changegroup or incoming hook. To +configure it, set the following options in your hgrc:: -[cia] -# your registered CIA user name -user = foo -# the name of the project in CIA -project = foo -# the module (subproject) (optional) -#module = foo -# Append a diffstat to the log message (optional) -#diffstat = False -# Template to use for log messages (optional) -#template = {desc}\\n{baseurl}/rev/{node}-- {diffstat} -# Style to use (optional) -#style = foo -# The URL of the CIA notification service (optional) -# You can use mailto: URLs to send by email, eg -# mailto:cia@cia.vc -# Make sure to set email.from if you do this. -#url = http://cia.vc/ -# print message instead of sending it (optional) -#test = False + [cia] + # your registered CIA user name + user = foo + # the name of the project in CIA + project = foo + # the module (subproject) (optional) + #module = foo + # Append a diffstat to the log message (optional) + #diffstat = False + # Template to use for log messages (optional) + #template = {desc}\\n{baseurl}/rev/{node}-- {diffstat} + # Style to use (optional) + #style = foo + # The URL of the CIA notification service (optional) + # You can use mailto: URLs to send by email, eg + # mailto:cia@cia.vc + # Make sure to set email.from if you do this. + #url = http://cia.vc/ + # print message instead of sending it (optional) + #test = False -[hooks] -# one of these: -changegroup.cia = python:hgcia.hook -#incoming.cia = python:hgcia.hook + [hooks] + # one of these: + changegroup.cia = python:hgcia.hook + #incoming.cia = python:hgcia.hook -[web] -# If you want hyperlinks (optional) -baseurl = http://server/path/to/repo + [web] + # If you want hyperlinks (optional) + baseurl = http://server/path/to/repo """ from mercurial.i18n import _ @@ -205,7 +205,7 @@ msg['From'] = self.emailfrom msg['Subject'] = 'DeliverXML' msg['Content-type'] = 'text/xml' - msgtext = msg.as_string(0) + msgtext = msg.as_string() self.ui.status(_('hgcia: sending update to %s\n') % address) mail.sendmail(self.ui, util.email(self.emailfrom), @@ -229,10 +229,10 @@ n = bin(node) cia = hgcia(ui, repo) if not cia.user: - ui.debug(_('cia: no user specified')) + ui.debug('cia: no user specified') return if not cia.project: - ui.debug(_('cia: no project specified')) + ui.debug('cia: no project specified') return if hooktype == 'changegroup': start = repo.changelog.rev(n) diff -r b3c13e721593 -r 53a95a744812 hgext/hgk.py --- a/hgext/hgk.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/hgk.py Sun Oct 04 23:16:54 2009 +0200 @@ -19,19 +19,20 @@ The hg view command will launch the hgk Tcl script. For this command to work, hgk must be in your search path. Alternately, you can specify -the path to hgk in your .hgrc file: +the path to hgk in your .hgrc file:: [hgk] path=/location/of/hgk hgk can make use of the extdiff extension to visualize revisions. -Assuming you had already configured extdiff vdiff command, just add: +Assuming you had already configured extdiff vdiff command, just add:: [hgk] vdiff=vdiff Revisions context menu will now display additional entries to fire -vdiff on hovered and selected revisions.''' +vdiff on hovered and selected revisions. +''' import os from mercurial import commands, util, patch, revlog, cmdutil @@ -307,7 +308,7 @@ os.chdir(repo.root) optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems() if v]) cmd = ui.config("hgk", "path", "hgk") + " %s %s" % (optstr, " ".join(etc)) - ui.debug(_("running %s\n") % cmd) + ui.debug("running %s\n" % cmd) util.system(cmd) cmdtable = { diff -r b3c13e721593 -r 53a95a744812 hgext/highlight/__init__.py --- a/hgext/highlight/__init__.py Sun Oct 04 23:06:14 2009 +0200 +++ b/hgext/highlight/__init__.py Sun Oct 04 23:16:54 2009 +0200 @@ -13,10 +13,10 @@ It depends on the Pygments syntax highlighting library: http://pygments.org/ -There is a single configuration option: +There is a single configuration option:: -[web] -pygments_style =