revset: reintroduce and experimental revset for update destination
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 15 Oct 2015 01:35:44 +0100
changeset 26713 a271925699d6
parent 26712 04176eaf911b
child 26714 9903261dcc81
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.
mercurial/revset.py
tests/test-update-branches.t
--- a/mercurial/revset.py	Wed Oct 14 15:11:53 2015 -0400
+++ b/mercurial/revset.py	Thu Oct 15 01:35:44 2015 +0100
@@ -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,
--- a/tests/test-update-branches.t	Wed Oct 14 15:11:53 2015 -0400
+++ b/tests/test-update-branches.t	Thu Oct 15 01:35:44 2015 +0100
@@ -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)