# HG changeset patch # User Romain PELISSE <belaran@gmail.com> # Date 1250421624 -7200 # Node ID 39d37f84beafa9bc6316935a061e160a90a965bf # Parent 1421a5493113ffdeddfb6e02c3653aba1907aebb adding more new files - probably generated but still in versionning diff -r 1421a5493113 -r 39d37f84beaf fr/examples/ch01/new --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fr/examples/ch01/new Sun Aug 16 13:20:24 2009 +0200 @@ -0,0 +1,39 @@ +#!/bin/bash + +cat > hello.c <<EOF +int main() +{ + printf("hello world!\n"); +} +EOF + +cat > goodbye.c <<EOF +int main() +{ + printf("goodbye world!\n"); +} +EOF + +#$ name: init + +hg init myproject + +#$ name: ls + +ls -l + +#$ name: ls2 + +ls -al myproject + +#$ name: add + +cd myproject +cp ../hello.c . +cp ../goodbye.c . +hg add +hg status + +#$ name: commit + +hg commit -m 'Initial commit' diff -r 1421a5493113 -r 39d37f84beaf fr/examples/ch04/diff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fr/examples/ch04/diff Sun Aug 16 13:20:24 2009 +0200 @@ -0,0 +1,30 @@ +#!/bin/bash + +hg init a +cd a +echo a > a +hg ci -Ama + +#$ name: rename.basic + +hg rename a b +hg diff + +#$ name: rename.git + +hg diff -g + +#$ name: + +hg revert -a +rm b + +#$ name: chmod + +chmod +x a +hg st +hg diff + +#$ name: chmod.git + +hg diff -g diff -r 1421a5493113 -r 39d37f84beaf fr/examples/ch04/resolve --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fr/examples/ch04/resolve Sun Aug 16 13:20:24 2009 +0200 @@ -0,0 +1,38 @@ +#$ name: init +hg init conflict +cd conflict +echo first > myfile.txt +hg ci -A -m first +cd .. +hg clone conflict left +hg clone conflict right + +#$ name: left +cd left +echo left >> myfile.txt +hg ci -m left + +#$ name: right +cd ../right +echo right >> myfile.txt +hg ci -m right + +#$ name: pull +cd ../conflict +hg pull -u ../left +hg pull -u ../right + +#$ name: heads +hg heads + +#$ name: export +export HGMERGE=false + +#$ name: merge +hg merge + +#$ name: cifail +hg commit -m 'Attempt to commit a failed merge' + +#$ name: list +hg resolve -l diff -r 1421a5493113 -r 39d37f84beaf fr/examples/ch06/apache-config.lst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fr/examples/ch06/apache-config.lst Sun Aug 16 13:20:24 2009 +0200 @@ -0,0 +1,11 @@ +<Directory /home/*/public_html> + AllowOverride FileInfo AuthConfig Limit + Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec + <Limit GET POST OPTIONS> + Order allow,deny + Allow from all + </Limit> + <LimitExcept GET POST OPTIONS> + Order deny,allow Deny from all + </LimitExcept> +</Directory> diff -r 1421a5493113 -r 39d37f84beaf fr/examples/ch09/check_whitespace.py.lst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fr/examples/ch09/check_whitespace.py.lst Sun Aug 16 13:20:24 2009 +0200 @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# +# save as .hg/check_whitespace.py and make executable + +import re + +def trailing_whitespace(difflines): + # + linenum, header = 0, False + + for line in difflines: + if header: + # remember the name of the file that this diff affects + m = re.match(r'(?:---|\+\+\+) ([^\t]+)', line) + if m and m.group(1) != '/dev/null': + filename = m.group(1).split('/', 1)[-1] + if line.startswith('+++ '): + header = False + continue + if line.startswith('diff '): + header = True + continue + # hunk header - save the line number + m = re.match(r'@@ -\d+,\d+ \+(\d+),', line) + if m: + linenum = int(m.group(1)) + continue + # hunk body - check for an added line with trailing whitespace + m = re.match(r'\+.*\s$', line) + if m: + yield filename, linenum + if line and line[0] in ' +': + linenum += 1 + +if __name__ == '__main__': + import os, sys + + added = 0 + for filename, linenum in trailing_whitespace(os.popen('hg export tip')): + print >> sys.stderr, ('%s, line %d: trailing whitespace added' % + (filename, linenum)) + added += 1 + if added: + # save the commit message so we don't need to retype it + os.system('hg tip --template "{desc}" > .hg/commit.save') + print >> sys.stderr, 'commit message saved to .hg/commit.save' + sys.exit(1) diff -r 1421a5493113 -r 39d37f84beaf fr/examples/ch09/hook.ws --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fr/examples/ch09/hook.ws Sun Aug 16 13:20:24 2009 +0200 @@ -0,0 +1,32 @@ +#!/bin/bash + +hg init a +cd a +echo '[hooks]' > .hg/hgrc +echo "pretxncommit.whitespace = hg export tip | (! egrep -q '^\\+.*[ \\t]$')" >> .hg/hgrc + +#$ name: simple + +cat .hg/hgrc +echo 'a ' > a +hg commit -A -m 'test with trailing whitespace' +echo 'a' > a +hg commit -A -m 'drop trailing whitespace and try again' + +#$ name: + +echo '[hooks]' > .hg/hgrc +echo "pretxncommit.whitespace = .hg/check_whitespace.py" >> .hg/hgrc +cp $EXAMPLE_DIR/ch09/check_whitespace.py.lst .hg/check_whitespace.py +chmod +x .hg/check_whitespace.py + +#$ name: better + +cat .hg/hgrc +echo 'a ' >> a +hg commit -A -m 'add new line with trailing whitespace' +sed -i 's, *$,,' a +hg commit -A -m 'trimmed trailing whitespace' + +#$ name: +exit 0 diff -r 1421a5493113 -r 39d37f84beaf fr/examples/ch10/bugzilla-config.lst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fr/examples/ch10/bugzilla-config.lst Sun Aug 16 13:20:24 2009 +0200 @@ -0,0 +1,14 @@ +[bugzilla] +host = bugzilla.example.com +password = mypassword version = 2.16 +# server-side repos live in /home/hg/repos, so strip 4 leading +# separators +strip = 4 +hgweb = http://hg.example.com/ +usermap = /home/hg/repos/notify/bugzilla.conf +template = Changeset {node|short}, made by {author} in the {webroot} + repo, refers to this bug.\n + For complete details, see + {hgweb}{webroot}?cmd=changeset;node={node|short}\n + Changeset description:\n + \t{desc|tabindent} diff -r 1421a5493113 -r 39d37f84beaf fr/examples/ch10/multiline --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fr/examples/ch10/multiline Sun Aug 16 13:20:24 2009 +0200 @@ -0,0 +1,13 @@ +#!/bin/sh + +hg init +echo a > test.c +hg ci -Am'First commit' + +#$ name: go + +cat > multiline << EOF +changeset = "Changed in {node|short}:\n{files}" +file = " {file}\n" +EOF +hg log --style multiline diff -r 1421a5493113 -r 39d37f84beaf fr/examples/ch10/notify-config-mail.lst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fr/examples/ch10/notify-config-mail.lst Sun Aug 16 13:20:24 2009 +0200 @@ -0,0 +1,18 @@ +X-Hg-Repo: tests/slave +Subject: tests/slave: Handle error case when slave has no buffers +Date: Wed, 2 Aug 2006 15:25:46 -0700 (PDT) + +changeset 3cba9bfe74b5 in /home/hg/repos/tests/slave + +details: +http://hg.example.com/tests/slave?cmd=changeset;node=3cba9bfe74b5 + +description: Handle error case when slave has no buffers + +diffs (54 lines): +diff -r 9d95df7cf2ad -r 3cba9bfe74b5 include/tests.h +--- a/include/tests.h Wed Aug 02 15:19:52 2006 -0700 ++++ b/include/tests.h Wed Aug 02 15:25:26 2006 -0700 +@@ -212,6 +212,15 @@ static __inline__ +void test_headers(void *h) +[...snip...] diff -r 1421a5493113 -r 39d37f84beaf fr/examples/ch10/notify-config.lst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fr/examples/ch10/notify-config.lst Sun Aug 16 13:20:24 2009 +0200 @@ -0,0 +1,19 @@ +[notify] +# really send email +test = false +# subscriber data lives in the notify repo +config = /home/hg/repos/notify/notify.conf +# repos live in /home/hg/repos on server, so strip 4 "/" chars +strip = 4 +template = X-Hg-Repo: {webroot}\n + Subject: {webroot}: {desc|firstline|strip}\n + From: {author} + \n\n + changeset {node|short} in {root} + \n\ndetails: + {baseurl}{webroot}?cmd=changeset;node={node|short} + description: {desc|tabindent|strip} + +[web] +baseurl = +http://hg.example.com/ diff -r 1421a5493113 -r 39d37f84beaf fr/examples/ch11/qdelete --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fr/examples/ch11/qdelete Sun Aug 16 13:20:24 2009 +0200 @@ -0,0 +1,32 @@ +#!/bin/bash + +echo '[extensions]' >> $HGRC +echo 'hgext.mq =' >> $HGRC + +#$ name: go + +hg init myrepo +cd myrepo +hg qinit +hg qnew bad.patch +echo a > a +hg add a +hg qrefresh +hg qdelete bad.patch +hg qpop +hg qdelete bad.patch + +#$ name: convert + +hg qnew good.patch +echo a > a +hg add a +hg qrefresh -m 'Good change' +hg qfinish tip +hg qapplied +hg tip --style=compact + +#$ name: import + +hg qimport -r tip +hg qapplied