changeset 16488:d9901eb3e42d stable

Merge stable
author Brendan Cully <brendan@kublai.com>
date Sun, 22 Apr 2012 20:30:36 -0700
parents 4fe874697a4d (diff) cbf2ea2f5ca1 (current diff)
children cf137319c6cd
files
diffstat 12 files changed, 31 insertions(+), 74 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Mon Apr 16 01:11:29 2012 +0900
+++ b/contrib/check-code.py	Sun Apr 22 20:30:36 2012 -0700
@@ -55,7 +55,7 @@
     (r'head -c', "don't use 'head -c', use 'dd'"),
     (r'sha1sum', "don't use sha1sum, use $TESTDIR/md5sum.py"),
     (r'ls.*-\w*R', "don't use 'ls -R', use 'find'"),
-    (r'printf.*\\\d{1,3}', "don't use 'printf \NNN', use Python"),
+    (r'printf.*\\([1-9]|0\d)', "don't use 'printf \NNN', use Python"),
     (r'printf.*\\x', "don't use printf \\x, use Python"),
     (r'\$\(.*\)', "don't use $(expr), use `expr`"),
     (r'rm -rf \*', "don't use naked rm -rf, target a directory"),
@@ -65,7 +65,7 @@
     (r'\$PWD', "don't use $PWD, use `pwd`"),
     (r'[^\n]\Z', "no trailing newline"),
     (r'export.*=', "don't export and assign at once"),
