D2402: stack: introduce an option to limit the selection on the current branch

2018-04-05 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 7735.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2402?vs=6218=7735

REVISION DETAIL
  https://phab.mercurial-scm.org/D2402

AFFECTED FILES
  mercurial/configitems.py
  mercurial/stack.py
  tests/test-stack.t

CHANGE DETAILS

diff --git a/tests/test-stack.t b/tests/test-stack.t
--- a/tests/test-stack.t
+++ b/tests/test-stack.t
@@ -51,6 +51,36 @@
   o  0 other draft c_a
   
 
+Check that stack show draft changesets from all branches by default
+---
+
+  $ hg log -G -r "stack()"
+  @  5 foo draft c_f
+  |
+  o  4 foo draft c_e
+  |
+  o  3 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  o  1 other draft c_b
+  |
+  o  0 other draft c_a
+  
+
+But not if we restrict on the branch
+
+  $ hg log -G -r "stack()" --config experimental.stack.same-branch=true
+  @  5 foo draft c_f
+  |
+  o  4 foo draft c_e
+  |
+  o  3 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  ~
+
 Check that stack doesn't include public changesets
 --
 
diff --git a/mercurial/stack.py b/mercurial/stack.py
--- a/mercurial/stack.py
+++ b/mercurial/stack.py
@@ -44,6 +44,10 @@
 revspecargs.append("not ::merge()")
 revspec.append("%r")
 
+if repo.ui.configbool("experimental", "stack.same-branch"):
+revspecargs.append(revsetlang.formatspec("branch(%s)", rev))
+revspec.append("%r")
+
 finalrevspec = " and ".join(revspec)
 revset = revsetlang.formatspec(finalrevspec, *revspecargs)
 revisions = scmutil.revrange(repo, [revset])
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -968,6 +968,9 @@
 coreconfigitem('stack', 'restrict-ancestors',
 default=True,
 )
+coreconfigitem('experimental', 'stack.same-branch',
+default=False,
+)
 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


D2402: stack: introduce an option to limit the selection on the current branch

2018-02-28 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 6218.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2402?vs=6016=6218

REVISION DETAIL
  https://phab.mercurial-scm.org/D2402

AFFECTED FILES
  mercurial/configitems.py
  mercurial/stack.py
  tests/test-stack.t

CHANGE DETAILS

diff --git a/tests/test-stack.t b/tests/test-stack.t
--- a/tests/test-stack.t
+++ b/tests/test-stack.t
@@ -51,6 +51,36 @@
   o  0 other draft c_a
   
 
+Check that stack show draft changesets from all branches by default
+---
+
+  $ hg log -G -r "stack()"
+  @  5 foo draft c_f
+  |
+  o  4 foo draft c_e
+  |
+  o  3 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  o  1 other draft c_b
+  |
+  o  0 other draft c_a
+  
+
+But not if we restrict on the branch
+
+  $ hg log -G -r "stack()" --config experimental.stack.same-branch=true
+  @  5 foo draft c_f
+  |
+  o  4 foo draft c_e
+  |
+  o  3 foo draft c_d
+  |
+  o  2 foo draft c_c
+  |
+  ~
+
 Check that stack doesn't include public changesets
 --
 
diff --git a/mercurial/stack.py b/mercurial/stack.py
--- a/mercurial/stack.py
+++ b/mercurial/stack.py
@@ -44,6 +44,10 @@
 revspecargs.append("not ::merge()")
 revspec.append("%r")
 
+if repo.ui.configbool("experimental", "stack.same-branch"):
+revspecargs.append(revsetlang.formatspec("branch(%s)", rev))
+revspec.append("%r")
+
 finalrevspec = " and ".join(revspec)
 revset = revsetlang.formatspec(finalrevspec, *revspecargs)
 revisions = scmutil.revrange(repo, [revset])
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -953,6 +953,9 @@
 coreconfigitem('stack', 'restrict-ancestors',
 default=True,
 )
+coreconfigitem('experimental', 'stack.same-branch',
+default=False,
+)
 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


D2402: stack: introduce an option to limit the selection on the current branch

2018-02-23 Thread lothiraldan (Boris Feld)
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2402

AFFECTED FILES
  mercurial/configitems.py
  mercurial/stack.py
  tests/test-stack.t

CHANGE DETAILS

diff --git a/tests/test-stack.t b/tests/test-stack.t
--- a/tests/test-stack.t
+++ b/tests/test-stack.t
@@ -51,6 +51,25 @@
   o  0 other draft c_a
   
 
+Check that stack show draft changesets from all branches by default
+---
+
+  $ hg debugstack
+  0
+  1
+  2
+  3
+  4
+  5
+
+But not if we restrict on the branch
+
+  $ hg debugstack --config experimental.stack.same-branch=true
+  2
+  3
+  4
+  5
+
 Check that stack doesn't include public changesets
 --
 
diff --git a/mercurial/stack.py b/mercurial/stack.py
--- a/mercurial/stack.py
+++ b/mercurial/stack.py
@@ -41,6 +41,10 @@
 revspecargs.append("not ::merge()")
 revspec.append("%r")
 
+if repo.ui.configbool("experimental", "stack.same-branch"):
+revspecargs.append(revsetlang.formatspec("branch(%s)", rev))
+revspec.append("%r")
+
 finalrevspec = " and ".join(revspec)
 revset = revsetlang.formatspec(finalrevspec, *revspecargs)
 revisions = scmutil.revrange(repo, [revset])
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -956,6 +956,9 @@
 coreconfigitem('stack', 'restrict-ancestors',
 default=True,
 )
+coreconfigitem('experimental', 'stack.same-branch',
+default=False,
+)
 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