Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/obsutil.py @ 33930:e278d6d2d7d2
template: add minimal obsfate template function
The goal of this series is to have templates capable of displaying the
evolution of a changeset in a clean and human-readable way.
Add the succsandmarkers template return successors and markers so it can be
used separately like this:
> {succsandmarkers % "{get(succsandmarkers, "markers")|json};"}
The following patches will add template functions that takes successors and
markers as inputs and compute various obsfate fields from them.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 17 Aug 2017 18:26:11 +0200 |
parents | 34e10e09afa5 |
children | c0bbaefc2c5a |
comparison
equal
deleted
inserted
replaced
33929:34e10e09afa5 | 33930:e278d6d2d7d2 |
---|---|
565 final.append(listversion) | 565 final.append(listversion) |
566 seen.append((setversion, listversion)) | 566 seen.append((setversion, listversion)) |
567 final.reverse() # put small successors set first | 567 final.reverse() # put small successors set first |
568 cache[current] = final | 568 cache[current] = final |
569 return cache[initialnode] | 569 return cache[initialnode] |
570 | |
571 def successorsandmarkers(repo, ctx): | |
572 """compute the raw data needed for computing obsfate | |
573 Returns a list of dict, one dict per successors set | |
574 """ | |
575 if not ctx.obsolete(): | |
576 return None | |
577 | |
578 ssets = successorssets(repo, ctx.node(), closest=True) | |
579 | |
580 values = [] | |
581 for sset in ssets: | |
582 values.append({'successors': sset, 'markers': sset.markers}) | |
583 | |
584 return values |