comparison mercurial/cmdutil.py @ 34852:d45236f3d38e

log: add obsfate by default in changeset printer Having an obsfate by default in log will be useful for users to understand why they have obsolete and unstable changesets. Obsfate will only be shown for obsolete changesets, which only happens if people opt-in to experimental feature. But when obsolete changeset are visible, it is very useful to understand where they are. Having it in log could be sufficient for most people, so they don't have to learn a new command (like obslog which is itself useful in case of divergences). For example, when pulling and working directory parent become obsolete: $ hg pull ... working directory parent is obsolete! (f936c1697205) This message comes from the Evolve extension. Obsfate would comes handy: $ hg log -G o changeset: 2:6f91013c5136 | tag: tip | parent: 0:4ef7b558f3ec | user: Boris Feld <boris.feld@octobus.net> | date: Mon Oct 09 16:00:27 2017 +0200 | summary: A | | @ changeset: 1:f936c1697205 |/ user: Boris Feld <boris.feld@octobus.net> | date: Mon Oct 09 16:00:27 2017 +0200 | obsfate: rewritten using amend as 2:6f91013c5136 | summary: -A | o changeset: 0:feb4dd822b8c user: Boris Feld <boris.feld@octobus.net> date: Tue Oct 09 16:00:00 2017 +0200 summary: ROOT And once we update, we don't have an obsolete changeset in the log anymore so we don't show obsfate anymore, most users won't see obsfate often if they don't have obsolete changeset often: @ changeset: 2:6f91013c5136 | tag: tip | parent: 0:4ef7b558f3ec | user: Boris Feld <boris.feld@octobus.net> | date: Mon Oct 09 16:00:27 2017 +0200 | summary: A | o changeset: 0:feb4dd822b8c user: Boris Feld <boris.feld@octobus.net> date: Tue Oct 09 16:00:00 2017 +0200 summary: ROOT
author Boris Feld <boris.feld@octobus.net>
date Thu, 05 Oct 2017 15:25:18 +0200
parents 5781e0931c16
children 890afefa7296
comparison
equal deleted inserted replaced
34851:6f53a53245a2 34852:d45236f3d38e
1663 # i18n: column positioning for "hg log" 1663 # i18n: column positioning for "hg log"
1664 instabilities = ctx.instabilities() 1664 instabilities = ctx.instabilities()
1665 self.ui.write(_("instability: %s\n") % ', '.join(instabilities), 1665 self.ui.write(_("instability: %s\n") % ', '.join(instabilities),
1666 label='log.instability') 1666 label='log.instability')
1667 1667
1668 elif ctx.obsolete():
1669 self._showobsfate(ctx)
1670
1668 self._exthook(ctx) 1671 self._exthook(ctx)
1669 1672
1670 if self.ui.debugflag: 1673 if self.ui.debugflag:
1671 files = ctx.p1().status(ctx)[:3] 1674 files = ctx.p1().status(ctx)[:3]
1672 for key, value in zip([# i18n: column positioning for "hg log" 1675 for key, value in zip([# i18n: column positioning for "hg log"
1710 description.splitlines()[0], 1713 description.splitlines()[0],
1711 label='log.summary') 1714 label='log.summary')
1712 self.ui.write("\n") 1715 self.ui.write("\n")
1713 1716
1714 self.showpatch(ctx, matchfn) 1717 self.showpatch(ctx, matchfn)
1718
1719 def _showobsfate(self, ctx):
1720 obsfate = templatekw.showobsfate(repo=self.repo, ctx=ctx, ui=self.ui)
1721
1722 if obsfate:
1723 for obsfateline in obsfate:
1724 # i18n: column positioning for "hg log"
1725 self.ui.write(_("obsfate: %s\n") % obsfateline,
1726 label='log.obsfate')
1715 1727
1716 def _exthook(self, ctx): 1728 def _exthook(self, ctx):
1717 '''empty method used by extension as a hook point 1729 '''empty method used by extension as a hook point
1718 ''' 1730 '''
1719 1731