diff --git a/hg b/hg --- a/hg +++ b/hg @@ -129,12 +129,6 @@ relpath = None if os.getcwd() != repo.root: relpath = os.getcwd()[len(repo.root) + 1: ] -if cmd == "checkout" or cmd == "co": - node = repo.changelog.tip() - if args: - node = repo.lookup(args[0]) - repo.checkout(node) - elif cmd == "add": repo.add(args) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -68,8 +68,13 @@ def branch(ui, path): # this should eventually support remote repos os.system("cp -al %s/.hg .hg" % path) -def checkout(u, repo, changeset=None): +def checkout(ui, repo, changeset=None): '''checkout a given changeset or the current tip''' + (c, a, d) = repo.diffdir(repo.root, repo.current) + if c: + ui.warn("aborting (outstanding changes in working directory)\n") + sys.exit(1) + node = repo.changelog.tip() if changeset: node = repo.lookup(changeset)