test-revset: make it work with chg
authorJun Wu <quark@fb.com>
Sun, 20 Aug 2017 10:55:05 -0700
changeset 33868 63773d7497b6
parent 33867 252fb66ee5bb
child 33869 5f3845b4ca15
test-revset: make it work with chg chg currently triggers `reposetup` as a side effect of `hg serve` command. Therefore change the test to not output during `reposetup` to be compatible with chg. Differential Revision: https://phab.mercurial-scm.org/D455
tests/test-revset.t
--- a/tests/test-revset.t	Sat Aug 19 11:23:33 2017 +0900
+++ b/tests/test-revset.t	Sun Aug 20 10:55:05 2017 -0700
@@ -4437,14 +4437,17 @@
 Test repo.anyrevs with customized revset overrides
 
   $ cat > $TESTTMP/printprevset.py <<EOF
-  > from mercurial import encoding
-  > def reposetup(ui, repo):
+  > from mercurial import encoding, registrar
+  > cmdtable = {}
+  > command = registrar.command(cmdtable)
+  > @command('printprevset')
+  > def printprevset(ui, repo):
   >     alias = {}
   >     p = encoding.environ.get('P')
   >     if p:
   >         alias['P'] = p
   >     revs = repo.anyrevs(['P'], user=True, localalias=alias)
-  >     ui.write('P=%r' % list(revs))
+  >     ui.write('P=%r\n' % list(revs))
   > EOF
 
   $ cat >> .hg/hgrc <<EOF
@@ -4452,9 +4455,9 @@
   > printprevset = $TESTTMP/printprevset.py
   > EOF
 
-  $ hg --config revsetalias.P=1 log -r . -T '\n'
+  $ hg --config revsetalias.P=1 printprevset
   P=[1]
-  $ P=3 hg --config revsetalias.P=2 log -r . -T '\n'
+  $ P=3 hg --config revsetalias.P=2 printprevset
   P=[3]
 
   $ cd ..