Patchwork [1,of,2,STABLE] revset: add test of compatibility layer introduced in bde426f18e0a

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 30, 2015, 2:08 p.m.
Message ID <03b6a2472e4e713f62e9.1422626881@mimosa>
Download mbox | patch
Permalink /patch/7576/
State Deferred
Headers show

Comments

Yuya Nishihara - Jan. 30, 2015, 2:08 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1422622680 -32400
#      Fri Jan 30 21:58:00 2015 +0900
# Branch stable
# Node ID 03b6a2472e4e713f62e91549ee166c04e547adb2
# Parent  6becb9dbca25057c6186e255a48dd2c2ce5701a5
revset: add test of compatibility layer introduced in bde426f18e0a

Patch

diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -1269,3 +1269,30 @@  test in problematic encoding
   3
 
   $ cd ..
+
+compatibility layer for old extension that does not know smartset
+
+  $ cat <<EOF > lset.py
+  > from mercurial import cmdutil, revset
+  > cmdtable = {}
+  > command = cmdutil.command(cmdtable)
+  > @command('matchlist')
+  > def matchlist(ui, repo, expr):
+  >     mf = revset.match(ui, expr)
+  >     for c in mf(repo, range(len(repo))):
+  >         ui.write('%s\n' % c)
+  > def aslist(repo, subset, x):
+  >     revset.getargs(x, 0, 0, 'aslist takes no argument')
+  >     return list(subset)
+  > def uisetup(ui):
+  >     revset.symbols['aslist'] = aslist
+  > EOF
+
+  $ cd repo
+
+  $ hg --config extensions.lset=../lset.py matchlist 'p1()'
+  9
+  $ hg --config extensions.lset=../lset.py debugrevspec 'min(aslist())'
+  0
+
+  $ cd ..