##// END OF EJS Templates
stack: add a new module for stack-related commands...
Boris Feld -
r37018:40583c7a default
parent child Browse files
Show More
@@ -0,0 +1,27 b''
1 # stack.py - Mercurial functions for stack definition
2 #
3 # Copyright Matt Mackall <mpm@selenic.com> and other
4 #
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
7
8 from __future__ import absolute_import
9
10 from . import (
11 revsetlang,
12 scmutil,
13 )
14
15 def getstack(repo, rev=None):
16 """return a smartrev of the stack containing either rev if it is not None
17 or the current working directory parent.
18
19 The stack will always contain all drafts changesets which are ancestors to
20 the revision and are not merges.
21 """
22 if rev is None:
23 rev = '.'
24
25 revspec = 'reverse(only(%s) and not public() and not ::merge())'
26 revset = revsetlang.formatspec(revspec, rev)
27 return scmutil.revrange(repo, [revset])
General Comments 0
You need to be logged in to leave comments. Login now