# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1444869344 -3600
#      Thu Oct 15 01:35:44 2015 +0100
# Node ID a271925699d66c340ce76f22663f2ece0aaa024a
# Parent  04176eaf911b79c07a79b29bef39f9ded868b4d7
revset: reintroduce and experimental revset for update destination

The revset is not ready for prime time yet. However it is useful to have some
version of it exposed to help candidate users to play with it and provide
feedback on what we should aim at.

We add a small test to make sure the code runs.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -12,6 +12,7 @@
 
 from .i18n import _
 from . import (
+    destutil,
     encoding,
     error,
     hbisect,
@@ -463,6 +464,11 @@
 
 # functions
 
+def _destupdate(repo, subset, x):
+    # experimental revset for update destination
+    args = getargsdict(x, 'limit', 'clean check')
+    return subset & baseset([destutil.destupdate(repo, **args)[0]])
+
 def _mergedefaultdest(repo, subset, x):
     # ``_mergedefaultdest()``
 
@@ -2142,6 +2148,7 @@
     return baseset([r for r in ls if r in s])
 
 symbols = {
+    "_destupdate": _destupdate,
     "_mergedefaultdest": _mergedefaultdest,
     "adds": adds,
     "all": getall,
diff --git a/tests/test-update-branches.t b/tests/test-update-branches.t
--- a/tests/test-update-branches.t
+++ b/tests/test-update-branches.t
@@ -260,3 +260,8 @@
   $ hg debugobsolete bd10386d478cd5a9faf2e604114c8e6da62d3889
   $ hg up
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Test experimental revset support
+
+  $ hg log -r '_destupdate()'
+  2:bd10386d478c 2 (no-eol)