[PATCH 1 of 2 v2] context: add obsolete() method to basefilectx

Anton Shestakov av6 at dwimlabs.net
Fri Nov 17 23:41:05 EST 2017


# HG changeset patch
# User Anton Shestakov <av6 at dwimlabs.net>
# Date 1510977537 -28800
#      Sat Nov 18 11:58:57 2017 +0800
# Node ID f7de3640058b0cef36a1af5b237827a922e84ca2
# Parent  f1e997d4a24fb59ddd33c3780104dc002f870f5c
# EXP-Topic hgweb-more-info
context: add obsolete() method to basefilectx

This method is now used in webutils.commonentry(), which adds common data items
(commit hash, author, date, etc) for rendering changesets in hgweb. Usually,
commonentry() is given a changectx as ctx; but in views related to files (e.g.
file view, diff, annotate) it's replaced by a filectx, so the latter also needs
to have obsolete() method.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -819,6 +819,8 @@ class basefilectx(object):
         return self._changectx.phase()
     def phasestr(self):
         return self._changectx.phasestr()
+    def obsolete(self):
+        return self._changectx.obsolete()
     def manifest(self):
         return self._changectx.manifest()
     def changectx(self):
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -361,6 +361,7 @@ def commonentry(repo, ctx):
         'date': ctx.date(),
         'extra': ctx.extra(),
         'phase': ctx.phasestr(),
+        'obsolete': ctx.obsolete(),
         'branch': nodebranchnodefault(ctx),
         'inbranch': nodeinbranch(repo, ctx),
         'branches': nodebranchdict(repo, ctx),


More information about the Mercurial-devel mailing list