D2399: stack: return a sorted smartrev by default

2018-04-05 Thread lothiraldan (Boris Feld)
lothiraldan marked an inline comment as done.
lothiraldan added inline comments.

INLINE COMMENTS

> yuja wrote in stack.py:25
> `reverse()` can be removed as well?

reverse is removed in the next commit https://phab.mercurial-scm.org/D2400

REPOSITORY
  rHG Mercurial

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

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


D2399: stack: return a sorted smartrev by default

2018-03-21 Thread yuja (Yuya Nishihara)
yuja added inline comments.

INLINE COMMENTS

> stack.py:25
>  
>  revspec = 'reverse(only(%s) and not public() and not ::merge())'
>  revset = revsetlang.formatspec(revspec, rev)

`reverse()` can be removed as well?

REPOSITORY
  rHG Mercurial

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

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


D2399: stack: return a sorted smartrev by default

2018-03-19 Thread lothiraldan (Boris Feld)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG68fcc5503ec5: stack: return a sorted smartrev by default 
(authored by lothiraldan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2399?vs=6215=7128

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

AFFECTED FILES
  mercurial/destutil.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
@@ -205,13 +205,13 @@
   ~
 Check the stack order
   $ hg log -r "first(stack())"
-  10 foo draft c_h
+  9 foo draft c_g
   $ hg log -r "first(stack(10))"
-  10 foo draft c_h
+  9 foo draft c_g
   $ hg log -r "first(stack(8))"
-  8 foo draft c_f
+  7 foo draft c_e
   $ hg log -r "first(stack(head()))"
-  8 foo draft c_f
+  7 foo draft c_e
 
 Case with multiple heads with unstability involved
 --
diff --git a/mercurial/stack.py b/mercurial/stack.py
--- a/mercurial/stack.py
+++ b/mercurial/stack.py
@@ -13,8 +13,8 @@
 )
 
 def getstack(repo, rev=None):
-"""return a smartrev of the stack containing either rev if it is not None
-or the current working directory parent.
+"""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 and are not merges.
@@ -24,4 +24,6 @@
 
 revspec = 'reverse(only(%s) and not public() and not ::merge())'
 revset = revsetlang.formatspec(revspec, rev)
-return scmutil.revrange(repo, [revset])
+revisions = scmutil.revrange(repo, [revset])
+revisions.sort()
+return revisions
diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -359,7 +359,7 @@
 
 def stackbase(ui, repo):
 revs = stack.getstack(repo)
-return revs.last() if revs else None
+return revs.first() if revs else None
 
 def _statusotherbook(ui, repo):
 bmheads = bookmarks.headsforactive(repo)



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


D2399: stack: return a sorted smartrev by default

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2399?vs=6013=6215

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

AFFECTED FILES
  mercurial/destutil.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
@@ -205,13 +205,13 @@
   ~
 Check the stack order
   $ hg log -r "first(stack())"
-  10 foo draft c_h
+  9 foo draft c_g
   $ hg log -r "first(stack(10))"
-  10 foo draft c_h
+  9 foo draft c_g
   $ hg log -r "first(stack(8))"
-  8 foo draft c_f
+  7 foo draft c_e
   $ hg log -r "first(stack(head()))"
-  8 foo draft c_f
+  7 foo draft c_e
 
 Case with multiple heads with unstability involved
 --
diff --git a/mercurial/stack.py b/mercurial/stack.py
--- a/mercurial/stack.py
+++ b/mercurial/stack.py
@@ -13,8 +13,8 @@
 )
 
 def getstack(repo, rev=None):
-"""return a smartrev of the stack containing either rev if it is not None
-or the current working directory parent.
+"""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 and are not merges.
@@ -24,4 +24,6 @@
 
 revspec = 'reverse(only(%s) and not public() and not ::merge())'
 revset = revsetlang.formatspec(revspec, rev)
-return scmutil.revrange(repo, [revset])
+revisions = scmutil.revrange(repo, [revset])
+revisions.sort()
+return revisions
diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -359,7 +359,7 @@
 
 def stackbase(ui, repo):
 revs = stack.getstack(repo)
-return revs.last() if revs else None
+return revs.first() if revs else None
 
 def _statusotherbook(ui, repo):
 bmheads = bookmarks.headsforactive(repo)



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


D2399: stack: return a sorted smartrev by default

2018-02-23 Thread indygreg (Gregory Szorc)
indygreg requested changes to this revision.
indygreg added a comment.
This revision now requires changes to proceed.


  Looks good. But only marking as needing changes because I think we may get 
rid of `hg debugstack`.

REPOSITORY
  rHG Mercurial

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

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


D2399: stack: return a sorted smartrev by default

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
  Most stack customers will display a list of revisions, sort it by default.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/destutil.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
@@ -57,8 +57,8 @@
   $ hg up other
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
   $ hg debugstack
+  0
   1
-  0
   $ hg phase --public 'branch("other")'
   $ hg debugstack
   $ hg up foo
@@ -72,10 +72,10 @@
   $ hg branch
   foo
   $ hg debugstack
+  2
+  3
+  4
   5
-  4
-  3
-  2
 
 Case with some of the branch unstable
 
@@ -105,8 +105,8 @@
   $ hg up -r "desc(c_e)"
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg debugstack
+  3
   4
-  3
   $ hg up -r "desc(c_d)"
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
 
@@ -167,13 +167,13 @@
 Test output
 
   $ hg debugstack
+  9
   10
-  9
   $ hg up 'desc(c_f)'
   2 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg debugstack
+  7
   8
-  7
 
 Case with multiple heads with unstability involved
 --
diff --git a/mercurial/stack.py b/mercurial/stack.py
--- a/mercurial/stack.py
+++ b/mercurial/stack.py
@@ -10,8 +10,8 @@
 from . import revsetlang, scmutil
 
 def getstack(repo, rev=None):
-"""return a smartrev of the stack containing either rev if it is not None
-or the current working directory parent.
+"""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 and are not merges.
@@ -21,4 +21,6 @@
 
 revspec = 'reverse(only(%s) and not public() and not ::merge())'
 revset = revsetlang.formatspec(revspec, rev)
-return scmutil.revrange(repo, [revset])
+revisions = scmutil.revrange(repo, [revset])
+revisions.sort()
+return revisions
diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -359,7 +359,7 @@
 
 def stackbase(ui, repo):
 revs = stack.getstack(repo)
-return revs.last() if revs else None
+return revs.first() if revs else None
 
 def _statusotherbook(ui, repo):
 bmheads = bookmarks.headsforactive(repo)



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