--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-private.t Mon May 23 14:25:22 2011 +0200
@@ -0,0 +1,115 @@
+ $ cat >> $HGRCPATH <<EOF
+ > [extensions]
+ > EOF
+ $ echo "states=$(echo $(dirname $TESTDIR))/states.py" >> $HGRCPATH
+
+ $ hg init local
+ $ hg init remote1
+ $ hg init remote2
+ $ cd local
+ $ echo "celestine" > babar
+ $ hg add babar
+ $ hg ci -m "add babar"
+ $ echo "la veille dame" > babar
+ $ hg ci -m "add dame"
+ $ hg log --template='{rev}:{node|short}: {state}\n'
+ 1:710fe444b3b0: 0
+ 0:5caa672bac26: 0
+ $ hg out ../remote1 --template='{rev}:{node|short}\n'
+ comparing with ../remote1
+ searching for changes
+ 0:5caa672bac26
+ 1:710fe444b3b0
+ $ hg push ../remote1
+ pushing to ../remote1
+ searching for changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 2 changesets with 2 changes to 1 files
+ $ hg setstate 0 1 # until we fix push
+ $ echo "tree" >> savanna
+ $ hg add savanna
+ $ hg ci -m "terrain"
+ $ echo "flore" >> babar
+ $ hg ci -m "children"
+ $ hg log --template='{rev}:{node|short}: {state}\n'
+ 3:73585b17392a: 0
+ 2:3c8695235a32: 0
+ 1:710fe444b3b0: 0
+ 0:5caa672bac26: 0
+
+turn private on (repo side)
+ $ cat > .hg/hgrc << EOF
+ > [states]
+ > private=yes
+ > EOF
+ $ hg log --template='{rev}:{node|short}: {state}\n'
+ 3:73585b17392a: 2
+ 2:3c8695235a32: 2
+ 1:710fe444b3b0: 0
+ 0:5caa672bac26: 0
+
+test outgoing and push
+ $ hg out ../remote1 --template='{rev}:{node|short}\n'
+ comparing with ../remote1
+ searching for changes
+ no changes found
+ [1]
+ $ hg push ../remote1
+ pushing to ../remote1
+ searching for changes
+ no changes found
+
+ $ hg out ../remote2 --template='{rev}:{node|short}\n'
+ comparing with ../remote2
+ searching for changes
+ 0:5caa672bac26
+ 1:710fe444b3b0
+ $ hg push ../remote2
+ pushing to ../remote2
+ searching for changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 2 changesets with 2 changes to 1 files
+
+turn private off again (repo side)
+ $ sed -i 's/^private=.*$/private=no/' .hg/hgrc
+ $ hg log --template='{rev}:{node|short}: {state}\n'
+ 3:73585b17392a: 0
+ 2:3c8695235a32: 0
+ 1:710fe444b3b0: 0
+ 0:5caa672bac26: 0
+ $ hg out ../remote1 --template='{rev}:{node|short}\n'
+ comparing with ../remote1
+ searching for changes
+ 2:3c8695235a32
+ 3:73585b17392a
+
+turn private on again (repo side)
+ $ sed -i 's/^private=.*$/private=yes/' .hg/hgrc
+
+test incoming and pull
+
+ $ hg init ../other1
+ $ cd ../other1
+ $ hg incoming ../local --template='{rev}:{node|short}\n'
+ comparing with ../local
+ 0:5caa672bac26
+ 1:710fe444b3b0
+ $ hg pull ../local
+ pulling from ../local
+ requesting all changes
+ adding changesets
+ adding manifests
+ adding file changes
+ added 2 changesets with 2 changes to 1 files
+ (run 'hg update' to get a working copy)
+ $ cd ..
+ $ hg clone local other2
+ updating to branch default
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg -R other2 log --template='{rev}:{node|short}\n'
+ 1:710fe444b3b0
+ 0:5caa672bac26