##// END OF EJS Templates
Emacs: change directory of output buffer to the root of the repository.
FUJIWARA Katsunori -
r2454:74518478 default
parent child Browse files
Show More
@@ -712,7 +712,8 b' code by typing `M-x find-library mercuri'
712 (let ((pos (point)))
712 (let ((pos (point)))
713 (insert (documentation 'hg-mode))
713 (insert (documentation 'hg-mode))
714 (goto-char pos)
714 (goto-char pos)
715 (kill-line))))
715 (kill-line))
716 (cd (hg-root))))
716
717
717 (defun hg-add (path)
718 (defun hg-add (path)
718 "Add PATH to the Mercurial repository on the next commit.
719 "Add PATH to the Mercurial repository on the next commit.
@@ -721,7 +722,11 b' With a prefix argument, prompt for the p'
721 (let ((buf (current-buffer))
722 (let ((buf (current-buffer))
722 (update (equal buffer-file-name path)))
723 (update (equal buffer-file-name path)))
723 (hg-view-output (hg-output-buffer-name)
724 (hg-view-output (hg-output-buffer-name)
724 (apply 'call-process (hg-binary) nil t nil (list "add" path)))
725 (apply 'call-process (hg-binary) nil t nil (list "add" path))
726 ;; "hg add" shows pathes relative NOT TO ROOT BUT TO REPOSITORY
727 (replace-regexp " \\.\\.." " " nil 0 (buffer-size))
728 (goto-char 0)
729 (cd (hg-root path)))
725 (when update
730 (when update
726 (with-current-buffer buf
731 (with-current-buffer buf
727 (hg-mode-line)))))
732 (hg-mode-line)))))
@@ -890,7 +895,8 b' Key bindings'
890 (search-forward hg-commit-message-start)
895 (search-forward hg-commit-message-start)
891 (add-text-properties (match-beginning 0) (match-end 0)
896 (add-text-properties (match-beginning 0) (match-end 0)
892 '(read-only t)))
897 '(read-only t)))
893 (hg-commit-mode))))))
898 (hg-commit-mode)
899 (cd root))))))
894
900
895 (defun hg-diff (path &optional rev1 rev2)
901 (defun hg-diff (path &optional rev1 rev2)
896 "Show the differences between REV1 and REV2 of PATH.
902 "Show the differences between REV1 and REV2 of PATH.
@@ -919,7 +925,8 b' With a prefix argument, prompt for all o'
919 (call-process (hg-binary) nil t nil "diff" "-r" r1 path))
925 (call-process (hg-binary) nil t nil "diff" "-r" r1 path))
920 (diff-mode)
926 (diff-mode)
921 (setq diff (not (= (point-min) (point-max))))
927 (setq diff (not (= (point-min) (point-max))))
922 (font-lock-fontify-buffer))
928 (font-lock-fontify-buffer)
929 (cd (hg-root path)))
923 diff))
930 diff))
924
931
925 (defun hg-diff-repo ()
932 (defun hg-diff-repo ()
@@ -936,7 +943,11 b' With a prefix argument, prompt for the p'
936 (let ((buf (current-buffer))
943 (let ((buf (current-buffer))
937 (update (equal buffer-file-name path)))
944 (update (equal buffer-file-name path)))
938 (hg-view-output (hg-output-buffer-name)
945 (hg-view-output (hg-output-buffer-name)
939 (apply 'call-process (hg-binary) nil t nil (list "forget" path)))
946 (apply 'call-process (hg-binary) nil t nil (list "forget" path))
947 ;; "hg forget" shows pathes relative NOT TO ROOT BUT TO REPOSITORY
948 (replace-regexp " \\.\\.." " " nil 0 (buffer-size))
949 (goto-char 0)
950 (cd (hg-root path)))
940 (when update
951 (when update
941 (with-current-buffer buf
952 (with-current-buffer buf
942 (hg-mode-line)))))
953 (hg-mode-line)))))
@@ -950,7 +961,8 b' With a prefix argument, prompt for the p'
950 (or repo hg-incoming-repository))))
961 (or repo hg-incoming-repository))))
951 (call-process (hg-binary) nil t nil "incoming"
962 (call-process (hg-binary) nil t nil "incoming"
952 (or repo hg-incoming-repository))
963 (or repo hg-incoming-repository))
953 (hg-log-mode)))
964 (hg-log-mode)
965 (cd (hg-root))))
954
966
955 (defun hg-init ()
967 (defun hg-init ()
956 (interactive)
968 (interactive)
@@ -994,7 +1006,8 b' With a prefix argument, prompt for each '
994 (if (> (length path) (length (hg-root path)))
1006 (if (> (length path) (length (hg-root path)))
995 (cons path nil)
1007 (cons path nil)
996 nil)))
1008 nil)))
997 (hg-log-mode))))
1009 (hg-log-mode)
1010 (cd (hg-root path)))))
998
1011
999 (defun hg-log-repo (path &optional rev1 rev2 log-limit)
1012 (defun hg-log-repo (path &optional rev1 rev2 log-limit)
1000 "Display the revision history of the repository containing PATH.
1013 "Display the revision history of the repository containing PATH.
@@ -1023,7 +1036,8 b' With a prefix argument, prompt for each '
1023 (or repo hg-outgoing-repository))))
1036 (or repo hg-outgoing-repository))))
1024 (call-process (hg-binary) nil t nil "outgoing"
1037 (call-process (hg-binary) nil t nil "outgoing"
1025 (or repo hg-outgoing-repository))
1038 (or repo hg-outgoing-repository))
1026 (hg-log-mode)))
1039 (hg-log-mode)
1040 (cd (hg-root))))
1027
1041
1028 (defun hg-pull (&optional repo)
1042 (defun hg-pull (&optional repo)
1029 "Pull changes from repository REPO.
1043 "Pull changes from repository REPO.
@@ -1034,7 +1048,8 b' This does not update the working directo'
1034 (hg-abbrev-file-name
1048 (hg-abbrev-file-name
1035 (or repo hg-incoming-repository))))
1049 (or repo hg-incoming-repository))))
1036 (call-process (hg-binary) nil t nil "pull"
1050 (call-process (hg-binary) nil t nil "pull"
1037 (or repo hg-incoming-repository))))
1051 (or repo hg-incoming-repository))
1052 (cd (hg-root))))
1038
1053
1039 (defun hg-push (&optional repo)
1054 (defun hg-push (&optional repo)
1040 "Push changes to repository REPO."
1055 "Push changes to repository REPO."
@@ -1044,7 +1059,8 b' This does not update the working directo'
1044 (hg-abbrev-file-name
1059 (hg-abbrev-file-name
1045 (or repo hg-outgoing-repository))))
1060 (or repo hg-outgoing-repository))))
1046 (call-process (hg-binary) nil t nil "push"
1061 (call-process (hg-binary) nil t nil "push"
1047 (or repo hg-outgoing-repository))))
1062 (or repo hg-outgoing-repository))
1063 (cd (hg-root))))
1048
1064
1049 (defun hg-revert-buffer-internal ()
1065 (defun hg-revert-buffer-internal ()
1050 (let ((ctx (hg-buffer-context)))
1066 (let ((ctx (hg-buffer-context)))
@@ -1112,7 +1128,8 b' Names are displayed relative to the repo'
1112 "*"))
1128 "*"))
1113 (hg-abbrev-file-name root)))
1129 (hg-abbrev-file-name root)))
1114 (apply 'call-process (hg-binary) nil t nil
1130 (apply 'call-process (hg-binary) nil t nil
1115 (list "--cwd" root "status" path)))))
1131 (list "--cwd" root "status" path))
1132 (cd (hg-root path)))))
1116
1133
1117 (defun hg-undo ()
1134 (defun hg-undo ()
1118 (interactive)
1135 (interactive)
General Comments 0
You need to be logged in to leave comments. Login now