Mercurial > hgbook
changeset 706:0e33dd5d8288
Automated merge with ssh://ssh.serpentine.com/hg/share/mercurial/book
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Tue, 31 Mar 2009 08:58:45 -0700 |
parents | 88b611f37646 (diff) 1735c9699f92 (current diff) |
children | c17f8bffc9e5 |
files | |
diffstat | 9 files changed, 37 insertions(+), 297 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Tue Mar 31 08:58:45 2009 -0700 @@ -0,0 +1,16 @@ +Mercurial: The Definitive Guide +------------------------------- + +Welcome to the source code for the book. You can clone the definitive +copy of the source tree using Mercurial as follows: + + hg clone http://hg.serpentine.com/mercurial/book + +Here's a top-level tour of interesting directories: + +en English-language content +es Spanish-language content +examples Miscellaneous example scripts +tools Old, largely unused conversion scripts +web Content and comment system for http://hgbook.red-bean.com/ +xsl XSLT scripts for generating HTML
--- a/html/index.en.html Tue Mar 31 08:58:25 2009 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" -"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html lang="en"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <link rel="icon" href="/hgicon.png" type="image/png"> - <meta name="robots" content="index,follow"> - <title>Distributed revision control with Mercurial</title> - </head> - - <body> - <h1>Distributed revision control with Mercurial</h1> - - <p>Welcome to the home of the book “Distributed revision - control with Mercurial”, by <a - href="http://www.serpentine.com/blog/">Bryan O'Sullivan</a>. - This is a <a href="hgbookap4.html">freely licensed</a> book - about the <a - href="http://www.selenic.com/mercurial">Mercurial</a> revision - control system.</p> - - <ul> - <li>The <a href="hgbook.html">HTML version</a> is split into one - web page per chapter.</li> - <li>The <a href="hgbook.pdf">PDF version</a> is a single 1.3 - megabyte file.</li> - <li>The <a href="http://hg.serpentine.com/mercurial/book">source - code</a> is available to the adventurous.</li> - </ul> - - <h2>How you can help Mercurial, and help free software</h2> - - <p>Mercurial is a member of the <a - href="http://conservancy.softwarefreedom.org/">Software - Freedom Conservancy</a>, a wonderful non-profit - organisation that offers its member projects legal and - administrative advice. The SFC can accept <a - href="http://conservancy.softwarefreedom.org/?donate">accept - donations</a> (tax-free under IRS 501(c)(3), within the United - States) on behalf of its member projects. If you would like to - support Mercurial directly, please consider making a donation to - the SFC on its behalf.</p> - - <p>If you would like to help free software developers to provide - their important public services without being impeded by legal - issues, please consider donating to the SFC's sister - organisation, the <a - href="http://www.softwarefreedom.org/">Software Freedom Law - Center</a>.</p> - </body> -</html>
--- a/html/index.es.html Tue Mar 31 08:58:25 2009 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" -"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html lang="es"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <link rel="icon" href="/hgicon.png" type="image/png"> - <meta name="robots" content="index,follow"> - <title>Control Distribuido de Revisiones con Mercurial</title> - </head> - - <body> - <h1>Control Distribuido de Revisiones con Mercurial</h1> - - <p>Bienvenido al sito del libro “Control Distribuido de Revisiones con Mercurial”, en español, - por <a href="http://www.serpentine.com/blog/">Bryan O'Sullivan</a>. - Este libro está cobijado por una <a href="hgbookap4.html">licencia abierta</a> - y trata del sistema de control de revisiones - <a href="http://www.selenic.com/mercurial">Mercurial</a>. - - <p>Los traductores son <a href="http://devnull.li/~jerojasro/blog/">Javier Rojas</a> e - <a href="http://igor.tamarapatino.org/">Igor Támara</a>. En este sitio usted puede encontrar: - <ul> - <li>La <a href="onepage.html">versión HTML</a> una sola página.</li> - <li>La <a href="hgbook.pdf">versión PDF</a> (1.9 megabytes.)</li> - <li>El <a href="http://mercurial.intuxication.org/hg/mercurial_book_es/">código - fuente</a> de la traducción, si desea revisarla o colaborar con el proyecto. En - <a href="http://hg.serpentine.com/mercurial/book">este sitio</a> puede - encontrar la versión original en inglés.</li> - </ul> - Para más detalles acerca del proceso de traducción, por favor vea <a - href="http://mercurial.intuxication.org/hg/mercurial_book_es/file/tip/es/Leame.1st">este - fichero</a>. - - <h2>¿Cómo puede usted ayudar a Mercurial, y el software libre?</h2> - - <p>Mercurial es miembro del <a - href="http://conservancy.softwarefreedom.org/">Conservatorio - de Software Libre</a>, una maravillosa organización sin ánimo - de lucro que ofrece a sus proyectos miembros consejo legal y - administrativo. La SFC acepta <a href="http://conservancy.softwarefreedom.org/?donate">donaciones</a> - (deducibles de impuestos bajo IRS 501(c)(3), dentro de los Estados Unidos) - en representación de sus proyectos miembros. Si desea dar un apoyo - directo a Mercurial, por favor considere hacer una donación a SFC - en su representación.</p> - - <p>Si desea apoyar a los desarrolladores de software libre en su - importante servicio público sin estar impedido por cuestiones - legales, por favor considere donar a la organización hermana de - SFC, el <a - href="http://www.softwarefreedom.org/">Centro de Leyes de Software - Libre</a>.</p> - </body> -</html>
--- a/html/index.html.var Tue Mar 31 08:58:25 2009 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -URI: index.en.html -Content-Language: en -Content-Type: text/html; charset=UTF-8 - -URI: index.es.html -Content-Language: es -Content-Type: text/html; charset=UTF-8
--- a/sillybench/sillybench.py Tue Mar 31 08:58:25 2009 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -#!/usr/bin/python -# -# Silly benchmarking program, to give a vague idea of how fast a few -# tools are on a handful of common operations. -# -# Use a fairly big and real source tarball to test with: Firefox -# 2.0.0.3 (37622 files, 5374 directories, 343MB unpacked onto -# 4KB-blocksize ext3). - -import csv -import os -import shutil -import sys -import tempfile -import time -import urllib2 - -url = 'ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/2.0.0.3/source/firefox-2.0.0.3-source.tar.bz2' - -class CommandFailure(Exception): - pass - -class rcs(object): - def __init__(self): - self.logfp = open(self.__class__.__name__ + '.csv', 'w') - self.csv = csv.writer(self.logfp) - - def download(self): - name = url[url.rfind('/')+1:] - path = os.path.join(os.environ['HOME'], name) - if not os.path.isfile(path): - ofp = open(path + '.part', 'wb') - try: - ifp = urllib2.urlopen(url) - nbytes = ifp.info()['content-length'] - sys.stdout.write('%s: %s bytes ' % (name, nbytes)) - sys.stdout.flush() - while True: - data = ifp.read(131072) - if not data: break - sys.stdout.write('.') - sys.stdout.flush() - ofp.write(data) - del ofp - os.rename(path + '.part', path) - except: - if os.path.exists(path + '.part'): - os.unlink(path + '.part') - if os.path.exists(path): - os.unlink(path) - raise - return path - - def run(self, args, mustsucceed=True): - ret = os.spawnvp(os.P_WAIT, args[0], args) - if ret < 0: - msg = 'killed by signal %d' % (-ret) - if ret > 0: - msg = 'exited with status %d' % (ret) - if ret: - if mustsucceed: - raise CommandFailure('%s: %s' % (msg, ' '.join(args))) - print >> sys.stderr, 'WARNING: %s: %s' % (msg, ' '.join(args)) - - def time(self, *args, **kwargs): - start = time.time() - self.run(*args, **kwargs) - end = time.time() - return end - start - - def logtime(self, name, elapsed, rest=[]): - self.log('time:' + name, '%.3f' % elapsed, rest) - - def log(self, name, value, rest=[]): - item = (name, value, repr(rest)) - print ' '.join(item) - self.csv.writerow(item) - self.logfp.flush() - - def unpack(self): - tarball = self.download() - t = self.time(['tar', '-C', self.wdir, '-jxf', tarball]) - self.logtime('internal:untar', t) - for name in os.listdir(os.path.join(self.wdir, 'mozilla')): - os.rename(os.path.join(self.wdir, 'mozilla', name), - os.path.join(self.wdir, name)) - - def cleanup(self): - pass - - def add(self, paths): - pass - - def commit(self, msg, paths): - pass - - def status(self, path): - pass - - def remove(self, path): - pass - - -class subversion(rcs): - def __init__(self, root): - rcs.__init__(self) - self.repo = os.path.join(root, 'repo') - self.wdir = os.path.join(root, 'wc') - create = self.time(['svnadmin', 'create', '--fs-type=fsfs', self.repo]) - self.logtime('svn:create', create) - co = self.time(['svn', 'co', 'file://' + self.repo, self.wdir]) - self.logtime('svn:co', co) - self.logtime('init', create + co) - os.chdir(self.wdir) - - def dropmeta(self, names): - return [n for n in names if os.path.basename(n) != '.svn'] - - def add(self, paths): - t = self.time(['svn', 'add', '-q'] + paths) - self.logtime('add %r' % paths, t) - - def commit(self, msg, paths=[]): - if paths: - t = self.time(['svn', 'ci', '-q', '-m', msg] + paths) - else: - t = self.time(['svn', 'ci', '-q', '-m', msg]) - self.logtime('commit %r' % paths, t) - - -class mercurial(rcs): - def __init__(self, root): - rcs.__init__(self) - self.repo = os.path.join(root, 'repo') - self.wdir = self.repo - init = self.time(['hg', 'init', self.repo]) - self.logtime('init', init) - os.chdir(self.wdir) - - def dropmeta(self, names): - return [n for n in names if os.path.basename(n) != '.hg'] - - def add(self, paths): - t = self.time(['hg', 'add', '-q'] + paths) - self.logtime('add %r' % paths, t) - - def commit(self, msg, paths=[]): - if paths: - t = self.time(['hg', 'ci', '-q', '-m', msg] + paths) - else: - t = self.time(['hg', 'ci', '-q', '-m', msg]) - self.logtime('commit %r' % paths, t) - -def benchmark(cls): - oldcwd = os.getcwd() - root = tempfile.mkdtemp(prefix='sillybench.') - try: - print 'root', root - inst = cls(root) - inst.unpack() - names = inst.dropmeta(os.listdir('.')) - dirs = [n for n in names if os.path.isdir(n)] - nondirs = [n for n in names if not os.path.isdir(n)] - dirs.sort(key=hash) - names.sort(key=hash) - for d in dirs[:len(dirs)/2]: - inst.add([d]) - inst.commit('Add %r' % d, [d]) - inst.add(dirs[len(dirs)/2:] + names) - inst.commit('Add remaining dirs and files') - finally: - print >> sys.stderr, '[cleaning up...]' - shutil.rmtree(root) - os.chdir(oldcwd) - -benchmark(mercurial) -#benchmark(subversion)
--- a/web/hgbook/comments/feeds.py Tue Mar 31 08:58:25 2009 -0700 +++ b/web/hgbook/comments/feeds.py Tue Mar 31 08:58:45 2009 -0700 @@ -8,9 +8,9 @@ class Comments(Feed): feed_type = MyAtomFeed - title = 'Real World Haskell: recent comments' - subtitle = ('Recent comments on the text of “Real World ' - 'Haskell”, from our readers') + title = 'Mercurial - The Definitive Guide: recent comments' + subtitle = ('Recent comments on the text of “Mercurial: The ' + 'Definitive Guide”, from our readers') link = '/feeds/comments/' author_name = 'Our readers'
--- a/web/hgbook/templates/boilerplate.html Tue Mar 31 08:58:25 2009 -0700 +++ b/web/hgbook/templates/boilerplate.html Tue Mar 31 08:58:45 2009 -0700 @@ -24,9 +24,14 @@ href="http://mattahan.deviantart.com/">Mattahan</a>.</p> </div> - <script src="http://www.google-analytics.com/urchin.js" - type="text/javascript"></script> - <script type="text/javascript">_uacct = "UA-1805907-3"; - urchinTracker();</script> + <script type="text/javascript"> + var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); + document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); + </script> + <script type="text/javascript"> + try { + var pageTracker = _gat._getTracker("UA-1805907-5"); + pageTracker._trackPageview(); + } catch(err) {}</script> </body> </html>
--- a/xsl/base-html-stylesheet.xsl Tue Mar 31 08:58:25 2009 -0700 +++ b/xsl/base-html-stylesheet.xsl Tue Mar 31 08:58:45 2009 -0700 @@ -114,7 +114,14 @@ </xsl:template> <xsl:template name="user.footer.navigation"> - <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script> - <script type="text/javascript">_uacct = "UA-1805907-3"; urchinTracker();</script> + <script type="text/javascript"> + var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); + document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); + </script> + <script type="text/javascript"> + try { + var pageTracker = _gat._getTracker("UA-1805907-5"); + pageTracker._trackPageview(); + } catch(err) {}</script> </xsl:template> </xsl:stylesheet>