-    (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\\^', "^ must be quoted"),
+    (r'^([^"\'\n]|("[^"\n]*")|(\'[^\'\n]*\'))*\^', "^ must be quoted"),
     (r'^source\b', "don't use 'source', use '.'"),
     (r'touch -d', "don't use 'touch -d', use 'touch -t' instead"),
     (r'ls +[^|\n-]+ +-', "options to 'ls' must come before filenames"),
@@ -73,6 +73,7 @@
     (r'^stop\(\)', "don't use 'stop' as a shell function name"),
     (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"),
     (r'^alias\b.*=', "don't use alias, use a function"),
+    (r'if\s*!', "don't use '!' to negate exit status"),
   ],
   # warnings
   []
@@ -94,6 +95,7 @@
     (uprefix + r'.*\|\| echo.*(fail|error)',
      "explicit exit code checks unnecessary"),
     (uprefix + r'set -e', "don't use set -e"),
+    (uprefix + r'\s', "don't indent commands, use > for continued lines"),
     (uprefixc + r'( *)\t', "don't use tabs to indent"),
     (uprefixc + r'.*do\s*true;\s*done',
      "don't use true as loop body, use sleep 0"),
--- a/mercurial/scmutil.py	Mon Apr 16 01:11:29 2012 +0900
+++ b/mercurial/scmutil.py	Sun Apr 22 20:30:36 2012 -0700
@@ -160,7 +160,7 @@
         raise NotImplementedError('attempted instantiating ' + str(type(self)))
 
     def tryread(self, path):
-        'gracefully return an empty string for missing files'
+        '''gracefully return an empty string for missing files'''
         try:
             return self.read(path)
         except IOError, inst:
--- a/tests/test-check-code-hg.t	Mon Apr 16 01:11:29 2012 +0900
+++ b/tests/test-check-code-hg.t	Sun Apr 22 20:30:36 2012 -0700
@@ -1,6 +1,7 @@
   $ check_code="$TESTDIR"/../contrib/check-code.py
   $ cd "$TESTDIR"/..
-  $ if ! hg identify -q > /dev/null; then
+  $ if hg identify -q > /dev/null; then :
+  > else
   >     echo "skipped: not a Mercurial working dir" >&2
   >     exit 80
   > fi
--- a/tests/test-commit-amend.t	Mon Apr 16 01:11:29 2012 +0900
+++ b/tests/test-commit-amend.t	Sun Apr 22 20:30:36 2012 -0700
@@ -273,7 +273,7 @@
   $ hg mv c d
   $ hg ci --amend -m 'b -> d'
   saved backup bundle to $TESTTMP/.hg/strip-backup/9c207120aa98-amend-backup.hg
-  $ hg st --rev .^ --copies d
+  $ hg st --rev '.^' --copies d
   A d
     b
   $ hg cp d e
@@ -281,7 +281,7 @@
   $ hg cp e f
   $ hg ci --amend -m 'f = d'
   saved backup bundle to $TESTTMP/.hg/strip-backup/fda2b3b27b22-amend-backup.hg
-  $ hg st --rev .^ --copies f
+  $ hg st --rev '.^' --copies f
   A f
     d
 
--- a/tests/test-convert-splicemap.t	Mon Apr 16 01:11:29 2012 +0900
+++ b/tests/test-convert-splicemap.t	Sun Apr 22 20:30:36 2012 -0700
@@ -125,7 +125,7 @@
 the bug should be exhibited with all conversion orders.
 
   $ cat > ../splicemap <<EOF
-  > $(hg id -r 2 -i --debug) $(hg id -r 1 -i --debug), $(hg id -r 3 -i --debug)
+  > `(hg id -r 2 -i --debug)` `(hg id -r 1 -i --debug)`, `(hg id -r 3 -i --debug)`
   > EOF
   $ cd ..
   $ cat splicemap
@@ -169,9 +169,9 @@
   converting...
   0 addb
   $ cat > splicemap <<EOF
-  > $(hg -R ordered id -r 2 -i --debug) \
-  > $(hg -R ordered-hg2 id -r 1 -i --debug),\
-  > $(hg -R ordered-hg2 id -r 2 -i --debug)
+  > `(hg -R ordered id -r 2 -i --debug)` \
+  > `(hg -R ordered-hg2 id -r 1 -i --debug)`,\
+  > `(hg -R ordered-hg2 id -r 2 -i --debug)`
   > deadbeef102a90ea7b4a3361e4082ed620918c26 deadbeef102a90ea7b4a3361e4082ed620918c27
   > EOF
   $ hg convert --splicemap splicemap ordered ordered-hg2
@@ -211,9 +211,9 @@
 Test invalid dependency
 
   $ cat > splicemap <<EOF
-  > $(hg -R ordered id -r 2 -i --debug) \
+  > `(hg -R ordered id -r 2 -i --debug)` \
   > deadbeef102a90ea7b4a3361e4082ed620918c26,\
-  > $(hg -R ordered-hg2 id -r 2 -i --debug)
+  > `(hg -R ordered-hg2 id -r 2 -i --debug)`
   > EOF
   $ hg convert --splicemap splicemap ordered ordered-hg4
   initializing destination ordered-hg4 repository
--- a/tests/test-copy2.t	Mon Apr 16 01:11:29 2012 +0900
+++ b/tests/test-copy2.t	Sun Apr 22 20:30:36 2012 -0700
@@ -100,7 +100,7 @@
     bar
 
 foo was clean:
-  $  hg st -AC foo
+  $ hg st -AC foo
   C foo
 but it's considered modified after a copy --after --force
   $ hg copy -Af bar foo
--- a/tests/test-diff-change.t	Mon Apr 16 01:11:29 2012 +0900
+++ b/tests/test-diff-change.t	Sun Apr 22 20:30:36 2012 -0700
@@ -33,8 +33,8 @@
 Testing diff --change when merge:
 
   $ for i in 1 2 3 4 5 6 7 8 9 10; do
-  $    echo $i >> file.txt
-  $ done
+  >    echo $i >> file.txt
+  > done
   $ hg commit -m "lots of text" # 3
 
   $ sed -e 's,^2$,x,' file.txt > file.txt.tmp
--- a/tests/test-glog.t	Mon Apr 16 01:11:29 2012 +0900
+++ b/tests/test-glog.t	Sun Apr 22 20:30:36 2012 -0700
@@ -1428,7 +1428,7 @@
   >     | sed 's/.*nodetag/nodetag/' > log.nodes
   >   hg log -G --template 'nodetag {rev}\n' "$@" | grep nodetag \
   >     | sed 's/.*nodetag/nodetag/' > glog.nodes
-  >   diff -u log.nodes glog.nodes
+  >   diff -u log.nodes glog.nodes | grep '^[-+@ ]' || :
   > }
 
 glog always reorders nodes which explains the difference with log
