# HG changeset patch # User Pierre-Yves David # Date 1443511129 25200 # Node ID ae5f7be2b4ab35b844b792b5fc48f164a3656718 # Parent 45b86dbabbda0c509da7ce231196108a107b5561 destupdate: include the 'check' logic After moving logic from 'merge.update' into 'destutil.destupdate', we are now moving logic from 'command.update' in 'destutil.destupdate'. This will make the function actually useful in predicting (and altering) the update behavior. diff -r 45b86dbabbda -r ae5f7be2b4ab mercurial/commands.py --- a/mercurial/commands.py Mon Oct 05 03:50:47 2015 -0700 +++ b/mercurial/commands.py Tue Sep 29 00:18:49 2015 -0700 @@ -6595,10 +6595,8 @@ if check: cmdutil.bailifchanged(repo, merge=False) - if rev is None: - rev = repo[repo[None].branch()].rev() - elif rev is None: - rev = destutil.destupdate(repo, clean=clean) + if rev is None: + rev = destutil.destupdate(repo, clean=clean, check=check) repo.ui.setconfig('ui', 'forcemerge', tool, 'update') diff -r 45b86dbabbda -r ae5f7be2b4ab mercurial/destutil.py --- a/mercurial/destutil.py Mon Oct 05 03:50:47 2015 -0700 +++ b/mercurial/destutil.py Tue Sep 29 00:18:49 2015 -0700 @@ -11,7 +11,7 @@ obsolete, ) -def destupdate(repo, clean=False): +def destupdate(repo, clean=False, check=False): """destination for bare update operation """ # Here is where we should consider bookmarks, divergent bookmarks, and tip @@ -71,7 +71,7 @@ hint = _("commit and merge, or update --clean to" " discard changes") raise error.Abort(msg, hint=hint) - else: # destination is not a descendant. + elif not check: # destination is not a descendant. msg = _("not a linear update") hint = _("merge or update --check to force update") raise error.Abort(msg, hint=hint)