comparison hgext/evolve.py @ 1427:fcc467ca740e

next/prev: require --merge to move with uncommitted changes This should previous common mistake.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 23 Jun 2015 15:26:51 -0700
parents 6db55f28c965
children 20a3b0b27bfe
comparison
equal deleted inserted replaced
1426:6db55f28c965 1427:fcc467ca740e
1948 1948
1949 shorttemplate = '[{rev}] {desc|firstline}\n' 1949 shorttemplate = '[{rev}] {desc|firstline}\n'
1950 1950
1951 @command('^previous', 1951 @command('^previous',
1952 [('B', 'move-bookmark', False, 1952 [('B', 'move-bookmark', False,
1953 _('Move active bookmark after update'))], 1953 _('Move active bookmark after update')),
1954 ('', 'merge', False, _('bring uncommited change along'))],
1954 '[-B]') 1955 '[-B]')
1955 def cmdprevious(ui, repo, **opts): 1956 def cmdprevious(ui, repo, **opts):
1956 """update to parent and display summary lines""" 1957 """update to parent and display summary lines"""
1957 wkctx = repo[None] 1958 wkctx = repo[None]
1958 wparents = wkctx.parents() 1959 wparents = wkctx.parents()
1959 if len(wparents) != 1: 1960 if len(wparents) != 1:
1960 raise util.Abort('merge in progress') 1961 raise util.Abort('merge in progress')
1962 if not opts['merge']:
1963 try:
1964 cmdutil.bailifchanged(repo)
1965 except error.Abort, exc:
1966 exc.hint = _('do you want --merge?')
1967 raise
1961 1968
1962 parents = wparents[0].parents() 1969 parents = wparents[0].parents()
1963 displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) 1970 displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
1964 if len(parents) == 1: 1971 if len(parents) == 1:
1965 p = parents[0] 1972 p = parents[0]
1980 ui.warn(_('multiple parents, explicitly update to one\n')) 1987 ui.warn(_('multiple parents, explicitly update to one\n'))
1981 return 1 1988 return 1
1982 1989
1983 @command('^next', 1990 @command('^next',
1984 [('B', 'move-bookmark', False, 1991 [('B', 'move-bookmark', False,
1985 _('Move active bookmark after update'))], 1992 _('Move active bookmark after update')),
1993 ('', 'merge', False, _('bring uncommited change along'))],
1986 '[-B]') 1994 '[-B]')
1987 def cmdnext(ui, repo, **opts): 1995 def cmdnext(ui, repo, **opts):
1988 """update to child and display summary lines""" 1996 """update to child and display summary lines"""
1989 wkctx = repo[None] 1997 wkctx = repo[None]
1990 wparents = wkctx.parents() 1998 wparents = wkctx.parents()
1991 if len(wparents) != 1: 1999 if len(wparents) != 1:
1992 raise util.Abort('merge in progress') 2000 raise util.Abort('merge in progress')
2001 if not opts['merge']:
2002 try:
2003 cmdutil.bailifchanged(repo)
2004 except error.Abort, exc:
2005 exc.hint = _('do you want --merge?')
2006 raise
1993 2007
1994 children = [ctx for ctx in wparents[0].children() if not ctx.obsolete()] 2008 children = [ctx for ctx in wparents[0].children() if not ctx.obsolete()]
1995 displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) 2009 displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
1996 if not children: 2010 if not children:
1997 ui.warn(_('no non-obsolete children\n')) 2011 ui.warn(_('no non-obsolete children\n'))