contrib/mercurial.el
changeset 2454 74518478d2bf
parent 2317 6d0a9de9a8ac
child 2457 8e1004c61796
--- a/contrib/mercurial.el	Sat Jun 17 18:36:04 2006 +0200
+++ b/contrib/mercurial.el	Sun Jun 18 04:02:56 2006 +0900
@@ -712,7 +712,8 @@
     (let ((pos (point)))
       (insert (documentation 'hg-mode))
       (goto-char pos)
-      (kill-line))))
+      (kill-line))
+    (cd (hg-root))))
 
 (defun hg-add (path)
   "Add PATH to the Mercurial repository on the next commit.
@@ -721,7 +722,11 @@
   (let ((buf (current-buffer))
 	(update (equal buffer-file-name path)))
     (hg-view-output (hg-output-buffer-name)
-      (apply 'call-process (hg-binary) nil t nil (list "add" path)))
+      (apply 'call-process (hg-binary) nil t nil (list "add" path))
+      ;; "hg add" shows pathes relative NOT TO ROOT BUT TO REPOSITORY
+      (replace-regexp " \\.\\.." " " nil 0 (buffer-size))
+      (goto-char 0)
+      (cd (hg-root path)))
     (when update
       (with-current-buffer buf
 	(hg-mode-line)))))
@@ -890,7 +895,8 @@
 	    (search-forward hg-commit-message-start)
 	    (add-text-properties (match-beginning 0) (match-end 0)
 				 '(read-only t)))
-	  (hg-commit-mode))))))
+	  (hg-commit-mode)
+          (cd root))))))
 
 (defun hg-diff (path &optional rev1 rev2)
   "Show the differences between REV1 and REV2 of PATH.
@@ -919,7 +925,8 @@
 	(call-process (hg-binary) nil t nil "diff" "-r" r1 path))
       (diff-mode)
       (setq diff (not (= (point-min) (point-max))))
-      (font-lock-fontify-buffer))
+      (font-lock-fontify-buffer)
+      (cd (hg-root path)))
     diff))
 
 (defun hg-diff-repo ()
@@ -936,7 +943,11 @@
   (let ((buf (current-buffer))
 	(update (equal buffer-file-name path)))
     (hg-view-output (hg-output-buffer-name)
-      (apply 'call-process (hg-binary) nil t nil (list "forget" path)))
+      (apply 'call-process (hg-binary) nil t nil (list "forget" path))
+      ;; "hg forget" shows pathes relative NOT TO ROOT BUT TO REPOSITORY
+      (replace-regexp " \\.\\.." " " nil 0 (buffer-size))
+      (goto-char 0)
+      (cd (hg-root path)))
     (when update
       (with-current-buffer buf
 	(hg-mode-line)))))
@@ -950,7 +961,8 @@
 			    (or repo hg-incoming-repository))))
     (call-process (hg-binary) nil t nil "incoming"
 		  (or repo hg-incoming-repository))
-    (hg-log-mode)))
+    (hg-log-mode)
+    (cd (hg-root))))
 
 (defun hg-init ()
   (interactive)
@@ -994,7 +1006,8 @@
                    (if (> (length path) (length (hg-root path)))
                        (cons path nil)
                      nil)))
-      (hg-log-mode))))
+      (hg-log-mode)
+      (cd (hg-root path)))))
 
 (defun hg-log-repo (path &optional rev1 rev2 log-limit)
   "Display the revision history of the repository containing PATH.
@@ -1023,7 +1036,8 @@
 			    (or repo hg-outgoing-repository))))
     (call-process (hg-binary) nil t nil "outgoing"
 		  (or repo hg-outgoing-repository))
-    (hg-log-mode)))
+    (hg-log-mode)
+    (cd (hg-root))))
 
 (defun hg-pull (&optional repo)
   "Pull changes from repository REPO.
@@ -1034,7 +1048,8 @@
 			   (hg-abbrev-file-name
 			    (or repo hg-incoming-repository))))
     (call-process (hg-binary) nil t nil "pull"
-		  (or repo hg-incoming-repository))))
+		  (or repo hg-incoming-repository))
+    (cd (hg-root))))
 
 (defun hg-push (&optional repo)
   "Push changes to repository REPO."
@@ -1044,7 +1059,8 @@
 			   (hg-abbrev-file-name
 			    (or repo hg-outgoing-repository))))
     (call-process (hg-binary) nil t nil "push"
-		  (or repo hg-outgoing-repository))))
+		  (or repo hg-outgoing-repository))
+    (cd (hg-root))))
 
 (defun hg-revert-buffer-internal ()
   (let ((ctx (hg-buffer-context)))
@@ -1112,7 +1128,8 @@
 				 "*"))
 			     (hg-abbrev-file-name root)))
       (apply 'call-process (hg-binary) nil t nil
-	     (list "--cwd" root "status" path)))))
+	     (list "--cwd" root "status" path))
+      (cd (hg-root path)))))
 
 (defun hg-undo ()
   (interactive)