# HG changeset patch # User Anton Shestakov # Date 1519649061 -28800 # Node ID f21798a6bc20a9374d6a73fdf6a85a03702e55aa # Parent efc4fb344c057f526f0ce8172a11cadd85abf1f2 hgweb: explain instabilities of unstable changesets diff -r efc4fb344c05 -r f21798a6bc20 mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py Mon Feb 26 20:44:01 2018 +0800 +++ b/mercurial/hgweb/webutil.py Mon Feb 26 20:44:21 2018 +0800 @@ -28,6 +28,7 @@ error, match, mdiff, + obsutil, patch, pathutil, pycompat, @@ -362,6 +363,18 @@ # teach templater succsandmarkers is switched to (context, mapping) API succsandmarkers._requires = {'repo', 'ctx', 'templ'} +def whyunstable(context, mapping): + repo = context.resource(mapping, 'repo') + ctx = context.resource(mapping, 'ctx') + + entries = obsutil.whyunstable(repo, ctx) + for entry in entries: + if entry.get('divergentnodes'): + entry['divergentnodes'] = _siblings(entry['divergentnodes']) + yield entry + +whyunstable._requires = {'repo', 'ctx', 'templ'} + def commonentry(repo, ctx): node = ctx.node() return { @@ -380,6 +393,7 @@ 'obsolete': ctx.obsolete(), 'succsandmarkers': succsandmarkers, 'instabilities': [{"instability": i} for i in ctx.instabilities()], + 'whyunstable': whyunstable, 'branch': nodebranchnodefault(ctx), 'inbranch': nodeinbranch(repo, ctx), 'branches': nodebranchdict(repo, ctx), diff -r efc4fb344c05 -r f21798a6bc20 mercurial/templates/paper/changeset.tmpl --- a/mercurial/templates/paper/changeset.tmpl Mon Feb 26 20:44:01 2018 +0800 +++ b/mercurial/templates/paper/changeset.tmpl Mon Feb 26 20:44:21 2018 +0800 @@ -53,6 +53,10 @@ obsolete {join(succsandmarkers%obsfateentry, '
\n')} ')} +{if(instabilities, ' + unstable + {join(whyunstable%whyunstableentry, '
\n')} +')} parents {ifeq(count(parent), '2', parent%changesetparentdiff, parent%changesetparent)} diff -r efc4fb344c05 -r f21798a6bc20 mercurial/templates/paper/map --- a/mercurial/templates/paper/map Mon Feb 26 20:44:01 2018 +0800 +++ b/mercurial/templates/paper/map Mon Feb 26 20:44:21 2018 +0800 @@ -216,6 +216,9 @@ obsfateusers = '{if(obsfateusers(markers), ' by {join(obsfateusers(markers)%'{user|obfuscate}', ', ')}')}' obsfatedate = '{if(obsfatedate(markers), ' {ifeq(min(obsfatedate(markers)), max(obsfatedate(markers)), '{min(obsfatedate(markers))|rfc822date}', 'between {min(obsfatedate(markers))|rfc822date} and {max(obsfatedate(markers))|rfc822date}')}')}' obsfateentry = '{obsfateverb}{obsfateoperations}{obsfatesuccessors}{obsfateusers}{obsfatedate}' +instabilitychangesetlink = '{node|short}' +divergentnode = '{instabilitychangesetlink} ({phase})' +whyunstableentry = '{instability}: {if(divergentnodes, divergentnodes%divergentnode)} {reason} {instabilitychangesetlink}' filediffparent = ' diff -r efc4fb344c05 -r f21798a6bc20 tests/test-hgweb-commands.t --- a/tests/test-hgweb-commands.t Mon Feb 26 20:44:01 2018 +0800 +++ b/tests/test-hgweb-commands.t Mon Feb 26 20:44:21 2018 +0800 @@ -903,6 +903,7 @@ Thu, 01 Jan 1970 00:00:00 +0000 + parents diff -r efc4fb344c05 -r f21798a6bc20 tests/test-hgweb-diffs.t --- a/tests/test-hgweb-diffs.t Mon Feb 26 20:44:01 2018 +0800 +++ b/tests/test-hgweb-diffs.t Mon Feb 26 20:44:21 2018 +0800 @@ -104,6 +104,7 @@ Thu, 01 Jan 1970 00:00:00 +0000 + parents @@ -400,6 +401,7 @@ Thu, 01 Jan 1970 00:00:00 +0000 + parents diff -r efc4fb344c05 -r f21798a6bc20 tests/test-hgweb-removed.t --- a/tests/test-hgweb-removed.t Mon Feb 26 20:44:01 2018 +0800 +++ b/tests/test-hgweb-removed.t Mon Feb 26 20:44:21 2018 +0800 @@ -85,6 +85,7 @@ Thu, 01 Jan 1970 00:00:00 +0000 + parents cb9a9f314b8b diff -r efc4fb344c05 -r f21798a6bc20 tests/test-obsolete-divergent.t --- a/tests/test-obsolete-divergent.t Mon Feb 26 20:44:01 2018 +0800 +++ b/tests/test-obsolete-divergent.t Mon Feb 26 20:44:21 2018 +0800 @@ -720,3 +720,19 @@ $ hg debugwhyunstable 1a2a9b5b0030 content-divergent: 70d5a63ca112acb3764bc1d7320ca90ea688d671 (draft) predecessor a178212c3433c4e77b573f6011e29affb8aefa33 + +#if serve + + $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log + $ cat hg.pid >> $DAEMON_PIDS + +check explanation for a content-divergent changeset + + $ get-with-headers.py localhost:$HGPORT 'rev/1a2a9b5b0030?style=paper' | grep divergent: + content-divergent: 70d5a63ca112 (draft) predecessor a178212c3433 + $ get-with-headers.py localhost:$HGPORT 'rev/1a2a9b5b0030?style=coal' | grep divergent: + content-divergent: 70d5a63ca112 (draft) predecessor a178212c3433 + + $ killdaemons.py + +#endif diff -r efc4fb344c05 -r f21798a6bc20 tests/test-obsolete.t --- a/tests/test-obsolete.t Mon Feb 26 20:44:01 2018 +0800 +++ b/tests/test-obsolete.t Mon Feb 26 20:44:21 2018 +0800 @@ -1072,9 +1072,19 @@ instabilities: orphan phase-divergent +check explanation for an orphan and phase-divergent changeset + + $ get-with-headers.py localhost:$HGPORT 'rev/50c51b361e60?style=paper' | egrep '(orphan|phase-divergent):' + orphan: obsolete parent 3de5eca88c00
+ phase-divergent: immutable predecessor 245bde4270cd + $ get-with-headers.py localhost:$HGPORT 'rev/50c51b361e60?style=coal' | egrep '(orphan|phase-divergent):' + orphan: obsolete parent 3de5eca88c00
+ phase-divergent: immutable predecessor 245bde4270cd + $ killdaemons.py $ rm hg.pid access.log errors.log + #endif Test incoming/outcoming with changesets obsoleted remotely, known locally