# HG changeset patch # User Philippe Pepiot # Date 1475934552 -7200 # Node ID 904ae1b2087bf2703f450e4d0b2b0459da258c2a # Parent 8f902ec9ed9a296d92c2c2df1536af8c44b5321c split: avoid trying to split an empty commit (issue5191) diff -r 8f902ec9ed9a -r 904ae1b2087b README --- a/README Mon Sep 12 10:41:00 2016 -0700 +++ b/README Sat Oct 08 15:49:12 2016 +0200 @@ -59,6 +59,7 @@ 5.4.2 -- - Fix erroneous manifest computation when solving 'bumped' changeset. + - split: avoid crash on empty commit (issue5191), 5.4.1 -- 2016-08-01 diff -r 8f902ec9ed9a -r 904ae1b2087b hgext/evolve.py --- a/hgext/evolve.py Mon Sep 12 10:41:00 2016 -0700 +++ b/hgext/evolve.py Sat Oct 08 15:49:12 2016 +0200 @@ -2940,11 +2940,12 @@ else: ui.status(_("no more change to split\n")) - tip = repo[newcommits[-1]] - bmupdate(tip.node()) - if bookactive is not None: - bmactivate(repo, bookactive) - obsolete.createmarkers(repo, [(repo[r], newcommits)]) + if newcommits: + tip = repo[newcommits[-1]] + bmupdate(tip.node()) + if bookactive is not None: + bmactivate(repo, bookactive) + obsolete.createmarkers(repo, [(repo[r], newcommits)]) tr.close() finally: lockmod.release(tr, lock, wlock) diff -r 8f902ec9ed9a -r 904ae1b2087b tests/test-split.t --- a/tests/test-split.t Mon Sep 12 10:41:00 2016 -0700 +++ b/tests/test-split.t Sat Oct 08 15:49:12 2016 +0200 @@ -378,3 +378,10 @@ (use either `hg split ` or `hg split --rev `, not both) [255] +Split empty commit (issue5191) + $ hg branch new-branch + marked working directory as branch new-branch + (branches are permanent and global, did you want a bookmark?) + $ hg commit -m "empty" + $ hg split + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved