# HG changeset patch # User Pierre-Yves David # Date 1435098411 25200 # Node ID fcc467ca740ea63c3aea9122f707e9faa0a02433 # Parent 6db55f28c965b6cf555c78b308ff54c44e32e5f1 next/prev: require --merge to move with uncommitted changes This should previous common mistake. diff -r 6db55f28c965 -r fcc467ca740e README --- a/README Tue Jun 23 15:32:47 2015 -0700 +++ b/README Tue Jun 23 15:26:51 2015 -0700 @@ -64,6 +64,7 @@ - evolve: `hg evolve --all` only evolve changeset that will end up as descendant of the current working copy. The old behavior of `--all` in now in `--all --any`. +- next/prev: requires `--merge` to move with uncommited changes 5.1.5 -- 2015-06-23 diff -r 6db55f28c965 -r fcc467ca740e hgext/evolve.py --- a/hgext/evolve.py Tue Jun 23 15:32:47 2015 -0700 +++ b/hgext/evolve.py Tue Jun 23 15:26:51 2015 -0700 @@ -1950,7 +1950,8 @@ @command('^previous', [('B', 'move-bookmark', False, - _('Move active bookmark after update'))], + _('Move active bookmark after update')), + ('', 'merge', False, _('bring uncommited change along'))], '[-B]') def cmdprevious(ui, repo, **opts): """update to parent and display summary lines""" @@ -1958,6 +1959,12 @@ wparents = wkctx.parents() if len(wparents) != 1: raise util.Abort('merge in progress') + if not opts['merge']: + try: + cmdutil.bailifchanged(repo) + except error.Abort, exc: + exc.hint = _('do you want --merge?') + raise parents = wparents[0].parents() displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) @@ -1982,7 +1989,8 @@ @command('^next', [('B', 'move-bookmark', False, - _('Move active bookmark after update'))], + _('Move active bookmark after update')), + ('', 'merge', False, _('bring uncommited change along'))], '[-B]') def cmdnext(ui, repo, **opts): """update to child and display summary lines""" @@ -1990,6 +1998,12 @@ wparents = wkctx.parents() if len(wparents) != 1: raise util.Abort('merge in progress') + if not opts['merge']: + try: + cmdutil.bailifchanged(repo) + except error.Abort, exc: + exc.hint = _('do you want --merge?') + raise children = [ctx for ctx in wparents[0].children() if not ctx.obsolete()] displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) diff -r 6db55f28c965 -r fcc467ca740e tests/test-prev-next.t --- a/tests/test-prev-next.t Tue Jun 23 15:32:47 2015 -0700 +++ b/tests/test-prev-next.t Tue Jun 23 15:26:51 2015 -0700 @@ -82,3 +82,25 @@ $ hg bookmarks mark 2:4e26ef31f919 no-move 2:4e26ef31f919 + + +Behavior with local modification +-------------------------------- + + $ echo foo > modified-bar + $ hg add modified-bar + $ hg prev + abort: uncommitted changes + (do you want --merge?) + [255] + $ hg prev --merge + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + [0] added a + $ hg next + abort: uncommitted changes + (do you want --merge?) + [255] + $ hg next --merge + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + [1] added b +