##// END OF EJS Templates
mercurial.el: add hg-cwd
Bryan O'Sullivan -
r3003:78fe7e2c default
parent child Browse files
Show More
@@ -1211,6 +1211,21 b' prompts for a path to check."'
1211 root)
1211 root)
1212 hg-root))
1212 hg-root))
1213
1213
1214 (defun hg-cwd (&optional path)
1215 "Return the current directory of PATH within the repository."
1216 (do ((stack nil (cons (file-name-nondirectory
1217 (directory-file-name dir))
1218 stack))
1219 (prev nil dir)
1220 (dir (file-name-directory (or path buffer-file-name
1221 (expand-file-name default-directory)))
1222 (file-name-directory (directory-file-name dir))))
1223 ((equal prev dir))
1224 (when (file-directory-p (concat dir ".hg"))
1225 (let ((cwd (mapconcat 'identity stack "/")))
1226 (unless (equal cwd "")
1227 (return (file-name-as-directory cwd)))))))
1228
1214 (defun hg-status (path)
1229 (defun hg-status (path)
1215 "Print revision control status of a file or directory.
1230 "Print revision control status of a file or directory.
1216 With prefix argument, prompt for the path to give status for.
1231 With prefix argument, prompt for the path to give status for.
General Comments 0
You need to be logged in to leave comments. Login now