avoid calling (cd ...) with `nil' as a directory name
authorGiorgos Keramidas <keramida@ceid.upatras.gr>
Sun, 30 Jul 2006 09:37:08 +0300
changeset 2736 a5c43944e1ee
parent 2735 eb1bde9560bc
child 2737 400a4a502001
avoid calling (cd ...) with `nil' as a directory name When (hg-root) cannot determine the current Mercurial root, print an error message instead of trying to evaluate (cd nil).
contrib/mercurial.el
--- a/contrib/mercurial.el
+++ b/contrib/mercurial.el
@@ -718,7 +718,11 @@ code by typing `M-x find-library mercuri
       (goto-char pos)
       (end-of-line 1)
       (delete-region pos (point)))
-    (cd (hg-root))))
+    (let ((hg-root-dir (hg-root)))
+      (if (not hg-root-dir)
+	  (error "error: %s: directory is not part of a Mercurial repository."
+		 default-directory)
+	(cd (hg-root))))))
 
 (defun hg-add (path)
   "Add PATH to the Mercurial repository on the next commit.