hgbook

changeset 966:39d37f84beaf

adding more new files - probably generated but still in versionning
author Romain PELISSE <belaran@gmail.com>
date Sun Aug 16 13:20:24 2009 +0200 (2009-08-16)
parents 1421a5493113
children f25ab8d4486f
files fr/examples/ch01/new fr/examples/ch04/diff fr/examples/ch04/resolve fr/examples/ch06/apache-config.lst fr/examples/ch09/check_whitespace.py.lst fr/examples/ch09/hook.ws fr/examples/ch10/bugzilla-config.lst fr/examples/ch10/multiline fr/examples/ch10/notify-config-mail.lst fr/examples/ch10/notify-config.lst fr/examples/ch11/qdelete
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/fr/examples/ch01/new	Sun Aug 16 13:20:24 2009 +0200
     1.3 @@ -0,0 +1,39 @@
     1.4 +#!/bin/bash
     1.5 +
     1.6 +cat > hello.c <<EOF
     1.7 +int main()
     1.8 +{
     1.9 +    printf("hello world!\n");
    1.10 +}
    1.11 +EOF
    1.12 +
    1.13 +cat > goodbye.c <<EOF
    1.14 +int main()
    1.15 +{
    1.16 +    printf("goodbye world!\n");
    1.17 +}
    1.18 +EOF
    1.19 +
    1.20 +#$ name: init
    1.21 +
    1.22 +hg init myproject
    1.23 +
    1.24 +#$ name: ls
    1.25 +
    1.26 +ls -l
    1.27 +
    1.28 +#$ name: ls2
    1.29 +
    1.30 +ls -al myproject
    1.31 +
    1.32 +#$ name: add
    1.33 +
    1.34 +cd myproject
    1.35 +cp ../hello.c .
    1.36 +cp ../goodbye.c .
    1.37 +hg add
    1.38 +hg status
    1.39 +
    1.40 +#$ name: commit
    1.41 +
    1.42 +hg commit -m 'Initial commit'
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/fr/examples/ch04/diff	Sun Aug 16 13:20:24 2009 +0200
     2.3 @@ -0,0 +1,30 @@
     2.4 +#!/bin/bash
     2.5 +
     2.6 +hg init a
     2.7 +cd a
     2.8 +echo a > a
     2.9 +hg ci -Ama
    2.10 +
    2.11 +#$ name: rename.basic
    2.12 +
    2.13 +hg rename a b
    2.14 +hg diff
    2.15 +
    2.16 +#$ name: rename.git
    2.17 +
    2.18 +hg diff -g
    2.19 +
    2.20 +#$ name:
    2.21 +
    2.22 +hg revert -a
    2.23 +rm b
    2.24 +
    2.25 +#$ name: chmod
    2.26 +
    2.27 +chmod +x a
    2.28 +hg st
    2.29 +hg diff
    2.30 +
    2.31 +#$ name: chmod.git
    2.32 +
    2.33 +hg diff -g
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/fr/examples/ch04/resolve	Sun Aug 16 13:20:24 2009 +0200
     3.3 @@ -0,0 +1,38 @@
     3.4 +#$ name: init
     3.5 +hg init conflict
     3.6 +cd conflict
     3.7 +echo first > myfile.txt
     3.8 +hg ci -A -m first
     3.9 +cd ..
    3.10 +hg clone conflict left
    3.11 +hg clone conflict right
    3.12 +
    3.13 +#$ name: left
    3.14 +cd left
    3.15 +echo left >> myfile.txt
    3.16 +hg ci -m left
    3.17 +
    3.18 +#$ name: right
    3.19 +cd ../right
    3.20 +echo right >> myfile.txt
    3.21 +hg ci -m right
    3.22 +
    3.23 +#$ name: pull
    3.24 +cd ../conflict
    3.25 +hg pull -u ../left
    3.26 +hg pull -u ../right
    3.27 +
    3.28 +#$ name: heads
    3.29 +hg heads
    3.30 +
    3.31 +#$ name: export
    3.32 +export HGMERGE=false
    3.33 +
    3.34 +#$ name: merge
    3.35 +hg merge
    3.36 +
    3.37 +#$ name: cifail
    3.38 +hg commit -m 'Attempt to commit a failed merge'
    3.39 +
    3.40 +#$ name: list
    3.41 +hg resolve -l
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/fr/examples/ch06/apache-config.lst	Sun Aug 16 13:20:24 2009 +0200
     4.3 @@ -0,0 +1,11 @@
     4.4 +<Directory /home/*/public_html>
     4.5 +  AllowOverride FileInfo AuthConfig Limit
     4.6 +  Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
     4.7 +  <Limit GET POST OPTIONS>
     4.8 +    Order allow,deny
     4.9 +    Allow from all
    4.10 +  </Limit>
    4.11 +  <LimitExcept GET POST OPTIONS>
    4.12 +    Order deny,allow Deny from all
    4.13 +  </LimitExcept>
    4.14 +</Directory>
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/fr/examples/ch09/check_whitespace.py.lst	Sun Aug 16 13:20:24 2009 +0200
     5.3 @@ -0,0 +1,47 @@
     5.4 +#!/usr/bin/env python
     5.5 +#
     5.6 +# save as .hg/check_whitespace.py and make executable
     5.7 +
     5.8 +import re
     5.9 +
    5.10 +def trailing_whitespace(difflines):
    5.11 +    # 
    5.12 +    linenum, header = 0, False
    5.13 +
    5.14 +    for line in difflines:
    5.15 +        if header:
    5.16 +            # remember the name of the file that this diff affects
    5.17 +            m = re.match(r'(?:---|\+\+\+) ([^\t]+)', line)
    5.18 +            if m and m.group(1) != '/dev/null':
    5.19 +                filename = m.group(1).split('/', 1)[-1]
    5.20 +            if line.startswith('+++ '):
    5.21 +                header = False
    5.22 +            continue
    5.23 +        if line.startswith('diff '):
    5.24 +            header = True
    5.25 +            continue
    5.26 +        # hunk header - save the line number
    5.27 +        m = re.match(r'@@ -\d+,\d+ \+(\d+),', line)
    5.28 +        if m:
    5.29 +            linenum = int(m.group(1))
    5.30 +            continue
    5.31 +        # hunk body - check for an added line with trailing whitespace
    5.32 +        m = re.match(r'\+.*\s$', line)
    5.33 +        if m:
    5.34 +            yield filename, linenum
    5.35 +        if line and line[0] in ' +':
    5.36 +            linenum += 1
    5.37 +
    5.38 +if __name__ == '__main__':
    5.39 +    import os, sys
    5.40 +    
    5.41 +    added = 0
    5.42 +    for filename, linenum in trailing_whitespace(os.popen('hg export tip')):
    5.43 +        print >> sys.stderr, ('%s, line %d: trailing whitespace added' %
    5.44 +                              (filename, linenum))
    5.45 +        added += 1
    5.46 +    if added:
    5.47 +        # save the commit message so we don't need to retype it
    5.48 +        os.system('hg tip --template "{desc}" > .hg/commit.save')
    5.49 +        print >> sys.stderr, 'commit message saved to .hg/commit.save'
    5.50 +        sys.exit(1)
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/fr/examples/ch09/hook.ws	Sun Aug 16 13:20:24 2009 +0200
     6.3 @@ -0,0 +1,32 @@
     6.4 +#!/bin/bash
     6.5 +
     6.6 +hg init a
     6.7 +cd a
     6.8 +echo '[hooks]' > .hg/hgrc
     6.9 +echo "pretxncommit.whitespace = hg export tip | (! egrep -q '^\\+.*[ \\t]$')" >> .hg/hgrc
    6.10 +
    6.11 +#$ name: simple
    6.12 +
    6.13 +cat .hg/hgrc
    6.14 +echo 'a ' > a
    6.15 +hg commit -A -m 'test with trailing whitespace'
    6.16 +echo 'a' > a
    6.17 +hg commit -A -m 'drop trailing whitespace and try again'
    6.18 +
    6.19 +#$ name:
    6.20 +
    6.21 +echo '[hooks]' > .hg/hgrc
    6.22 +echo "pretxncommit.whitespace = .hg/check_whitespace.py" >> .hg/hgrc
    6.23 +cp $EXAMPLE_DIR/ch09/check_whitespace.py.lst .hg/check_whitespace.py
    6.24 +chmod +x .hg/check_whitespace.py
    6.25 +
    6.26 +#$ name: better
    6.27 +
    6.28 +cat .hg/hgrc
    6.29 +echo 'a ' >> a
    6.30 +hg commit -A -m 'add new line with trailing whitespace'
    6.31 +sed -i 's, *$,,' a
    6.32 +hg commit -A -m 'trimmed trailing whitespace'
    6.33 +
    6.34 +#$ name:
    6.35 +exit 0
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/fr/examples/ch10/bugzilla-config.lst	Sun Aug 16 13:20:24 2009 +0200
     7.3 @@ -0,0 +1,14 @@
     7.4 +[bugzilla]
     7.5 +host = bugzilla.example.com
     7.6 +password = mypassword version = 2.16
     7.7 +# server-side repos live in /home/hg/repos, so strip 4 leading
     7.8 +# separators
     7.9 +strip = 4
    7.10 +hgweb = http://hg.example.com/
    7.11 +usermap = /home/hg/repos/notify/bugzilla.conf
    7.12 +template = Changeset {node|short}, made by {author} in the {webroot}
    7.13 +  repo, refers to this bug.\n
    7.14 +  For complete details, see
    7.15 +  {hgweb}{webroot}?cmd=changeset;node={node|short}\n
    7.16 +  Changeset description:\n
    7.17 +  \t{desc|tabindent}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/fr/examples/ch10/multiline	Sun Aug 16 13:20:24 2009 +0200
     8.3 @@ -0,0 +1,13 @@
     8.4 +#!/bin/sh
     8.5 +
     8.6 +hg init
     8.7 +echo a > test.c
     8.8 +hg ci -Am'First commit'
     8.9 +
    8.10 +#$ name: go
    8.11 +
    8.12 +cat > multiline << EOF
    8.13 +changeset = "Changed in {node|short}:\n{files}"
    8.14 +file = "  {file}\n"
    8.15 +EOF
    8.16 +hg log --style multiline
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/fr/examples/ch10/notify-config-mail.lst	Sun Aug 16 13:20:24 2009 +0200
     9.3 @@ -0,0 +1,18 @@
     9.4 +X-Hg-Repo: tests/slave
     9.5 +Subject: tests/slave: Handle error case when slave has no buffers
     9.6 +Date: Wed,  2 Aug 2006 15:25:46 -0700 (PDT)
     9.7 +
     9.8 +changeset 3cba9bfe74b5 in /home/hg/repos/tests/slave
     9.9 +
    9.10 +details:
    9.11 +http://hg.example.com/tests/slave?cmd=changeset;node=3cba9bfe74b5 
    9.12 +
    9.13 +description: Handle error case when slave has no buffers
    9.14 +
    9.15 +diffs (54 lines):
    9.16 +diff -r 9d95df7cf2ad -r 3cba9bfe74b5 include/tests.h
    9.17 +--- a/include/tests.h      Wed Aug 02 15:19:52 2006 -0700
    9.18 ++++ b/include/tests.h      Wed Aug 02 15:25:26 2006 -0700
    9.19 +@@ -212,6 +212,15 @@ static __inline__
    9.20 +void test_headers(void *h)
    9.21 +[...snip...]
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/fr/examples/ch10/notify-config.lst	Sun Aug 16 13:20:24 2009 +0200
    10.3 @@ -0,0 +1,19 @@
    10.4 +[notify]
    10.5 +# really send email
    10.6 +test = false
    10.7 +# subscriber data lives in the notify repo
    10.8 +config = /home/hg/repos/notify/notify.conf
    10.9 +# repos live in /home/hg/repos on server, so strip 4 "/" chars
   10.10 +strip = 4
   10.11 +template = X-Hg-Repo: {webroot}\n
   10.12 +  Subject: {webroot}: {desc|firstline|strip}\n
   10.13 +  From: {author}
   10.14 +  \n\n
   10.15 +  changeset {node|short} in {root}
   10.16 +  \n\ndetails:
   10.17 +  {baseurl}{webroot}?cmd=changeset;node={node|short}
   10.18 +  description: {desc|tabindent|strip}
   10.19 +
   10.20 +[web]
   10.21 +baseurl =
   10.22 +http://hg.example.com/
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/fr/examples/ch11/qdelete	Sun Aug 16 13:20:24 2009 +0200
    11.3 @@ -0,0 +1,32 @@
    11.4 +#!/bin/bash
    11.5 +
    11.6 +echo '[extensions]' >> $HGRC
    11.7 +echo 'hgext.mq =' >> $HGRC
    11.8 +
    11.9 +#$ name: go
   11.10 +
   11.11 +hg init myrepo
   11.12 +cd myrepo
   11.13 +hg qinit
   11.14 +hg qnew bad.patch
   11.15 +echo a > a
   11.16 +hg add a
   11.17 +hg qrefresh
   11.18 +hg qdelete bad.patch
   11.19 +hg qpop
   11.20 +hg qdelete bad.patch
   11.21 +
   11.22 +#$ name: convert
   11.23 +
   11.24 +hg qnew good.patch
   11.25 +echo a > a
   11.26 +hg add a
   11.27 +hg qrefresh -m 'Good change'
   11.28 +hg qfinish tip
   11.29 +hg qapplied
   11.30 +hg tip --style=compact
   11.31 +
   11.32 +#$ name: import
   11.33 +
   11.34 +hg qimport -r tip
   11.35 +hg qapplied