The default stack revset restrict on only the ancestors of a revision. Some
tools might want to display the current stack even if the working directory
parent is in the middle of the stack.
Add the stack.restrict-ancestors option to disable that.
| hg-reviewers |
The default stack revset restrict on only the ancestors of a revision. Some
tools might want to display the current stack even if the working directory
parent is in the middle of the stack.
Add the stack.restrict-ancestors option to disable that.
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/configitems.py (3 lines) | |||
| M | mercurial/stack.py (14 lines) |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | lothiraldan | ||
| Closed | lothiraldan | ||
| Abandoned | lothiraldan | ||
| Abandoned | lothiraldan | ||
| Abandoned | lothiraldan | ||
| Abandoned | lothiraldan | ||
| Closed | lothiraldan | ||
| Closed | lothiraldan | ||
| Closed | lothiraldan | ||
| Closed | lothiraldan | ||
| Closed | lothiraldan |
| default=None, | default=None, | ||||
| ) | ) | ||||
| coreconfigitem('sparse', 'missingwarning', | coreconfigitem('sparse', 'missingwarning', | ||||
| default=True, | default=True, | ||||
| ) | ) | ||||
| coreconfigitem('stack', 'not-merge', | coreconfigitem('stack', 'not-merge', | ||||
| default=True, | default=True, | ||||
| ) | ) | ||||
| coreconfigitem('stack', 'restrict-ancestors', | |||||
| default=True, | |||||
| ) | |||||
| coreconfigitem('subrepos', 'allowed', | coreconfigitem('subrepos', 'allowed', | ||||
| default=dynamicdefault, # to make backporting simpler | default=dynamicdefault, # to make backporting simpler | ||||
| ) | ) | ||||
| coreconfigitem('subrepos', 'hg:allowed', | coreconfigitem('subrepos', 'hg:allowed', | ||||
| default=dynamicdefault, | default=dynamicdefault, | ||||
| ) | ) | ||||
| coreconfigitem('subrepos', 'git:allowed', | coreconfigitem('subrepos', 'git:allowed', | ||||
| default=dynamicdefault, | default=dynamicdefault, | ||||
| # stack.py - Mercurial functions for stack definition | # stack.py - Mercurial functions for stack definition | ||||
| # | # | ||||
| # Copyright Matt Mackall <mpm@selenic.com> and other | # Copyright Matt Mackall <mpm@selenic.com> and other | ||||
| # | # | ||||
| # This software may be used and distributed according to the terms of the | # This software may be used and distributed according to the terms of the | ||||
| # GNU General Public License version 2 or any later version. | # GNU General Public License version 2 or any later version. | ||||
| from __future__ import absolute_import | from __future__ import absolute_import | ||||
| from . import ( | from . import ( | ||||
| revsetlang, | revsetlang, | ||||
| scmutil, | scmutil, | ||||
| ) | ) | ||||
| baserevspec = "only(%s) and not public()" | baserevspec = "not public()" | ||||
| def getstack(repo, rev=None): | def getstack(repo, rev=None): | ||||
| """return a sorted smartrev of the stack containing either rev if it is | """return a sorted smartrev of the stack containing either rev if it is | ||||
| not None or the current working directory parent. | not None or the current working directory parent. | ||||
| The stack will always contain all drafts changesets which are ancestors to | The stack will always contain all drafts changesets. | ||||
| the revision. | |||||
| There are several config options to restrict the changesets that will be | There are several config options to restrict the changesets that will be | ||||
| part of the stack: | part of the stack: | ||||
| [stack] | [stack] | ||||
| not-merge = (boolean) # The stack will contains only non-merge changesets | not-merge = (boolean) # The stack will contains only non-merge changesets | ||||
| # if set to True (default: True) | # if set to True (default: True) | ||||
| restrict-ancestors = (boolean) # The stack will contain only the | |||||
| # ancestors of the revision if set to True | |||||
| # (default: True) | |||||
| """ | """ | ||||
| if rev is None: | if rev is None: | ||||
| rev = '.' | rev = '.' | ||||
| revspecargs = [revsetlang.formatspec(baserevspec, rev)] | revspecargs = [baserevspec] | ||||
| revspec = ["%r"] | revspec = ["%r"] | ||||
| if repo.ui.configbool("stack", "restrict-ancestors"): | |||||
| revspecargs.append(revsetlang.formatspec("only(%s)", rev)) | |||||
| revspec.append("%r") | |||||
| if repo.ui.configbool("stack", "not-merge"): | if repo.ui.configbool("stack", "not-merge"): | ||||
| revspecargs.append("not ::merge()") | revspecargs.append("not ::merge()") | ||||
| revspec.append("%r") | revspec.append("%r") | ||||
| finalrevspec = " and ".join(revspec) | finalrevspec = " and ".join(revspec) | ||||
| revset = revsetlang.formatspec(finalrevspec, *revspecargs) | revset = revsetlang.formatspec(finalrevspec, *revspecargs) | ||||
| revisions = scmutil.revrange(repo, [revset]) | revisions = scmutil.revrange(repo, [revset]) | ||||
| revisions.sort() | revisions.sort() | ||||
| return revisions | return revisions | ||||