diff src/topic/revset.py @ 1870:8dd5200b4086

topic: introduce a 'ngtip' concept The concept is to be massively used in naming and default destination logic. The name is horrible so that people find a better one.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 21 Oct 2015 01:12:32 +0200
parents 558dd43b599d
children
line wrap: on
line diff
--- a/src/topic/revset.py	Thu Oct 08 21:09:47 2015 -0700
+++ b/src/topic/revset.py	Wed Oct 21 01:12:32 2015 +0200
@@ -1,7 +1,7 @@
 from mercurial import revset
 from mercurial import util
 
-from . import constants
+from . import constants, destination
 
 try:
     mkmatcher = revset._stringmatcher
@@ -31,5 +31,20 @@
     return drafts.filter(
         lambda r: matcher(repo[r].extra().get(constants.extrakey, '')))
 
+def ngtipset(repo, subset, x):
+    """`ngtip([branch])`
+
+    The untopiced tip.
+
+    Name is horrible so that people change it.
+    """
+    args = revset.getargs(x, 1, 1, 'topic takes one')
+    # match a specific topic
+    branch = revset.getstring(args[0], 'ngtip() argument must be a string')
+    if branch == '.':
+        branch = repo['.'].branch()
+    return subset & destination.ngtip(repo, branch)
+
 def modsetup():
     revset.symbols.update({'topic': topicset})
+    revset.symbols.update({'ngtip': ngtipset})