# HG changeset patch # User FUJIWARA Katsunori # Date 1150570976 -32400 # Node ID 74518478d2bfad20adfef044b8c74c1d902400a7 # Parent 134227b82a963ea0adc172c1ad169dc0bbfef53f Emacs: change directory of output buffer to the root of the repository. diff --git a/contrib/mercurial.el b/contrib/mercurial.el --- a/contrib/mercurial.el +++ b/contrib/mercurial.el @@ -712,7 +712,8 @@ code by typing `M-x find-library mercuri (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 @@ With a prefix argument, prompt for the p (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 @@ Key bindings (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 @@ With a prefix argument, prompt for all o (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 @@ With a prefix argument, prompt for the p (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 @@ With a prefix argument, prompt for the p (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 @@ With a prefix argument, prompt for each (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 @@ With a prefix argument, prompt for each (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 @@ This does not update the working directo (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 @@ This does not update the working directo (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 @@ Names are displayed relative to the repo "*")) (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)