D2403: stack: remove destutil.stackbase

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2403?vs=6219=7736

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

AFFECTED FILES
  hgext/show.py
  mercurial/destutil.py

CHANGE DETAILS

diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -357,10 +357,6 @@
 
 return None
 
-def stackbase(ui, repo):
-revs = stack.getstack(repo)
-return revs.first() if revs else None
-
 def _statusotherbook(ui, repo):
 bmheads = bookmarks.headsforactive(repo)
 curhead = repo[repo._activebookmark].node()
diff --git a/hgext/show.py b/hgext/show.py
--- a/hgext/show.py
+++ b/hgext/show.py
@@ -35,7 +35,6 @@
 from mercurial import (
 cmdutil,
 commands,
-destutil,
 error,
 formatter,
 graphmod,
@@ -45,6 +44,7 @@
 registrar,
 revset,
 revsetlang,
+stack
 )
 
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
@@ -193,17 +193,17 @@
'changeset)\n'))
 return
 
-# TODO extract "find stack" into a function to facilitate
-# customization and reuse.
-
-baserev = destutil.stackbase(ui, repo)
 basectx = None
 
+_stack = stack.getstack(repo)
+baserev = _stack.first()
+
+# TODO doesn't yet handle case where wdir is a draft merge
 if baserev is None:
 baserev = wdirctx.rev()
 stackrevs = {wdirctx.rev()}
 else:
-stackrevs = set(repo.revs('%d::.', baserev))
+stackrevs = set(_stack)
 
 ctx = repo[baserev]
 if ctx.p1().rev() != nullrev:



To: lothiraldan, #hg-reviewers
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2403: stack: remove destutil.stackbase

2018-03-01 Thread lothiraldan (Boris Feld)
lothiraldan added a comment.


  In https://phab.mercurial-scm.org/D2403#39460, @indygreg wrote:
  
  > Oh, I guess the series never did formerly define a revset for stack :/
  >
  > I think there is room for one. We have the ability to mark revsets as 
experimental or internal, right? Could/should we do that so we don't need `hg 
debugstack`?
  >
  > Anyway, I could probably queue this with some minor rework. But I'm going 
to hold off a bit and see if others have opinions.
  
  
  I have updated the series without using debugstack, thank you for the 
suggestion. I thought revset would were much harder to implement but turn out 
not so much harder.

REPOSITORY
  rHG Mercurial

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

To: lothiraldan, #hg-reviewers
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2403: stack: remove destutil.stackbase

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2403?vs=6017=6219

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

AFFECTED FILES
  hgext/show.py
  mercurial/destutil.py

CHANGE DETAILS

diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -357,10 +357,6 @@
 
 return None
 
-def stackbase(ui, repo):
-revs = stack.getstack(repo)
-return revs.first() if revs else None
-
 def _statusotherbook(ui, repo):
 bmheads = bookmarks.headsforactive(repo)
 curhead = repo[repo._activebookmark].node()
diff --git a/hgext/show.py b/hgext/show.py
--- a/hgext/show.py
+++ b/hgext/show.py
@@ -35,7 +35,6 @@
 from mercurial import (
 cmdutil,
 commands,
-destutil,
 error,
 formatter,
 graphmod,
@@ -45,6 +44,7 @@
 registrar,
 revset,
 revsetlang,
+stack
 )
 
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
@@ -193,17 +193,17 @@
'changeset)\n'))
 return
 
-# TODO extract "find stack" into a function to facilitate
-# customization and reuse.
-
-baserev = destutil.stackbase(ui, repo)
 basectx = None
 
+_stack = stack.getstack(repo)
+baserev = _stack.first()
+
+# TODO doesn't yet handle case where wdir is a draft merge
 if baserev is None:
 baserev = wdirctx.rev()
 stackrevs = {wdirctx.rev()}
 else:
-stackrevs = set(repo.revs('%d::.', baserev))
+stackrevs = set(_stack)
 
 ctx = repo[baserev]
 if ctx.p1().rev() != nullrev:



To: lothiraldan, #hg-reviewers
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2403: stack: remove destutil.stackbase

2018-02-23 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  Oh, I guess the series never did formerly define a revset for stack :/
  
  I think there is room for one. We have the ability to mark revsets as 
experimental or internal, right? Could/should we do that so we don't need `hg 
debugstack`?
  
  Anyway, I could probably queue this with some minor rework. But I'm going to 
hold off a bit and see if others have opinions.

REPOSITORY
  rHG Mercurial

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

To: lothiraldan, #hg-reviewers
Cc: indygreg, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2403: stack: remove destutil.stackbase

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

REVISION SUMMARY
  Use directly stack.getstack in show stack command. Remove destutil.stackbase.
  Import a TODO from the show stack in the code.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/show.py
  mercurial/destutil.py

CHANGE DETAILS

diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -357,10 +357,6 @@
 
 return None
 
-def stackbase(ui, repo):
-revs = stack.getstack(repo)
-return revs.first() if revs else None
-
 def _statusotherbook(ui, repo):
 bmheads = bookmarks.headsforactive(repo)
 curhead = repo[repo._activebookmark].node()
diff --git a/hgext/show.py b/hgext/show.py
--- a/hgext/show.py
+++ b/hgext/show.py
@@ -35,7 +35,6 @@
 from mercurial import (
 cmdutil,
 commands,
-destutil,
 error,
 formatter,
 graphmod,
@@ -45,6 +44,7 @@
 registrar,
 revset,
 revsetlang,
+stack
 )
 
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
@@ -193,17 +193,17 @@
'changeset)\n'))
 return
 
-# TODO extract "find stack" into a function to facilitate
-# customization and reuse.
-
-baserev = destutil.stackbase(ui, repo)
 basectx = None
 
+_stack = stack.getstack(repo)
+baserev = _stack.first()
+
+# TODO doesn't yet handle case where wdir is a draft merge
 if baserev is None:
 baserev = wdirctx.rev()
 stackrevs = {wdirctx.rev()}
 else:
-stackrevs = set(repo.revs('%d::.', baserev))
+stackrevs = set(_stack)
 
 ctx = repo[baserev]
 if ctx.p1().rev() != nullrev:



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