@@ -1448,7 +1448,6 @@
   +nodetag 27
   +nodetag 25
   +nodetag 21
-  [1]
   $ testlog -u test -u not-a-user
   []
   (group
@@ -1975,7 +1974,6 @@
    nodetag 8
    nodetag 7
   +nodetag 6
-  [1]
 
 Test --follow-first and forward --rev
 
@@ -1992,7 +1990,6 @@
    nodetag 8
    nodetag 7
   +nodetag 6
-  [1]
 
 Test --follow and backward --rev
 
--- a/tests/test-hgignore.t	Mon Apr 16 01:11:29 2012 +0900
+++ b/tests/test-hgignore.t	Sun Apr 22 20:30:36 2012 -0700
@@ -48,7 +48,7 @@
   [255]
 
   $ echo ".*\.o" > .hgignore
-  $  hg status
+  $ hg status
   A dir/b.o
   ? .hgignore
   ? a.c
--- a/tests/test-pull-pull-corruption.t	Mon Apr 16 01:11:29 2012 +0900
+++ b/tests/test-pull-pull-corruption.t	Sun Apr 22 20:30:36 2012 -0700
@@ -37,26 +37,27 @@
 
 start a pull...
 
-  $ hg pull ../source1 &
+  $ hg pull ../source1 > pull.out 2>&1 &
 
 ... and start another pull before the first one has finished
 
   $ sleep 1
-  pulling from ../source1
-  requesting all changes
   $ hg pull ../source2 2>/dev/null
   pulling from ../source2
-  adding changesets
-  adding manifests
-  adding file changes
-  added 10 changesets with 10 changes to 1 files
-  (run 'hg update' to get a working copy)
   searching for changes
   adding changesets
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files (+1 heads)
   (run 'hg heads' to see heads, 'hg merge' to merge)
+  $ cat pull.out
+  pulling from ../source1
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 10 changesets with 10 changes to 1 files
+  (run 'hg update' to get a working copy)
 
 see the result
 
--- a/tests/test-pull-pull-corruption2.t	Mon Apr 16 01:11:29 2012 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-Corrupt an hg repo with two pulls.
-create one repo with a long history
-
-  $ hg init source1
-  $ cd source1
-  $ touch foo
-  $ hg add foo
-  $ for i in 1 2 3 4 5 6 7 8 9 10; do
-  >     echo $i >> foo
-  >     hg ci -m $i
-  > done
-  $ cd ..
-
-create a third repo to pull both other repos into it
-
-  $ hg init version2
-  $ hg -R version2 pull source1 &
-  $ sleep 1
-  pulling from source1
-  requesting all changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 10 changesets with 10 changes to 1 files
-  (run 'hg update' to get a working copy)
-  $ hg clone --pull -U version2 corrupted
-  requesting all changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 10 changesets with 10 changes to 1 files
-  $ wait
-  $ hg -R corrupted verify
-  checking changesets
-  checking manifests
-  crosschecking files in changesets and manifests
-  checking files
-  1 files, 10 changesets, 10 total revisions
-  $ hg -R version2 verify
-  checking changesets
-  checking manifests
-  crosschecking files in changesets and manifests
-  checking files
-  1 files, 10 changesets, 10 total revisions
--- a/tests/test-serve.t	Mon Apr 16 01:11:29 2012 +0900
+++ b/tests/test-serve.t	Sun Apr 22 20:30:36 2012 -0700
@@ -28,9 +28,9 @@
   $ hg serve -a localhost -p $HGPORT -d --pid-file=hg.pid -E errors.log
   $ cat hg.pid >> "$DAEMON_PIDS"
   $ if [ -f access.log ]; then
-  $     echo 'access log created - .hg/hgrc respected'
+  >     echo 'access log created - .hg/hgrc respected'
+  > fi
   access log created - .hg/hgrc respected
-  $ fi
 
 errors