D2401: stack: introduce an option to disable the restriction on ancestor
lothiraldan updated this revision to Diff 7734. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2401?vs=6217&id=7734 REVISION DETAIL https://phab.mercurial-scm.org/D2401 AFFECTED FILES mercurial/configitems.py mercurial/stack.py CHANGE DETAILS diff --git a/mercurial/stack.py b/mercurial/stack.py --- a/mercurial/stack.py +++ b/mercurial/stack.py @@ -12,28 +12,34 @@ scmutil, ) -baserevspec = "only(%s) and not public()" +baserevspec = "not public()" def getstack(repo, rev=None): """return a sorted smartrev of the stack containing either rev if it is not None or the current working directory parent. -The stack will always contain all drafts changesets which are ancestors to -the revision. +The stack will always contain all drafts changesets. There are several config options to restrict the changesets that will be part of the stack: [stack] not-merge = (boolean) # The stack will contains only non-merge changesets # 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: rev = '.' -revspecargs = [revsetlang.formatspec(baserevspec, rev)] +revspecargs = [baserevspec] 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"): revspecargs.append("not ::merge()") revspec.append("%r") diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -965,6 +965,9 @@ coreconfigitem('stack', 'not-merge', default=True, ) +coreconfigitem('stack', 'restrict-ancestors', +default=True, +) coreconfigitem('subrepos', 'allowed', default=dynamicdefault, # to make backporting simpler ) To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2401: stack: introduce an option to disable the restriction on ancestor
lothiraldan updated this revision to Diff 6217. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2401?vs=6015&id=6217 REVISION DETAIL https://phab.mercurial-scm.org/D2401 AFFECTED FILES mercurial/configitems.py mercurial/stack.py CHANGE DETAILS diff --git a/mercurial/stack.py b/mercurial/stack.py --- a/mercurial/stack.py +++ b/mercurial/stack.py @@ -12,28 +12,34 @@ scmutil, ) -baserevspec = "only(%s) and not public()" +baserevspec = "not public()" def getstack(repo, rev=None): """return a sorted smartrev of the stack containing either rev if it is not None or the current working directory parent. -The stack will always contain all drafts changesets which are ancestors to -the revision. +The stack will always contain all drafts changesets. There are several config options to restrict the changesets that will be part of the stack: [stack] not-merge = (boolean) # The stack will contains only non-merge changesets # 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: rev = '.' -revspecargs = [revsetlang.formatspec(baserevspec, rev)] +revspecargs = [baserevspec] 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"): revspecargs.append("not ::merge()") revspec.append("%r") diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -950,6 +950,9 @@ coreconfigitem('stack', 'not-merge', default=True, ) +coreconfigitem('stack', 'restrict-ancestors', +default=True, +) coreconfigitem('subrepos', 'allowed', default=dynamicdefault, # to make backporting simpler ) To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2401: stack: introduce an option to disable the restriction on ancestor
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 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. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2401 AFFECTED FILES mercurial/configitems.py mercurial/stack.py CHANGE DETAILS diff --git a/mercurial/stack.py b/mercurial/stack.py --- a/mercurial/stack.py +++ b/mercurial/stack.py @@ -9,28 +9,34 @@ from . import revsetlang, scmutil -baserevspec = "only(%s) and not public()" +baserevspec = "not public()" def getstack(repo, rev=None): """return a sorted smartrev of the stack containing either rev if it is not None or the current working directory parent. -The stack will always contain all drafts changesets which are ancestors to -the revision. +The stack will always contain all drafts changesets. There are several config options to restrict the changesets that will be part of the stack: [stack] not-merge = (boolean) # The stack will contains only non-merge changesets # 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: rev = '.' -revspecargs = [revsetlang.formatspec(baserevspec, rev)] +revspecargs = [baserevspec] 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"): revspecargs.append("not ::merge()") revspec.append("%r") diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -953,6 +953,9 @@ coreconfigitem('stack', 'not-merge', default=True, ) +coreconfigitem('stack', 'restrict-ancestors', +default=True, +) coreconfigitem('subrepos', 'allowed', default=dynamicdefault, # to make backporting simpler ) To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel