# HG changeset patch # User Pierre-Yves David # Date 1458239515 25200 # Node ID 5481954546835a1c8c581467707fbc21715e8729 # Parent db19b1dc5c4590478205fd51e31a348644226075 topic: restrict 'hg prev' to current topic unless --no-topic is passed This is far from perfect but a good start diff -r db19b1dc5c45 -r 548195454683 README --- a/README Thu Mar 17 11:25:01 2016 -0700 +++ b/README Thu Mar 17 11:31:55 2016 -0700 @@ -58,9 +58,10 @@ 5.4.0 -- -- Some collaboration with the topic experimental extensions - - hg evolve --all with consider all trouble in your current topic - - preserve 'topic' during evolve +- Some collaboration with the topic experimental extensions, + - hg evolve --all with consider all trouble in your current topic, + - preserve 'topic' during evolve, + - 'next' and 'prev' restrict themself to the current topic by default, 5.3.0 -- 2016-02-11 diff -r db19b1dc5c45 -r 548195454683 hgext/evolve.py --- a/hgext/evolve.py Thu Mar 17 11:25:01 2016 -0700 +++ b/hgext/evolve.py Thu Mar 17 11:31:55 2016 -0700 @@ -2100,8 +2100,14 @@ raise parents = wparents[0].parents() + topic = getattr(repo, 'currenttopic', '') + if topic and not opts.get("no_topic", False): + parents = [ctx for ctx in parents if ctx.topic() == topic] displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) - if len(parents) == 1: + if not parents: + ui.warn(_('no parent in topic "%s"\n') % topic) + ui.warn(_('(do you want --no-topic)\n')) + elif len(parents) == 1: p = parents[0] bm = bmactive(repo) shouldmove = opts.get('move_bookmark') and bm is not None @@ -2138,6 +2144,7 @@ _('move active bookmark after update')), ('', 'merge', False, _('bring uncommitted change along')), ('', 'evolve', False, _('evolve the next changeset if necessary')), + ('', 'no-topic', False, _('ignore topic and move topologically')), ('n', 'dry-run', False, _('do not perform actions, just print what would be done'))], '[OPTION]...') diff -r db19b1dc5c45 -r 548195454683 tests/test-evolve-topic.t --- a/tests/test-evolve-topic.t Thu Mar 17 11:25:01 2016 -0700 +++ b/tests/test-evolve-topic.t Thu Mar 17 11:31:55 2016 -0700 @@ -214,3 +214,10 @@ switching to topic bar 1 files updated, 0 files merged, 0 files removed, 0 files unresolved [16] add ggg + $ hg prev + no parent in topic "bar" + (do you want --no-topic) + $ hg prev --no-topic + switching to topic foo + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + [15] add fff