aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/vc
diff options
context:
space:
mode:
authorStefan Monnier2011-03-21 12:42:16 -0400
committerStefan Monnier2011-03-21 12:42:16 -0400
commitcafdcef32d55cbb44389d7e322e7f973cbb72dfd (patch)
tree7ee0c41ea8a589650ce6f4311fb10e61a63807b9 /lisp/vc
parenta08a25d7aaf251aa18f2ef747be53734bc55cae9 (diff)
parent4e05e67e4cd0bc1b0a4ef3176a4d0d91c6b3738e (diff)
downloademacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.tar.gz
emacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.zip
Merge from trunk
Diffstat (limited to 'lisp/vc')
-rw-r--r--lisp/vc/diff-mode.el21
-rw-r--r--lisp/vc/emerge.el23
-rw-r--r--lisp/vc/vc-bzr.el9
-rw-r--r--lisp/vc/vc-dir.el6
-rw-r--r--lisp/vc/vc-git.el22
-rw-r--r--lisp/vc/vc-hg.el13
-rw-r--r--lisp/vc/vc.el7
7 files changed, 63 insertions, 38 deletions
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index f55629b3ea1..50f20cea779 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -122,8 +122,7 @@ when editing big diffs)."
122 ("\C-m" . diff-goto-source) 122 ("\C-m" . diff-goto-source)
123 ([mouse-2] . diff-goto-source) 123 ([mouse-2] . diff-goto-source)
124 ;; From XEmacs' diff-mode. 124 ;; From XEmacs' diff-mode.
125 ;; Standard M-w is useful, so don't change M-W. 125 ("W" . widen)
126 ;;("W" . widen)
127 ;;("." . diff-goto-source) ;display-buffer 126 ;;("." . diff-goto-source) ;display-buffer
128 ;;("f" . diff-goto-source) ;find-file 127 ;;("f" . diff-goto-source) ;find-file
129 ("o" . diff-goto-source) ;other-window 128 ("o" . diff-goto-source) ;other-window
@@ -135,17 +134,21 @@ when editing big diffs)."
135 ;; Not useful if you have to metafy them. 134 ;; Not useful if you have to metafy them.
136 ;;(" " . scroll-up) 135 ;;(" " . scroll-up)
137 ;;("\177" . scroll-down) 136 ;;("\177" . scroll-down)
138 ;; Standard M-a is useful, so don't change M-A. 137 ("A" . diff-ediff-patch)
139 ;;("A" . diff-ediff-patch) 138 ("r" . diff-restrict-view)
140 ;; Standard M-r is useful, so don't change M-r or M-R. 139 ("R" . diff-reverse-direction))
141 ;;("r" . diff-restrict-view)
142 ;;("R" . diff-reverse-direction)
143 )
144 "Basic keymap for `diff-mode', bound to various prefix keys." 140 "Basic keymap for `diff-mode', bound to various prefix keys."
145 :inherit special-mode-map) 141 :inherit special-mode-map)
146 142
147(easy-mmode-defmap diff-mode-map 143(easy-mmode-defmap diff-mode-map
148 `(("\e" . ,diff-mode-shared-map) 144 `(("\e" . ,(let ((map (make-sparse-keymap)))
145 ;; We want to inherit most bindings from diff-mode-shared-map,
146 ;; but not all since they may hide useful M-<foo> global
147 ;; bindings when editing.
148 (set-keymap-parent map diff-mode-shared-map)
149 (dolist (key '("A" "r" "R" "g" "q" "W"))
150 (define-key map key nil))
151 map))
149 ;; From compilation-minor-mode. 152 ;; From compilation-minor-mode.
150 ("\C-c\C-c" . diff-goto-source) 153 ("\C-c\C-c" . diff-goto-source)
151 ;; By analogy with the global C-x 4 a binding. 154 ;; By analogy with the global C-x 4 a binding.
diff --git a/lisp/vc/emerge.el b/lisp/vc/emerge.el
index 601b6b1e597..5435a840ac9 100644
--- a/lisp/vc/emerge.el
+++ b/lisp/vc/emerge.el
@@ -3176,21 +3176,26 @@ See also `auto-save-file-name-p'."
3176 3176
3177;; Metacharacters that have to be protected from the shell when executing 3177;; Metacharacters that have to be protected from the shell when executing
3178;; a diff/diff3 command. 3178;; a diff/diff3 command.
3179(defcustom emerge-metachars "[ \t\n!\"#$&'()*;<=>?[\\^`{|~]" 3179(defcustom emerge-metachars
3180 "Characters that must be quoted with \\ when used in a shell command line. 3180 (if (memq system-type '(ms-dos windows-nt))
3181 "[ \t\"<>|?*^&=]"
3182 "[ \t\n!\"#$&'()*;<=>?[\\^`{|~]")
3183 "Characters that must be quoted when used in a shell command line.
3181More precisely, a [...] regexp to match any one such character." 3184More precisely, a [...] regexp to match any one such character."
3182 :type 'regexp 3185 :type 'regexp
3183 :group 'emerge) 3186 :group 'emerge)
3184 3187
3185;; Quote metacharacters (using \) when executing a diff/diff3 command. 3188;; Quote metacharacters (using \) when executing a diff/diff3 command.
3186(defun emerge-protect-metachars (s) 3189(defun emerge-protect-metachars (s)
3187 (let ((limit 0)) 3190 (if (memq system-type '(ms-dos windows-nt))
3188 (while (string-match emerge-metachars s limit) 3191 (shell-quote-argument s)
3189 (setq s (concat (substring s 0 (match-beginning 0)) 3192 (let ((limit 0))
3190 "\\" 3193 (while (string-match emerge-metachars s limit)
3191 (substring s (match-beginning 0)))) 3194 (setq s (concat (substring s 0 (match-beginning 0))
3192 (setq limit (1+ (match-end 0))))) 3195 "\\"
3193 s) 3196 (substring s (match-beginning 0))))
3197 (setq limit (1+ (match-end 0)))))
3198 s))
3194 3199
3195(provide 'emerge) 3200(provide 'emerge)
3196 3201
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index a0a16601ed7..21cb86a9840 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -435,8 +435,13 @@ If any error occurred in running `bzr status', then return nil."
435(defun vc-bzr-state (file) 435(defun vc-bzr-state (file)
436 (lexical-let ((result (vc-bzr-status file))) 436 (lexical-let ((result (vc-bzr-status file)))
437 (when (consp result) 437 (when (consp result)
438 (when (cdr result) 438 (let ((warnings (cdr result)))
439 (message "Warnings in `bzr' output: %s" (cdr result))) 439 (when warnings
440 ;; bzr 2.3.0 returns info about shelves, which is not really a warning
441 (when (string-match "[1-9]+ shel\\(f\\|ves\\) exists?\\..*?\n" warnings)
442 (setq warnings (replace-match "" nil nil warnings)))
443 (unless (string= warnings "")
444 (message "Warnings in `bzr' output: %s" warnings))))
440 (cdr (assq (car result) 445 (cdr (assq (car result)
441 '((added . added) 446 '((added . added)
442 (kindchanged . edited) 447 (kindchanged . edited)
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index d4970207b94..01b6f2fc26e 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -104,7 +104,7 @@ See `run-hooks'."
104 ;; We pass a filename to create-file-buffer because it is what 104 ;; We pass a filename to create-file-buffer because it is what
105 ;; the function expects, and also what uniquify needs (if active) 105 ;; the function expects, and also what uniquify needs (if active)
106 (with-current-buffer (create-file-buffer (expand-file-name bname dir)) 106 (with-current-buffer (create-file-buffer (expand-file-name bname dir))
107 (cd dir) 107 (setq default-directory dir)
108 (vc-setup-buffer (current-buffer)) 108 (vc-setup-buffer (current-buffer))
109 ;; Reset the vc-parent-buffer-name so that it does not appear 109 ;; Reset the vc-parent-buffer-name so that it does not appear
110 ;; in the mode-line. 110 ;; in the mode-line.
@@ -1002,7 +1002,7 @@ specific headers."
1002 (generate-new-buffer (format " *VC-%s* tmp status" backend)))) 1002 (generate-new-buffer (format " *VC-%s* tmp status" backend))))
1003 (lexical-let ((buffer (current-buffer))) 1003 (lexical-let ((buffer (current-buffer)))
1004 (with-current-buffer vc-dir-process-buffer 1004 (with-current-buffer vc-dir-process-buffer
1005 (cd def-dir) 1005 (setq default-directory def-dir)
1006 (erase-buffer) 1006 (erase-buffer)
1007 (vc-call-backend 1007 (vc-call-backend
1008 backend 'dir-status-files def-dir files default-state 1008 backend 'dir-status-files def-dir files default-state
@@ -1067,7 +1067,7 @@ Throw an error if another update process is in progress."
1067 (ewoc-set-hf vc-ewoc (vc-dir-headers backend def-dir) "") 1067 (ewoc-set-hf vc-ewoc (vc-dir-headers backend def-dir) "")
1068 (lexical-let ((buffer (current-buffer))) 1068 (lexical-let ((buffer (current-buffer)))
1069 (with-current-buffer vc-dir-process-buffer 1069 (with-current-buffer vc-dir-process-buffer
1070 (cd def-dir) 1070 (setq default-directory def-dir)
1071 (erase-buffer) 1071 (erase-buffer)
1072 (vc-call-backend 1072 (vc-call-backend
1073 backend 'dir-status def-dir 1073 backend 'dir-status def-dir
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 3b4d0e5f421..711a573ba99 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -119,6 +119,12 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
119 :version "23.1" 119 :version "23.1"
120 :group 'vc) 120 :group 'vc)
121 121
122(defcustom vc-git-program "git"
123 "Name of the Git executable (excluding any arguments)."
124 :version "24.1"
125 :type 'string
126 :group 'vc)
127
122(defcustom vc-git-root-log-format 128(defcustom vc-git-root-log-format
123 '("%d%h..: %an %ad %s" 129 '("%d%h..: %an %ad %s"
124 ;; The first shy group matches the characters drawn by --graph. 130 ;; The first shy group matches the characters drawn by --graph.
@@ -554,7 +560,7 @@ or an empty string if none."
554 "Return the existing branches, as a list of strings. 560 "Return the existing branches, as a list of strings.
555The car of the list is the current branch." 561The car of the list is the current branch."
556 (with-temp-buffer 562 (with-temp-buffer
557 (call-process "git" nil t nil "branch") 563 (call-process vc-git-program nil t nil "branch")
558 (goto-char (point-min)) 564 (goto-char (point-min))
559 (let (current-branch branches) 565 (let (current-branch branches)
560 (while (not (eobp)) 566 (while (not (eobp))
@@ -633,13 +639,13 @@ for the Git command to run."
633 (let* ((root (vc-git-root default-directory)) 639 (let* ((root (vc-git-root default-directory))
634 (buffer (format "*vc-git : %s*" (expand-file-name root))) 640 (buffer (format "*vc-git : %s*" (expand-file-name root)))
635 (command "pull") 641 (command "pull")
636 (git-program "git") 642 (git-program vc-git-program)
637 args) 643 args)
638 ;; If necessary, prompt for the exact command. 644 ;; If necessary, prompt for the exact command.
639 (when prompt 645 (when prompt
640 (setq args (split-string 646 (setq args (split-string
641 (read-shell-command "Git pull command: " 647 (read-shell-command "Git pull command: "
642 "git pull" 648 (format "%s pull" git-program)
643 'vc-git-history) 649 'vc-git-history)
644 " " t)) 650 " " t))
645 (setq git-program (car args) 651 (setq git-program (car args)
@@ -663,7 +669,7 @@ This prompts for a branch to merge from."
663 branches 669 branches
664 (cons "FETCH_HEAD" branches)) 670 (cons "FETCH_HEAD" branches))
665 nil t))) 671 nil t)))
666 (apply 'vc-do-async-command buffer root "git" "merge" 672 (apply 'vc-do-async-command buffer root vc-git-program "merge"
667 (list merge-source)) 673 (list merge-source))
668 (vc-set-async-update buffer))) 674 (vc-set-async-update buffer)))
669 675
@@ -1083,8 +1089,10 @@ This command shares argument histories with \\[rgrep] and \\[grep]."
1083 1089
1084(defun vc-git-command (buffer okstatus file-or-list &rest flags) 1090(defun vc-git-command (buffer okstatus file-or-list &rest flags)
1085 "A wrapper around `vc-do-command' for use in vc-git.el. 1091 "A wrapper around `vc-do-command' for use in vc-git.el.
1086The difference to vc-do-command is that this function always invokes `git'." 1092The difference to vc-do-command is that this function always invokes
1087 (apply 'vc-do-command (or buffer "*vc*") okstatus "git" file-or-list flags)) 1093`vc-git-program'."
1094 (apply 'vc-do-command (or buffer "*vc*") okstatus vc-git-program
1095 file-or-list flags))
1088 1096
1089(defun vc-git--empty-db-p () 1097(defun vc-git--empty-db-p ()
1090 "Check if the git db is empty (no commit done yet)." 1098 "Check if the git db is empty (no commit done yet)."
@@ -1095,7 +1103,7 @@ The difference to vc-do-command is that this function always invokes `git'."
1095 ;; We don't need to care the arguments. If there is a file name, it 1103 ;; We don't need to care the arguments. If there is a file name, it
1096 ;; is always a relative one. This works also for remote 1104 ;; is always a relative one. This works also for remote
1097 ;; directories. 1105 ;; directories.
1098 (apply 'process-file "git" nil buffer nil command args)) 1106 (apply 'process-file vc-git-program nil buffer nil command args))
1099 1107
1100(defun vc-git--out-ok (command &rest args) 1108(defun vc-git--out-ok (command &rest args)
1101 (zerop (apply 'vc-git--call '(t nil) command args))) 1109 (zerop (apply 'vc-git--call '(t nil) command args)))
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index d283c39362a..0516abbf024 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -529,9 +529,9 @@ REV is the revision to check out into WORKFILE."
529 (insert (propertize 529 (insert (propertize
530 (format " (%s %s)" 530 (format " (%s %s)"
531 (case (vc-hg-extra-fileinfo->rename-state extra) 531 (case (vc-hg-extra-fileinfo->rename-state extra)
532 ('copied "copied from") 532 (copied "copied from")
533 ('renamed-from "renamed from") 533 (renamed-from "renamed from")
534 ('renamed-to "renamed to")) 534 (renamed-to "renamed to"))
535 (vc-hg-extra-fileinfo->extra-name extra)) 535 (vc-hg-extra-fileinfo->extra-name extra))
536 'face 'font-lock-comment-face))))) 536 'face 'font-lock-comment-face)))))
537 537
@@ -663,14 +663,15 @@ then attempts to update the working directory."
663 (let* ((root (vc-hg-root default-directory)) 663 (let* ((root (vc-hg-root default-directory))
664 (buffer (format "*vc-hg : %s*" (expand-file-name root))) 664 (buffer (format "*vc-hg : %s*" (expand-file-name root)))
665 (command "pull") 665 (command "pull")
666 (hg-program "hg") 666 (hg-program vc-hg-program)
667 ;; Fixme: before updating the working copy to the latest 667 ;; Fixme: before updating the working copy to the latest
668 ;; state, should check if it's visiting an old revision. 668 ;; state, should check if it's visiting an old revision.
669 (args '("-u"))) 669 (args '("-u")))
670 ;; If necessary, prompt for the exact command. 670 ;; If necessary, prompt for the exact command.
671 (when prompt 671 (when prompt
672 (setq args (split-string 672 (setq args (split-string
673 (read-shell-command "Run Hg (like this): " "hg pull -u" 673 (read-shell-command "Run Hg (like this): "
674 (format "%s pull -u" hg-program)
674 'vc-hg-history) 675 'vc-hg-history)
675 " " t)) 676 " " t))
676 (setq hg-program (car args) 677 (setq hg-program (car args)
@@ -685,7 +686,7 @@ then attempts to update the working directory."
685This runs the command \"hg merge\"." 686This runs the command \"hg merge\"."
686 (let* ((root (vc-hg-root default-directory)) 687 (let* ((root (vc-hg-root default-directory))
687 (buffer (format "*vc-hg : %s*" (expand-file-name root)))) 688 (buffer (format "*vc-hg : %s*" (expand-file-name root))))
688 (apply 'vc-do-async-command buffer root "hg" '("merge")) 689 (apply 'vc-do-async-command buffer root vc-hg-program '("merge"))
689 (vc-set-async-update buffer))) 690 (vc-set-async-update buffer)))
690 691
691;;; Internal functions 692;;; Internal functions
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 200291bd925..7f55ffdbdad 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1115,9 +1115,12 @@ merge in the changes into your working copy."
1115 (dolist (file files) 1115 (dolist (file files)
1116 (unless (file-writable-p file) 1116 (unless (file-writable-p file)
1117 ;; Make the file+buffer read-write. 1117 ;; Make the file+buffer read-write.
1118 (unless (y-or-n-p (format "%s is edited but read-only; make it writable and continue?" file)) 1118 (unless (y-or-n-p (format "%s is edited but read-only; make it writable and continue? " file))
1119 (error "Aborted")) 1119 (error "Aborted"))
1120 (set-file-modes file (logior (file-modes file) 128)) 1120 ;; Maybe we somehow lost permissions on the directory.
1121 (condition-case nil
1122 (set-file-modes file (logior (file-modes file) 128))
1123 (error (error "Unable to make file writable")))
1121 (let ((visited (get-file-buffer file))) 1124 (let ((visited (get-file-buffer file)))
1122 (when visited 1125 (when visited
1123 (with-current-buffer visited 1126 (with-current-buffer visited