Patchwork [1,of,2,v3] context: add obsolete() method to basefilectx

login
register
mail settings
Submitter Anton Shestakov
Date Nov. 18, 2017, 7:34 a.m.
Message ID <880072944df7bb19b949.1510990464@neuro>
Download mbox | patch
Permalink /patch/25640/
State Accepted
Headers show

Comments

Anton Shestakov - Nov. 18, 2017, 7:34 a.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1510977537 -28800
#      Sat Nov 18 11:58:57 2017 +0800
# Node ID 880072944df7bb19b949d9a025a80e7def1a8525
# Parent  b437b4c6a7bec3aad936fcd56d6feda8d3b089d0
# 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.
Yuya Nishihara - Nov. 19, 2017, 3:51 a.m.
On Sat, 18 Nov 2017 15:34:24 +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <av6@dwimlabs.net>
> # Date 1510977537 -28800
> #      Sat Nov 18 11:58:57 2017 +0800
> # Node ID 880072944df7bb19b949d9a025a80e7def1a8525
> # Parent  b437b4c6a7bec3aad936fcd56d6feda8d3b089d0
> # EXP-Topic hgweb-more-info
> context: add obsolete() method to basefilectx

Looks good. Queued, thanks.

Patch

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),