D4252: tests: port test-glog.t to Python 3 by using extracted printrevset

2018-08-10 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2e37bd614879: tests: port test-glog.t to Python 3 by using 
extracted printrevset (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4252?vs=10304&id=10312

REVISION DETAIL
  https://phab.mercurial-scm.org/D4252

AFFECTED FILES
  contrib/python3-whitelist
  tests/test-glog.t

CHANGE DETAILS

diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -81,49 +81,8 @@
   >   hg commit -Aqd "$rev 0" -m "($rev) $msg"
   > }
 
-  $ cat > printrevset.py < from __future__ import absolute_import
-  > from mercurial import (
-  >   cmdutil,
-  >   commands,
-  >   extensions,
-  >   logcmdutil,
-  >   revsetlang,
-  >   smartset,
-  > )
-  > from mercurial.utils import stringutil
-  > 
-  > def logrevset(repo, pats, opts):
-  > revs = logcmdutil._initialrevs(repo, opts)
-  > if not revs:
-  > return None
-  > match, pats, slowpath = logcmdutil._makematcher(repo, revs, pats, opts)
-  > return logcmdutil._makerevset(repo, match, pats, slowpath, opts)
-  > 
-  > def uisetup(ui):
-  > def printrevset(orig, repo, pats, opts):
-  > revs, filematcher = orig(repo, pats, opts)
-  > if opts.get(b'print_revset'):
-  > expr = logrevset(repo, pats, opts)
-  > if expr:
-  > tree = revsetlang.parse(expr)
-  > tree = revsetlang.analyze(tree)
-  > else:
-  > tree = []
-  > ui = repo.ui
-  > ui.write(b'%r\n' % (opts.get(b'rev', []),))
-  > ui.write(revsetlang.prettyformat(tree) + b'\n')
-  > ui.write(stringutil.prettyrepr(revs) + b'\n')
-  > revs = smartset.baseset()  # display no revisions
-  > return revs, filematcher
-  > extensions.wrapfunction(logcmdutil, 'getrevs', printrevset)
-  > aliases, entry = cmdutil.findcmd(b'log', commands.table)
-  > entry[1].append((b'', b'print-revset', False,
-  >  b'print generated revset and exit (DEPRECATED)'))
-  > EOF
-
   $ echo "[extensions]" >> $HGRCPATH
-  $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH
+  $ echo "printrevset=$TESTDIR/printrevset.py" >> $HGRCPATH
 
   $ hg init repo
   $ cd repo
@@ -1890,7 +1849,7 @@
 ,
 >
   $ testlog -r "sort(file('set:copied()'), -rev)"
-  ["sort(file('set:copied()'), -rev)"]
+  ['sort(file(\'set:copied()\'), -rev)']
   []
   ,
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -185,6 +185,7 @@
 test-git-export.t
 test-glog-beautifygraph.t
 test-glog-topological.t
+test-glog.t
 test-gpg.t
 test-graft.t
 test-grep.t



To: durin42, pulkit, #hg-reviewers
Cc: mjpieters, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4252: tests: port test-glog.t to Python 3 by using extracted printrevset

2018-08-10 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: pulkit.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4252

AFFECTED FILES
  contrib/python3-whitelist
  tests/test-glog.t

CHANGE DETAILS

diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -81,49 +81,8 @@
   >   hg commit -Aqd "$rev 0" -m "($rev) $msg"
   > }
 
-  $ cat > printrevset.py < from __future__ import absolute_import
-  > from mercurial import (
-  >   cmdutil,
-  >   commands,
-  >   extensions,
-  >   logcmdutil,
-  >   revsetlang,
-  >   smartset,
-  > )
-  > from mercurial.utils import stringutil
-  > 
-  > def logrevset(repo, pats, opts):
-  > revs = logcmdutil._initialrevs(repo, opts)
-  > if not revs:
-  > return None
-  > match, pats, slowpath = logcmdutil._makematcher(repo, revs, pats, opts)
-  > return logcmdutil._makerevset(repo, match, pats, slowpath, opts)
-  > 
-  > def uisetup(ui):
-  > def printrevset(orig, repo, pats, opts):
-  > revs, filematcher = orig(repo, pats, opts)
-  > if opts.get(b'print_revset'):
-  > expr = logrevset(repo, pats, opts)
-  > if expr:
-  > tree = revsetlang.parse(expr)
-  > tree = revsetlang.analyze(tree)
-  > else:
-  > tree = []
-  > ui = repo.ui
-  > ui.write(b'%r\n' % (opts.get(b'rev', []),))
-  > ui.write(revsetlang.prettyformat(tree) + b'\n')
-  > ui.write(stringutil.prettyrepr(revs) + b'\n')
-  > revs = smartset.baseset()  # display no revisions
-  > return revs, filematcher
-  > extensions.wrapfunction(logcmdutil, 'getrevs', printrevset)
-  > aliases, entry = cmdutil.findcmd(b'log', commands.table)
-  > entry[1].append((b'', b'print-revset', False,
-  >  b'print generated revset and exit (DEPRECATED)'))
-  > EOF
-
   $ echo "[extensions]" >> $HGRCPATH
-  $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH
+  $ echo "printrevset=$TESTDIR/printrevset.py" >> $HGRCPATH
 
   $ hg init repo
   $ cd repo
@@ -1890,7 +1849,7 @@
 ,
 >
   $ testlog -r "sort(file('set:copied()'), -rev)"
-  ["sort(file('set:copied()'), -rev)"]
+  ['sort(file(\'set:copied()\'), -rev)']
   []
   ,
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -185,6 +185,7 @@
 test-git-export.t
 test-glog-beautifygraph.t
 test-glog-topological.t
+test-glog.t
 test-gpg.t
 test-graft.t
 test-grep.t



To: durin42, pulkit, #hg-reviewers
Cc: mjpieters, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel