test: use obsolescence marker to test hidden
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 04 Dec 2012 15:25:22 +0100
changeset 18208 f0059ba239cb
parent 18206 2c1276825e93
child 18209 6a91cbb67907
test: use obsolescence marker to test hidden Instead of using a custom dedicated extension.
tests/test-glog.t
tests/test-log.t
--- a/tests/test-glog.t	Wed Jan 02 00:24:28 2013 -0600
+++ b/tests/test-glog.t	Tue Dec 04 15:25:22 2012 +0100
@@ -2042,19 +2042,16 @@
   $ cd ..
 
 Test --hidden
+ (enable obsolete)
 
-  $ cat > $HGTMP/testhidden.py << EOF
-  > from mercurial import util
-  > def reposetup(ui, repo):
-  >     for line in repo.opener('hidden'):
-  >         ctx = repo[line.strip()]
-  >         repo.hiddenrevs.add(ctx.rev())
-  >     if repo.revs('children(%ld) - %ld',  repo.hiddenrevs,  repo.hiddenrevs):
-  >       raise util.Abort('hidden revision with children!')
+  $ cat > ${TESTTMP}/obs.py << EOF
+  > import mercurial.obsolete
+  > mercurial.obsolete._enabled = True
   > EOF
-  $ echo '[extensions]' >> .hg/hgrc
-  $ echo "hidden=$HGTMP/testhidden.py" >> .hg/hgrc
-  $ hg id --debug -i -r 8 > .hg/hidden
+  $ echo '[extensions]' >> $HGRCPATH
+  $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
+
+  $ hg debugobsolete `hg id --debug -i -r 8`
   $ testlog
   []
   []
--- a/tests/test-log.t	Wed Jan 02 00:24:28 2013 -0600
+++ b/tests/test-log.t	Tue Dec 04 15:25:22 2012 +0100
@@ -1142,19 +1142,20 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     a
   
-  $ cat > $HGTMP/testhidden.py << EOF
-  > def reposetup(ui, repo):
-  >     for line in repo.opener('hidden'):
-  >         ctx = repo[line.strip()]
-  >         repo.hiddenrevs.add(ctx.rev())
+enable obsolete to test hidden feature
+
+  $ cat > ${TESTTMP}/obs.py << EOF
+  > import mercurial.obsolete
+  > mercurial.obsolete._enabled = True
   > EOF
   $ echo '[extensions]' >> $HGRCPATH
-  $ echo "hidden=$HGTMP/testhidden.py" >> $HGRCPATH
-  $ touch .hg/hidden
+  $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
+
   $ hg log --template='{rev}:{node}\n'
   1:a765632148dc55d38c35c4f247c618701886cb2f
   0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
-  $ echo a765632148dc55d38c35c4f247c618701886cb2f > .hg/hidden
+  $ hg debugobsolete a765632148dc55d38c35c4f247c618701886cb2f
+  $ hg up null -q
   $ hg log --template='{rev}:{node}\n'
   0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05
   $ hg log --template='{rev}:{node}\n' --hidden
@@ -1163,7 +1164,7 @@
 
 clear extensions configuration
   $ echo '[extensions]' >> $HGRCPATH
-  $ echo "hidden=!" >> $HGRCPATH
+  $ echo "obs=!" >> $HGRCPATH
   $ cd ..
 
 test -u/-k for problematic encoding