Patchwork [3,of,3] test-glog: hook cmdutil.getlogrevs() so -frREV is rewritten accordingly

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 7, 2018, 6:31 a.m.
Message ID <9aa28a9a49871922fd48.1515306685@mimosa>
Download mbox | patch
Permalink /patch/26593/
State Accepted
Headers show

Comments

Yuya Nishihara - Jan. 7, 2018, 6:31 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1515036655 -32400
#      Thu Jan 04 12:30:55 2018 +0900
# Node ID 9aa28a9a49871922fd48f1ff6811573a191d47f9
# Parent  fb998a6d3e5af902012c680aa7b0cd5e1e718be7
test-glog: hook cmdutil.getlogrevs() so -frREV is rewritten accordingly

Before, these tests didn't match the real behavior of "log -frREV".

Patch

diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -98,21 +98,23 @@  o  (0) root
   >     return cmdutil._makelogrevset(repo, pats, opts, revs)[0]
   > 
   > def uisetup(ui):
-  >     def printrevset(orig, ui, repo, *pats, **opts):
+  >     def printrevset(orig, repo, pats, opts):
+  >         revs, filematcher = orig(repo, pats, opts)
   >         if opts.get('print_revset'):
-  >             revs = cmdutil.getlogrevs(repo, pats, opts)[0]
   >             expr = logrevset(repo, pats, opts)
   >             if expr:
   >                 tree = revsetlang.parse(expr)
   >                 tree = revsetlang.analyze(tree)
   >             else:
   >                 tree = []
+  >             ui = repo.ui
   >             ui.write('%r\n' % (opts.get('rev', []),))
   >             ui.write(revsetlang.prettyformat(tree) + '\n')
   >             ui.write(smartset.prettyformat(revs) + '\n')
-  >             return 0
-  >         return orig(ui, repo, *pats, **opts)
-  >     entry = extensions.wrapcommand(commands.table, 'log', printrevset)
+  >             revs = smartset.baseset()  # display no revisions
+  >         return revs, filematcher
+  >     extensions.wrapfunction(cmdutil, 'getlogrevs', printrevset)
+  >     aliases, entry = cmdutil.findcmd('log', commands.table)
   >     entry[1].append(('', 'print-revset', False,
   >                      'print generated revset and exit (DEPRECATED)'))
   > EOF
@@ -2304,15 +2306,9 @@  changessincelatesttag with no prior tag
   -f
   +g
   $ testlog --follow -r6 -r8 -r5 -r7 -r4
-  ['6', '8', '5', '7', '4']
-  (func
-    (symbol 'descendants')
-    (func
-      (symbol 'rev')
-      (symbol '6')))
-  <filteredset
-    <baseset- [4, 5, 6, 7, 8]>,
-    <generatorsetasc+>>
+  ['reverse(::(((6) or (8)) or ((5) or ((7) or (4)))))']
+  []
+  <generatorsetdesc->
 
 Test --follow-first and forward --rev
 
@@ -2337,15 +2333,9 @@  Test --follow-first and forward --rev
 Test --follow and backward --rev
 
   $ testlog --follow -r6 -r5 -r7 -r8 -r4
-  ['6', '5', '7', '8', '4']
-  (func
-    (symbol 'ancestors')
-    (func
-      (symbol 'rev')
-      (symbol '6')))
-  <filteredset
-    <baseset- [4, 5, 6, 7, 8]>,
-    <generatorsetdesc+>>
+  ['reverse(::(((6) or (5)) or ((7) or ((8) or (4)))))']
+  []
+  <generatorsetdesc->
 
 Test --follow-first and backward --rev