Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hg.py @ 2808:30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 07 Aug 2006 22:54:33 -0500 |
parents | fdc232d8a193 |
children | 1c6beafbae97 |
line wrap: on
line diff
--- a/mercurial/hg.py Mon Aug 07 22:35:36 2006 -0500 +++ b/mercurial/hg.py Mon Aug 07 22:54:33 2006 -0500 @@ -10,7 +10,7 @@ from demandload import * from i18n import gettext as _ demandload(globals(), "localrepo bundlerepo httprepo sshrepo statichttprepo") -demandload(globals(), "errno lock os shutil util merge") +demandload(globals(), "errno lock os shutil util merge@_merge") def _local(path): return (os.path.isfile(path and util.drop_scheme('file', path)) and @@ -200,20 +200,30 @@ dest_lock.release() if update: - merge.update(dest_repo, dest_repo.changelog.tip()) + _merge.update(dest_repo, dest_repo.changelog.tip()) if dir_cleanup: dir_cleanup.close() return src_repo, dest_repo +def update(repo, node): + """update the working directory to node, merging linear changes""" + return _merge.update(repo, node) -# This should instead be several functions with short arglists, like -# update/merge/revert +def clean(repo, node, wlock=None, show_stats=True): + """forcibly switch the working directory to node, clobbering changes""" + return _merge.update(repo, node, force=True, wlock=wlock, + show_stats=show_stats) -def update(repo, node, allow=False, force=False, choose=None, - moddirstate=True, forcemerge=False, wlock=None, show_stats=True): - return merge.update(repo, node, allow, force, choose, moddirstate, - forcemerge, wlock, show_stats) +def merge(repo, node, force=None, remind=True, wlock=None): + """branch merge with node, resolving changes""" + return _merge.update(repo, node, allow=True, forcemerge=force, + remind=remind, wlock=wlock) + +def revert(repo, node, choose): + """revert changes to revision in node without updating dirstate""" + return _merge.update(repo, node, force=True, choose=choose, + moddirstate=False, show_stats=False) def verify(repo): """verify the consistency of a repository"""