# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1521181007 -19800 # Node ID 78abffad862671129a5e980110e7bfdf5cac51be # Parent d197e6f0d0e3bf181b0ab0efe1680d36a2e1a3b6 next: prompt user to choose a children in case of ambiguity This patch adds functionality to prompt user and ask the children to which next should move to incase of multiple childrens. This is a very nice UI because otherwise user has to lookup changeset hash, and then manually do `hg update` to that. In this case we show hash and description so user can choose which one to update easily. It is using the interactive revision choosing functionality added in a previous patch. diff -r d197e6f0d0e3 -r 78abffad8626 hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Fri Mar 16 11:31:13 2018 +0530 +++ b/hgext3rd/evolve/__init__.py Fri Mar 16 11:46:47 2018 +0530 @@ -1109,11 +1109,17 @@ c = children[0] result = _updatetonext(ui, repo, c, displayer, opts) elif children: - ui.warn(_("ambiguous next changeset:\n")) - for c in children: - displayer.show(c) - ui.warn(_('explicitly update to one of them\n')) - result = 1 + cheader = _("ambiguous next changeset, choose one to update:") + crevs = [c.rev() for c in children] + choosedrev = utility.revselectionprompt(ui, repo, crevs, cheader) + if choosedrev is None: + ui.warn(_("ambiguous next changeset:\n")) + for c in children: + displayer.show(c) + ui.warn(_("explicitly update to one of them\n")) + result = 1 + else: + result = _updatetonext(ui, repo, repo[choosedrev], displayer, opts) else: aspchildren = evolvecmd._aspiringchildren(repo, [repo['.'].rev()]) if topic: diff -r d197e6f0d0e3 -r 78abffad8626 tests/test-prev-next.t --- a/tests/test-prev-next.t Fri Mar 16 11:31:13 2018 +0530 +++ b/tests/test-prev-next.t Fri Mar 16 11:46:47 2018 +0530 @@ -1,4 +1,6 @@ $ cat >> $HGRCPATH < [ui] + > interactive = True > [extensions] > EOF $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH @@ -210,12 +212,20 @@ $ hg prev 0 files updated, 0 files merged, 1 files removed, 0 files unresolved [3] added b (2) - $ hg next - ambiguous next changeset: - [4] added c + $ hg next < 1 + > EOF + ambiguous next changeset, choose one to update: + 0: [e3b6d5df389b] added c + 1: [9df671ccd2c7] added d + q: quit the prompt + enter the index of the revision you want to select: 1 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved [5] added d - explicitly update to one of them - [1] + + $ hg prev + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + [3] added b (2) next with ambiguity in aspiring children