--- a/hgext3rd/evolve/rewriteutil.py Sun Jul 23 05:42:41 2017 +0200
+++ b/hgext3rd/evolve/rewriteutil.py Sun Jul 23 06:11:33 2017 +0200
@@ -21,6 +21,7 @@
lock as lockmod,
obsolete,
phases,
+ repair,
revset,
)
@@ -77,6 +78,29 @@
hg.update(repo, prev)
commands.revert(ui, repo, rev=ctx.rev(), all=True)
+def reachablefrombookmark(repo, revs, bookmarks):
+ """filter revisions and bookmarks reachable from the given bookmark
+ yoinked from mq.py
+ """
+ repomarks = repo._bookmarks
+ if not bookmarks.issubset(repomarks):
+ raise error.Abort(_("bookmark '%s' not found") %
+ ','.join(sorted(bookmarks - set(repomarks.keys()))))
+
+ # If the requested bookmark is not the only one pointing to a
+ # a revision we have to only delete the bookmark and not strip
+ # anything. revsets cannot detect that case.
+ nodetobookmarks = {}
+ for mark, bnode in repomarks.iteritems():
+ nodetobookmarks.setdefault(bnode, []).append(mark)
+ for marks in nodetobookmarks.values():
+ if bookmarks.issuperset(marks):
+ rsrevs = repair.stripbmrevset(repo, marks[0])
+ revs = set(revs)
+ revs.update(set(rsrevs))
+ revs = sorted(revs)
+ return repomarks, revs
+
def rewrite(repo, old, updates, head, newbases, commitopts):
"""Return (nodeid, created) where nodeid is the identifier of the
changeset generated by the rewrite process, and created is True if