D2398: histedit: use the new stack definition for histedit
lothiraldan marked an inline comment as done. lothiraldan added inline comments. INLINE COMMENTS > yuja wrote in destutil.py:356 > Can be `return revs.min()`? It seems so and it's much simpler to read. I have sent a follow-up: https://phab.mercurial-scm.org/D3137 REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2398 To: lothiraldan, #hg-reviewers, indygreg, durin42 Cc: yuja, indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2398: histedit: use the new stack definition for histedit
yuja added inline comments. INLINE COMMENTS > destutil.py:356 > +revs.sort() > +return revs.first() > Can be `return revs.min()`? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2398 To: lothiraldan, #hg-reviewers, indygreg, durin42 Cc: yuja, indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2398: histedit: use the new stack definition for histedit
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2987726085c6: histedit: use the new stack definition for histedit (authored by lothiraldan, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2398?vs=6214=7127 REVISION DETAIL https://phab.mercurial-scm.org/D2398 AFFECTED FILES hgext/histedit.py mercurial/destutil.py CHANGE DETAILS diff --git a/mercurial/destutil.py b/mercurial/destutil.py --- a/mercurial/destutil.py +++ b/mercurial/destutil.py @@ -340,18 +340,20 @@ onheadcheck=onheadcheck, destspace=destspace) return repo[node].rev() -histeditdefaultrevset = 'reverse(only(.) and not public() and not ::merge())' - def desthistedit(ui, repo): """Default base revision to edit for `hg histedit`.""" -default = ui.config('histedit', 'defaultrev', histeditdefaultrevset) -if default: +default = ui.config('histedit', 'defaultrev') + +if default is None: +revs = stack.getstack(repo) +elif default: revs = scmutil.revrange(repo, [default]) -if revs: -# The revset supplied by the user may not be in ascending order nor -# take the first revision. So do this manually. -revs.sort() -return revs.first() + +if revs: +# The revset supplied by the user may not be in ascending order nor +# take the first revision. So do this manually. +revs.sort() +return revs.first() return None diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -221,7 +221,7 @@ default=False, ) configitem('histedit', 'defaultrev', -default=configitem.dynamicdefault, +default=None, ) configitem('histedit', 'dropmissing', default=False, To: lothiraldan, #hg-reviewers, indygreg, durin42 Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2398: histedit: use the new stack definition for histedit
lothiraldan updated this revision to Diff 6214. Herald added a reviewer: durin42. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2398?vs=6012=6214 REVISION DETAIL https://phab.mercurial-scm.org/D2398 AFFECTED FILES hgext/histedit.py mercurial/destutil.py CHANGE DETAILS diff --git a/mercurial/destutil.py b/mercurial/destutil.py --- a/mercurial/destutil.py +++ b/mercurial/destutil.py @@ -340,18 +340,20 @@ onheadcheck=onheadcheck, destspace=destspace) return repo[node].rev() -histeditdefaultrevset = 'reverse(only(.) and not public() and not ::merge())' - def desthistedit(ui, repo): """Default base revision to edit for `hg histedit`.""" -default = ui.config('histedit', 'defaultrev', histeditdefaultrevset) -if default: +default = ui.config('histedit', 'defaultrev') + +if default is None: +revs = stack.getstack(repo) +elif default: revs = scmutil.revrange(repo, [default]) -if revs: -# The revset supplied by the user may not be in ascending order nor -# take the first revision. So do this manually. -revs.sort() -return revs.first() + +if revs: +# The revset supplied by the user may not be in ascending order nor +# take the first revision. So do this manually. +revs.sort() +return revs.first() return None diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -221,7 +221,7 @@ default=False, ) configitem('histedit', 'defaultrev', -default=configitem.dynamicdefault, +default=None, ) configitem('histedit', 'dropmissing', default=False, To: lothiraldan, #hg-reviewers, indygreg, durin42 Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2398: histedit: use the new stack definition for histedit
indygreg requested changes to this revision. indygreg added inline comments. This revision now requires changes to proceed. INLINE COMMENTS > destutil.py:345 > """Default base revision to edit for `hg histedit`.""" > -default = ui.config('histedit', 'defaultrev', histeditdefaultrevset) > -if default: > +default = ui.config('histedit', 'defaultrev', None) > + This means we can mark the default value for this option as `None`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2398 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
D2398: histedit: use the new stack definition for histedit
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Now that we have a common stack definition, use it in the hg histedit command. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2398 AFFECTED FILES mercurial/destutil.py CHANGE DETAILS diff --git a/mercurial/destutil.py b/mercurial/destutil.py --- a/mercurial/destutil.py +++ b/mercurial/destutil.py @@ -340,18 +340,20 @@ onheadcheck=onheadcheck, destspace=destspace) return repo[node].rev() -histeditdefaultrevset = 'reverse(only(.) and not public() and not ::merge())' - def desthistedit(ui, repo): """Default base revision to edit for `hg histedit`.""" -default = ui.config('histedit', 'defaultrev', histeditdefaultrevset) -if default: +default = ui.config('histedit', 'defaultrev', None) + +if default is None: +revs = stack.getstack(repo) +elif default: revs = scmutil.revrange(repo, [default]) -if revs: -# The revset supplied by the user may not be in ascending order nor -# take the first revision. So do this manually. -revs.sort() -return revs.first() + +if revs: +# The revset supplied by the user may not be in ascending order nor +# take the first revision. So do this manually. +revs.sort() +return revs.first() return None 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