diff mercurial/commands.py @ 219:8ff4532376a4

hg checkout: refuse to checkout if there are outstanding changes -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hg checkout: refuse to checkout if there are outstanding changes This is a stop-gap until I make the working dir logic smarter manifest hash: a3f6adcb7eecec294000039057d59771958f4186 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCnnrKywK+sNU5EO8RAtqBAJwPQQrW5GhjMP9HMkFtfD7qhqxIcgCfXvA4 oXHO13uzBn5JOaTH3KwsMbQ= =IzTY -----END PGP SIGNATURE-----
author mpm@selenic.com
date Wed, 01 Jun 2005 19:19:38 -0800
parents 2d60aa9bde0a
children 3113a94c1bff
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Jun 01 17:01:09 2005 -0800
+++ b/mercurial/commands.py	Wed Jun 01 19:19:38 2005 -0800
@@ -68,8 +68,13 @@
     # 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)