comparison lisp/vc/vc.el @ 110748:2279efb0250e

Make 'g' (AKA revert-buffer) rerun the VC log, log-incoming and log-outgoing commands. * lisp/vc/vc.el (vc-log-internal-common): Add a new argument and use it to create a buffer local revert-buffer-function variable. (vc-print-log-internal, vc-log-incoming, vc-log-outgoing): Pass a revert-buffer-function lambda.
author Dan Nicolaescu <dann@ics.uci.edu>
date Sun, 03 Oct 2010 17:26:41 -0700
parents d90a3bc6b730
children 275f265c56c5
comparison
equal deleted inserted replaced
110747:0defef1647a5 110748:2279efb0250e
2025 (memq 'directory vc-log-short-style) 2025 (memq 'directory vc-log-short-style)
2026 (memq 'file vc-log-short-style))))) 2026 (memq 'file vc-log-short-style)))))
2027 (setq type (if vc-short-log 'short 'long)) 2027 (setq type (if vc-short-log 'short 'long))
2028 (lexical-let 2028 (lexical-let
2029 ((working-revision working-revision) 2029 ((working-revision working-revision)
2030 (backend backend)
2030 (limit limit) 2031 (limit limit)
2031 (shortlog vc-short-log) 2032 (shortlog vc-short-log)
2033 (files files)
2032 (is-start-revision is-start-revision)) 2034 (is-start-revision is-start-revision))
2033 (vc-log-internal-common 2035 (vc-log-internal-common
2034 backend buffer-name files type 2036 backend buffer-name files type
2035 (lambda (bk buf type-arg files-arg) 2037 (lambda (bk buf type-arg files-arg)
2036 (vc-call-backend bk 'print-log files-arg buf 2038 (vc-call-backend bk 'print-log files-arg buf
2037 shortlog (when is-start-revision working-revision) limit)) 2039 shortlog (when is-start-revision working-revision) limit))
2038 (lambda (bk files-arg ret) 2040 (lambda (bk files-arg ret)
2039 (vc-print-log-setup-buttons working-revision 2041 (vc-print-log-setup-buttons working-revision
2040 is-start-revision limit ret)) 2042 is-start-revision limit ret))
2041 (lambda (bk) 2043 (lambda (bk)
2042 (vc-call-backend bk 'show-log-entry working-revision)))))) 2044 (vc-call-backend bk 'show-log-entry working-revision))
2045 (lambda (ignore-auto noconfirm)
2046 (vc-print-log-internal backend files working-revision is-start-revision limit))))))
2043 2047
2044 (defvar vc-log-view-type nil 2048 (defvar vc-log-view-type nil
2045 "Set this to differentiate the different types of logs.") 2049 "Set this to differentiate the different types of logs.")
2046 (put 'vc-log-view-type 'permanent-local t) 2050 (put 'vc-log-view-type 'permanent-local t)
2047 2051
2049 buffer-name 2053 buffer-name
2050 files 2054 files
2051 type 2055 type
2052 backend-func 2056 backend-func
2053 setup-buttons-func 2057 setup-buttons-func
2054 goto-location-func) 2058 goto-location-func
2059 rev-buff-func)
2055 (let (retval) 2060 (let (retval)
2056 (with-current-buffer (get-buffer-create buffer-name) 2061 (with-current-buffer (get-buffer-create buffer-name)
2057 (set (make-local-variable 'vc-log-view-type) type)) 2062 (set (make-local-variable 'vc-log-view-type) type))
2058 (setq retval (funcall backend-func backend buffer-name type files)) 2063 (setq retval (funcall backend-func backend buffer-name type files))
2059 (pop-to-buffer buffer-name) 2064 (pop-to-buffer buffer-name)
2060 (let ((inhibit-read-only t)) 2065 (let ((inhibit-read-only t))
2061 ;; log-view-mode used to be called with inhibit-read-only bound 2066 ;; log-view-mode used to be called with inhibit-read-only bound
2062 ;; to t, so let's keep doing it, just in case. 2067 ;; to t, so let's keep doing it, just in case.
2063 (vc-call-backend backend 'log-view-mode) 2068 (vc-call-backend backend 'log-view-mode)
2064 (set (make-local-variable 'log-view-vc-backend) backend) 2069 (set (make-local-variable 'log-view-vc-backend) backend)
2065 (set (make-local-variable 'log-view-vc-fileset) files)) 2070 (set (make-local-variable 'log-view-vc-fileset) files)
2071 (set (make-local-variable 'revert-buffer-function)
2072 rev-buff-func))
2066 (vc-exec-after 2073 (vc-exec-after
2067 `(let ((inhibit-read-only t)) 2074 `(let ((inhibit-read-only t))
2068 (funcall ',setup-buttons-func ',backend ',files ',retval) 2075 (funcall ',setup-buttons-func ',backend ',files ',retval)
2069 (shrink-window-if-larger-than-buffer) 2076 (shrink-window-if-larger-than-buffer)
2070 (funcall ',goto-location-func ',backend) 2077 (funcall ',goto-location-func ',backend)
2078 ((remote-location remote-location)) 2085 ((remote-location remote-location))
2079 (lambda (bk buf type-arg files) 2086 (lambda (bk buf type-arg files)
2080 (vc-call-backend bk type-arg buf remote-location))) 2087 (vc-call-backend bk type-arg buf remote-location)))
2081 (lambda (bk files-arg ret)) 2088 (lambda (bk files-arg ret))
2082 (lambda (bk) 2089 (lambda (bk)
2083 (goto-char (point-min))))) 2090 (goto-char (point-min)))
2091 (lexical-let
2092 ((backend backend)
2093 (remote-location remote-location)
2094 (buffer-name buffer-name)
2095 (type type))
2096 (lambda (ignore-auto noconfirm)
2097 (vc-incoming-outgoing-internal backend remote-location buffer-name type)))))
2084 2098
2085 ;;;###autoload 2099 ;;;###autoload
2086 (defun vc-print-log (&optional working-revision limit) 2100 (defun vc-print-log (&optional working-revision limit)
2087 "List the change log of the current fileset in a window. 2101 "List the change log of the current fileset in a window.
2088 If WORKING-REVISION is non-nil, leave point at that revision. 2102 If WORKING-REVISION is non-nil, leave point at that revision.
2138 (setq working-revision (vc-working-revision rootdir)) 2152 (setq working-revision (vc-working-revision rootdir))
2139 (vc-print-log-internal backend (list rootdir) working-revision nil limit))) 2153 (vc-print-log-internal backend (list rootdir) working-revision nil limit)))
2140 2154
2141 ;;;###autoload 2155 ;;;###autoload
2142 (defun vc-log-incoming (&optional remote-location) 2156 (defun vc-log-incoming (&optional remote-location)
2143 "Show a log of changes that will be received with a pull operation from REMOTE-LOCATION." 2157 "Show a log of changes that will be received with a pull operation from REMOTE-LOCATION.
2144 (interactive "sRemote location (empty for default): ") 2158 When called interactively with a prefix argument, prompt for REMOTE-LOCATION.."
2159 (interactive
2160 (when current-prefix-arg
2161 (list (read-string "Remote location (empty for default): "))))
2145 (let ((backend (vc-deduce-backend)) 2162 (let ((backend (vc-deduce-backend))
2146 rootdir working-revision) 2163 rootdir working-revision)
2147 (unless backend 2164 (unless backend
2148 (error "Buffer is not version controlled")) 2165 (error "Buffer is not version controlled"))
2149 (vc-incoming-outgoing-internal backend remote-location "*vc-incoming*" 'log-incoming))) 2166 (vc-incoming-outgoing-internal backend remote-location "*vc-incoming*" 'log-incoming)))
2150 2167
2151 ;;;###autoload 2168 ;;;###autoload
2152 (defun vc-log-outgoing (&optional remote-location) 2169 (defun vc-log-outgoing (&optional remote-location)
2153 "Show a log of changes that will be sent with a push operation to REMOTE-LOCATION." 2170 "Show a log of changes that will be sent with a push operation to REMOTE-LOCATION.
2154 (interactive "sRemote location (empty for default): ") 2171 When called interactively with a prefix argument, prompt for REMOTE-LOCATION."
2172 (interactive
2173 (when current-prefix-arg
2174 (list (read-string "Remote location (empty for default): "))))
2155 (let ((backend (vc-deduce-backend)) 2175 (let ((backend (vc-deduce-backend))
2156 rootdir working-revision) 2176 rootdir working-revision)
2157 (unless backend 2177 (unless backend
2158 (error "Buffer is not version controlled")) 2178 (error "Buffer is not version controlled"))
2159 (vc-incoming-outgoing-internal backend remote-location "*vc-outgoing*" 'log-outgoing))) 2179 (vc-incoming-outgoing-internal backend remote-location "*vc-outgoing*" 'log-outgoing)))