Mercurial > evolve
diff hgext3rd/topic/stack.py @ 3278:e4c0332ecee4 stable
topics: fix `hg stack` in case of split
This patch fixes the behaviour of hg stack which throws an error in some cases
when there are multiple successors. The case of divergence is not handled yet.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 11 Dec 2017 23:47:25 +0530 |
parents | 8cc8fb94cc00 |
children | 753e5ebabe7d |
line wrap: on
line diff
--- a/hgext3rd/topic/stack.py Mon Dec 11 23:33:50 2017 +0530 +++ b/hgext3rd/topic/stack.py Mon Dec 11 23:47:25 2017 +0530 @@ -12,7 +12,11 @@ obsolete, util, ) -from .evolvebits import builddependencies, _singlesuccessor +from .evolvebits import ( + _singlesuccessor, + MultipleSuccessorsError, + builddependencies, +) short = node.short @@ -285,7 +289,15 @@ p1 = ctx.p1() p2 = ctx.p2() if p1.obsolete(): - p1 = repo[_singlesuccessor(repo, p1)] + try: + p1 = repo[_singlesuccessor(repo, p1)] + except MultipleSuccessorsError as e: + successors = e.successorssets + if len(successors) > 1: + # case of divergence which we don't handle yet + raise + p1 = repo[successors[0][-1]] + if p2.node() != node.nullid: entries.append((idxmap.get(p1.rev()), False, p1)) entries.append((idxmap.get(p2.rev()), False, p2))