def showoldbookmarks(context, mapping, args): """List of Strings. Bookmarks that used to be at the changectx reverseindex repo states ago.""" reverseindex = templater.evalinteger( context, mapping, args[0], _("oldbookmarks needs an integer argument")) repo = mapping["ctx"]._repo ctx = mapping["ctx"] oldmarks = _oldmarks(repo, reverseindex) bookmarks = [] ctxhex = ctx.hex() for kv in oldmarks: if kv[1] == ctxhex: bookmarks.append(kv[0]) active = repo._activebookmark makemap = lambda v: {"bookmark": v, "active": active, "current": active} f = templatekw._showlist("bookmark", bookmarks, mapping) return templatekw._hybrid(f, bookmarks, makemap, lambda x: x["bookmark"])
def removedbookmarks(context, mapping, args): """List of Strings. Bookmarks that have been moved or removed from a given changectx by reverseindex repo state.""" reverseindex = templater.evalinteger( context, mapping, args[0], _("removedbookmarks needs an integer argument")) repo = mapping["ctx"]._repo ctx = mapping["ctx"] currentbookmarks = mapping["ctx"].bookmarks() oldmarks = _oldmarks(repo, reverseindex) oldbookmarks = [] ctxhex = ctx.hex() for kv in oldmarks: if kv[1] == ctxhex: oldbookmarks.append(kv[0]) bookmarks = list(set(currentbookmarks) - set(oldbookmarks)) active = repo._activebookmark makemap = lambda v: {"bookmark": v, "active": active, "current": active} f = templatekw._showlist("bookmark", bookmarks, mapping) return templatekw._hybrid(f, bookmarks, makemap, lambda x: x["bookmark"])