# HG changeset patch # User Anton Shestakov # Date 1524817185 -28800 # Node ID 1b1badb3d2fc9ee378bf26d21bf4764969cfea9e # Parent 0fc78fdca4b8afa883d3f79ecdba3b42c92e719f obshistory: make obslog work when a commit doesn't have any description This logic is taken from logcmdutil.changesetprinter class. It checks that commit description is not empty before extracting the first line (before this patch it would try to index an empty list). Stripping description also makes obslog behave more like regular log when there are trailing/leading whitespaces. diff -r 0fc78fdca4b8 -r 1b1badb3d2fc hgext3rd/evolve/obshistory.py --- a/hgext3rd/evolve/obshistory.py Fri Apr 27 16:14:10 2018 +0800 +++ b/hgext3rd/evolve/obshistory.py Fri Apr 27 16:19:45 2018 +0800 @@ -391,7 +391,9 @@ _debugobshistorydisplaymissingctx(fm, node) def _debugobshistorydisplayctx(fm, ctx): - shortdescription = ctx.description().splitlines()[0] + shortdescription = ctx.description().strip() + if shortdescription: + shortdescription = shortdescription.splitlines()[0] fm.startitem() fm.write('node', '%s', str(ctx), diff -r 0fc78fdca4b8 -r 1b1badb3d2fc tests/test-evolve-obshistory.t --- a/tests/test-evolve-obshistory.t Fri Apr 27 16:14:10 2018 +0800 +++ b/tests/test-evolve-obshistory.t Fri Apr 27 16:19:45 2018 +0800 @@ -16,6 +16,20 @@ > evolution.effect-flags = yes > EOF +Test simple common cases +======================== + +Test setup +---------- + $ hg init $TESTTMP/simple + $ cd $TESTTMP/simple + +Actual test +----------- + $ hg obslog -ap null + @ 000000000000 (-1) + + Test output on amended commit =============================