# HG changeset patch # User Philippe Pepiot # Date 1475934552 -7200 # Node ID cb5edd4b160cd169b5829b5b84c448bd3dc8feed # Parent 5383671ef612a1764bbbed13a7ef2d339d0a9c2d split: avoid trying to split an empty commit (issue5191) diff -r 5383671ef612 -r cb5edd4b160c hgext/evolve.py --- a/hgext/evolve.py Thu Sep 22 09:15:30 2016 -0700 +++ b/hgext/evolve.py Sat Oct 08 15:49:12 2016 +0200 @@ -2932,11 +2932,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 5383671ef612 -r cb5edd4b160c tests/test-split.t --- a/tests/test-split.t Thu Sep 22 09:15:30 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