Romain Pelisse avatar Romain Pelisse committed 39d37f8

adding more new files - probably generated but still in versionning

Comments (0)

Files changed (11)

fr/examples/ch01/new

+#!/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'

fr/examples/ch04/diff

+#!/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

fr/examples/ch04/resolve

+#$ 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

fr/examples/ch06/apache-config.lst

+<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>

fr/examples/ch09/check_whitespace.py.lst

+#!/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)

fr/examples/ch09/hook.ws

+#!/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

fr/examples/ch10/bugzilla-config.lst

+[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}

fr/examples/ch10/multiline

+#!/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

fr/examples/ch10/notify-config-mail.lst

+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...]

fr/examples/ch10/notify-config.lst

+[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/

fr/examples/ch11/qdelete

+#!/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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.