# HG changeset patch # User Denis Laxalde # Date 1491834221 -7200 # Node ID 604d31507f868d8d98bdcacb7e401950c8129869 # Parent 5e3b49defbff8f82ce8d906147a144e3c678937d hgweb: handle a "descend" query parameter in filelog command When this "descend" query parameter is present along with "linerange" parameter, we get revisions following line range in descending order. The parameter has no effect without "linerange". diff -r 5e3b49defbff -r 604d31507f86 mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py Mon Jan 16 09:24:47 2017 +0100 +++ b/mercurial/hgweb/webcommands.py Mon Apr 10 16:23:41 2017 +0200 @@ -979,6 +979,9 @@ patch = 'patch' in req.form if patch: lessvars['patch'] = morevars['patch'] = req.form['patch'][0] + descend = 'descend' in req.form + if descend: + lessvars['descend'] = morevars['descend'] = req.form['descend'][0] count = fctx.filerev() + 1 start = max(0, count - revcount) # first rev on this page @@ -1007,8 +1010,11 @@ # deactivate numeric nav links when linerange is specified as this # would required a dedicated "revnav" class nav = None - ancestors = context.blockancestors(fctx, *lrange) - for i, (c, lr) in enumerate(ancestors, 1): + if descend: + it = context.blockdescendants(fctx, *lrange) + else: + it = context.blockancestors(fctx, *lrange) + for i, (c, lr) in enumerate(it, 1): diffs = None if patch: diffs = diff(c, linerange=lr) @@ -1049,6 +1055,7 @@ nav=nav, symrev=webutil.symrevorshortnode(req, fctx), entries=entries, + descend=descend, patch=patch, latestentry=latestentry, linerange=linerange, diff -r 5e3b49defbff -r 604d31507f86 mercurial/templates/paper/filelog.tmpl --- a/mercurial/templates/paper/filelog.tmpl Mon Jan 16 09:24:47 2017 +0100 +++ b/mercurial/templates/paper/filelog.tmpl Mon Apr 10 16:23:41 2017 +0200 @@ -48,7 +48,7 @@ log {file|escape} @ {rev}:{node|short} {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag} {if(linerange, -' (following lines {linerange} back to filelog)')} +' (following lines {linerange}{if(descend, ', descending')} back to filelog)')} + + + + + + rss log