# HG changeset patch # User Anton Shestakov # Date 1420278621 -28800 # Node ID 9e1f4c65f5f57d3a844b466d566021afeb8b213a # Parent b8b246cffdee8b9fbb345ff62a2efda1e2929101 hgweb: allow viewing diffs against p1 or p2 for merge commits (issue3904) This adds UI portion of the feature that has resided in mercurial since 2012. Back then the interface was added together with the code, but was shortly backed out because it was deemed "not ready". Code, however, stayed. For the original feature and its implementation, see issue2810 and d605a82cf189. In short, the backed-out interface had two outstanding issues: 1. it was introducing an entirely new term (baseline) and 2. it was present on every changeset's page, even for changesets with 1 parent (or no parents), which didn't make sense This patch implements a hopefully better interface because: 1. it uses the usual terms (diff) and 2. it only shows up when there actually are 2 parents. diff -r b8b246cffdee -r 9e1f4c65f5f5 mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py Sun Dec 21 14:34:07 2014 -0800 +++ b/mercurial/hgweb/webcommands.py Sat Jan 03 17:50:21 2015 +0800 @@ -379,7 +379,7 @@ diff=diffs, rev=ctx.rev(), node=ctx.hex(), - parent=webutil.parents(ctx), + parent=tuple(webutil.parents(ctx)), child=webutil.children(ctx), basenode=basectx.hex(), changesettag=showtags, diff -r b8b246cffdee -r 9e1f4c65f5f5 mercurial/templates/coal/map --- a/mercurial/templates/coal/map Sun Dec 21 14:34:07 2014 -0800 +++ b/mercurial/templates/coal/map Sat Jan 03 17:50:21 2015 +0800 @@ -109,6 +109,12 @@ changesetparent = '{node|short} ' +changesetparentdiff = ' + {changesetparent} + {ifeq(node, basenode, '(current diff)', '({difffrom})')}' + +difffrom = 'diff' + filerevparent = '{rename%filerename}{node|short} ' filerevchild = '{node|short} ' diff -r b8b246cffdee -r 9e1f4c65f5f5 mercurial/templates/gitweb/changeset.tmpl --- a/mercurial/templates/gitweb/changeset.tmpl Sun Dec 21 14:34:07 2014 -0800 +++ b/mercurial/templates/gitweb/changeset.tmpl Sat Jan 03 17:50:21 2015 +0800 @@ -36,7 +36,7 @@ {date|rfc822date} {branch%changesetbranch} changeset {rev}{node|short} -{parent%changesetparent} +{ifeq(count(parent), '2', parent%changesetparentdiff, parent%changesetparent)} {child%changesetchild} diff -r b8b246cffdee -r 9e1f4c65f5f5 mercurial/templates/gitweb/map --- a/mercurial/templates/gitweb/map Sun Dec 21 14:34:07 2014 -0800 +++ b/mercurial/templates/gitweb/map Sat Jan 03 17:50:21 2015 +0800 @@ -127,14 +127,23 @@ {node|short} ' +changesetlink = '{node|short}' changesetbranch = 'branch{name|escape}' changesetparent = ' parent {rev} - {node|short} + {changesetlink} ' +changesetparentdiff = ' + + parent {rev} + + {changesetlink} {ifeq(node, basenode, '(current diff)', \'({difffrom})\')} + + ' +difffrom = 'diff' filerevbranch = 'branch{name|escape}' filerevparent = ' diff -r b8b246cffdee -r 9e1f4c65f5f5 mercurial/templates/monoblue/changeset.tmpl --- a/mercurial/templates/monoblue/changeset.tmpl Sun Dec 21 14:34:07 2014 -0800 +++ b/mercurial/templates/monoblue/changeset.tmpl Sat Jan 03 17:50:21 2015 +0800 @@ -48,7 +48,7 @@ {branch%changesetbranch}
changeset {rev}
{node|short}
- {parent%changesetparent} + {ifeq(count(parent), '2', parent%changesetparentdiff, parent%changesetparent)} {child%changesetchild} diff -r b8b246cffdee -r 9e1f4c65f5f5 mercurial/templates/monoblue/map --- a/mercurial/templates/monoblue/map Sun Dec 21 14:34:07 2014 -0800 +++ b/mercurial/templates/monoblue/map Sat Jan 03 17:50:21 2015 +0800 @@ -115,17 +115,22 @@ {rightlinenumber} {rightline|escape} ' +changesetlink = '{node|short}' changelogparent = ' parent {rev}: - {node|short} + {changesetlink} ' changesetbranch = '
branch
{name|escape}
' changesetparent = '
parent {rev}
-
{node|short}
' +
{changesetlink}
' +changesetparentdiff = ' +
parent {rev}
+
{changesetlink} {ifeq(node, basenode, '(current diff)', \'({difffrom})\')}
' +difffrom = 'diff' filerevbranch = '
branch
{name|escape}
' filerevparent = '
parent {rev}
diff -r b8b246cffdee -r 9e1f4c65f5f5 mercurial/templates/paper/changeset.tmpl --- a/mercurial/templates/paper/changeset.tmpl Sun Dec 21 14:34:07 2014 -0800 +++ b/mercurial/templates/paper/changeset.tmpl Sat Jan 03 17:50:21 2015 +0800 @@ -51,7 +51,7 @@ {date|rfc822date} parents - {parent%changesetparent} + {ifeq(count(parent), '2', parent%changesetparentdiff, parent%changesetparent)} children diff -r b8b246cffdee -r 9e1f4c65f5f5 mercurial/templates/paper/map --- a/mercurial/templates/paper/map Sun Dec 21 14:34:07 2014 -0800 +++ b/mercurial/templates/paper/map Sat Jan 03 17:50:21 2015 +0800 @@ -112,7 +112,11 @@ changesetparent = '{node|short} ' -difffrom = '{node|short} ' +changesetparentdiff = ' + {changesetparent} + {ifeq(node, basenode, '(current diff)', '({difffrom})')}' + +difffrom = 'diff' filerevparent = '{rename%filerename}{node|short} ' filerevchild = '{node|short} ' diff -r b8b246cffdee -r 9e1f4c65f5f5 mercurial/templates/spartan/changeset.tmpl --- a/mercurial/templates/spartan/changeset.tmpl Sun Dec 21 14:34:07 2014 -0800 +++ b/mercurial/templates/spartan/changeset.tmpl Sat Jan 03 17:50:21 2015 +0800 @@ -22,7 +22,7 @@ changeset {rev}: {node|short} -{parent%changesetparent} +{ifeq(count(parent), '2', parent%changesetparentdiff, parent%changesetparent)} {child%changesetchild} {changesettag} diff -r b8b246cffdee -r 9e1f4c65f5f5 mercurial/templates/spartan/map --- a/mercurial/templates/spartan/map Sun Dec 21 14:34:07 2014 -0800 +++ b/mercurial/templates/spartan/map Sat Jan 03 17:50:21 2015 +0800 @@ -68,18 +68,25 @@ difflineminus = '{linenumber}{line|escape}' difflineat = '{linenumber}{line|escape}' diffline = '{linenumber}{line|escape}' +changesetlink = '{node|short}' changelogparent = ' parent {rev}: - {node|short} + {changesetlink} ' changesetparent = ' parent {rev}: - {node|short} + {changesetlink} ' +changesetparentdiff = ' + + parent {rev}: + {changesetlink} {ifeq(node, basenode, '(current diff)', '({difffrom})')} + ' +difffrom = 'diff' filerevparent = ' parent: