Mercurial > evolve
changeset 3729:1b1badb3d2fc stable
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.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Fri, 27 Apr 2018 16:19:45 +0800 |
parents | 0fc78fdca4b8 |
children | f5b9030e18e9 |
files | hgext3rd/evolve/obshistory.py tests/test-evolve-obshistory.t |
diffstat | 2 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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),
--- 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 =============================