Mercurial > hg > mercurial-crew-with-dirclash
comparison contrib/mercurial.el @ 2736:a5c43944e1ee
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).
author | Giorgos Keramidas <keramida@ceid.upatras.gr> |
---|---|
date | Sun, 30 Jul 2006 09:37:08 +0300 |
parents | 7a32b7e6c563 |
children | 0ffca0cb9f4b |
comparison
equal
deleted
inserted
replaced
2735:eb1bde9560bc | 2736:a5c43944e1ee |
---|---|
716 (let ((pos (point))) | 716 (let ((pos (point))) |
717 (insert (documentation 'hg-mode)) | 717 (insert (documentation 'hg-mode)) |
718 (goto-char pos) | 718 (goto-char pos) |
719 (end-of-line 1) | 719 (end-of-line 1) |
720 (delete-region pos (point))) | 720 (delete-region pos (point))) |
721 (cd (hg-root)))) | 721 (let ((hg-root-dir (hg-root))) |
722 (if (not hg-root-dir) | |
723 (error "error: %s: directory is not part of a Mercurial repository." | |
724 default-directory) | |
725 (cd (hg-root)))))) | |
722 | 726 |
723 (defun hg-add (path) | 727 (defun hg-add (path) |
724 "Add PATH to the Mercurial repository on the next commit. | 728 "Add PATH to the Mercurial repository on the next commit. |
725 With a prefix argument, prompt for the path to add." | 729 With a prefix argument, prompt for the path to add." |
726 (interactive (list (hg-read-file-name " to add"))) | 730 (interactive (list (hg-read-file-name " to add"))) |