[prev in list] [next in list] [prev in thread] [next in thread]
List: mercurial
Subject: [PATCH] mercurial.el: avoid (cd nil) call
From: Giorgos Keramidas <keramida () ceid ! upatras ! gr>
Date: 2006-07-30 6:41:35
Message-ID: 20060730064135.GA58224 () gothmog ! pc
[Download RAW message or body]
When (hg-root) cannot determine the current Mercurial repo root, it may
call the Emacs (cd PATH) function with PATH set to `nil'.
The error message when `C-c h h' is pressed in a build of Emacs 22.X
here is:
Wrong type argument: stringp, nil
The attached patch converts this error message to something like:
error: /tmp: directory is not part of a Mercurial repository.
which is slightly more helpful imho.
["mercurial-el.patch" (text/plain)]
# HG changeset patch
# User Giorgos Keramidas <keramida@ceid.upatras.gr>
# Date 1154241428 -10800
# Node ID 4ac6bc0969880a0736b65e18bf484ea7291d31f9
# Parent 7c4f186cf78be7df6d5dab1b93b782949993912e
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).
diff -r 7c4f186cf78b -r 4ac6bc096988 contrib/mercurial.el
--- a/contrib/mercurial.el Sun Jul 30 09:35:35 2006 +0300
+++ b/contrib/mercurial.el Sun Jul 30 09:37:08 2006 +0300
@@ -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.
_______________________________________________
Mercurial mailing list
Mercurial@selenic.com
http://selenic.com/mailman/listinfo/mercurial
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic