diff -r 439b4d005b4a -r c5a07a3abe7d mercurial/destutil.py --- a/mercurial/destutil.py Wed Jun 28 21:30:46 2017 -0400 +++ b/mercurial/destutil.py Sat Jul 01 22:38:42 2017 -0700 @@ -354,6 +354,12 @@ return None +def stackbase(ui, repo): + # The histedit default base stops at public changesets, branchpoints, + # and merges, which is exactly what we want for a stack. + revs = scmutil.revrange(repo, [histeditdefaultrevset]) + return revs.last() if revs else None + def _statusotherbook(ui, repo): bmheads = bookmarks.headsforactive(repo) curhead = repo[repo._activebookmark].node()