diff options
| author | Dan Nicolaescu | 2007-07-22 22:03:27 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2007-07-22 22:03:27 +0000 |
| commit | 8b9783e0df57e40e956fc94f0da5d368b6f9a917 (patch) | |
| tree | 3d426b04b1f0e8fae386fe0a3dad0d215b9fca8c | |
| parent | f151b310f65fd73924a32b566a17b3f44279c72a (diff) | |
| download | emacs-8b9783e0df57e40e956fc94f0da5d368b6f9a917.tar.gz emacs-8b9783e0df57e40e956fc94f0da5d368b6f9a917.zip | |
(vc-git-register, vc-git-checkin): Use vc-git-command,
deal with multiple file arguments.
(vc-git-print-log): Deal with multiple file arguments.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/vc-git.el | 24 |
2 files changed, 21 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ad16626bd71..40b875386d3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2007-07-22 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | * vc-git.el (vc-git-register, vc-git-checkin): Use vc-git-command, | ||
| 4 | deal with multiple file arguments. | ||
| 5 | (vc-git-print-log): Deal with multiple file arguments. | ||
| 6 | |||
| 1 | 2007-07-22 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2007-07-22 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 8 | ||
| 3 | * diff-mode.el (diff-refine-ignore-spaces-hunk): Rename from | 9 | * diff-mode.el (diff-refine-ignore-spaces-hunk): Rename from |
diff --git a/lisp/vc-git.el b/lisp/vc-git.el index c074b48ea74..b2f253de3cd 100644 --- a/lisp/vc-git.el +++ b/lisp/vc-git.el | |||
| @@ -37,7 +37,6 @@ | |||
| 37 | ;; (add-to-list 'vc-handled-backends 'GIT) | 37 | ;; (add-to-list 'vc-handled-backends 'GIT) |
| 38 | 38 | ||
| 39 | ;;; Todo: | 39 | ;;; Todo: |
| 40 | ;; - !!!port to the new VC interface with multiple file arguments!!! | ||
| 41 | ;; - check if more functions could use vc-git-command instead | 40 | ;; - check if more functions could use vc-git-command instead |
| 42 | ;; of start-process. | 41 | ;; of start-process. |
| 43 | ;; - changelog generation | 42 | ;; - changelog generation |
| @@ -115,6 +114,7 @@ | |||
| 115 | ;; XXX when this backend is considered sufficiently reliable this | 114 | ;; XXX when this backend is considered sufficiently reliable this |
| 116 | ;; should be moved to vc-hooks.el | 115 | ;; should be moved to vc-hooks.el |
| 117 | (add-to-list 'vc-handled-backends 'GIT) | 116 | (add-to-list 'vc-handled-backends 'GIT) |
| 117 | (add-to-list 'vc-directory-exclusion-list ".git" t) | ||
| 118 | 118 | ||
| 119 | ;;; BACKEND PROPERTIES | 119 | ;;; BACKEND PROPERTIES |
| 120 | 120 | ||
| @@ -212,15 +212,15 @@ | |||
| 212 | "Create a new GIT repository." | 212 | "Create a new GIT repository." |
| 213 | (vc-git-command "init" nil 0 nil)) | 213 | (vc-git-command "init" nil 0 nil)) |
| 214 | 214 | ||
| 215 | (defun vc-git-register (file &optional rev comment) | 215 | (defun vc-git-register (files &optional rev comment) |
| 216 | "Register FILE into the git version-control system." | 216 | "Register FILE into the git version-control system." |
| 217 | (vc-git--run-command file "update-index" "--add" "--")) | 217 | (vc-git-command nil 0 files "update-index" "--add" "--")) |
| 218 | 218 | ||
| 219 | (defalias 'vc-git-responsible-p 'vc-git-root) | 219 | (defalias 'vc-git-responsible-p 'vc-git-root) |
| 220 | 220 | ||
| 221 | (defun vc-git-checkin (file rev comment) | 221 | (defun vc-git-checkin (files rev comment) |
| 222 | (let ((coding-system-for-write git-commits-coding-system)) | 222 | (let ((coding-system-for-write git-commits-coding-system)) |
| 223 | (vc-git--run-command file "commit" "-m" comment "--only" "--"))) | 223 | (vc-git-command nil 0 files "commit" "-m" comment "--only" "--"))) |
| 224 | 224 | ||
| 225 | (defun vc-git-checkout (file &optional editable rev destfile) | 225 | (defun vc-git-checkout (file &optional editable rev destfile) |
| 226 | (if destfile | 226 | (if destfile |
| @@ -242,7 +242,8 @@ | |||
| 242 | 242 | ||
| 243 | ;;; HISTORY FUNCTIONS | 243 | ;;; HISTORY FUNCTIONS |
| 244 | 244 | ||
| 245 | (defun vc-git-print-log (file &optional buffer) | 245 | (defun vc-git-print-log (files &optional buffer) |
| 246 | "Get change log associated with FILES." | ||
| 246 | (let ((name (file-relative-name file)) | 247 | (let ((name (file-relative-name file)) |
| 247 | (coding-system-for-read git-commits-coding-system)) | 248 | (coding-system-for-read git-commits-coding-system)) |
| 248 | ;; `log-view-mode' needs to have the file name in order to function | 249 | ;; `log-view-mode' needs to have the file name in order to function |
| @@ -255,10 +256,15 @@ | |||
| 255 | ;; If the buffer exists from a previous invocation it might be | 256 | ;; If the buffer exists from a previous invocation it might be |
| 256 | ;; read-only. | 257 | ;; read-only. |
| 257 | (let ((inhibit-read-only t)) | 258 | (let ((inhibit-read-only t)) |
| 259 | ;; XXX Here loop and call "git rev-list" on each file separately | ||
| 260 | ;; to make sure that each file gets a "File:" header before the | ||
| 261 | ;; corresponding log. Maybe there is a way to do this with one | ||
| 262 | ;; command... | ||
| 263 | (dolist (file files) | ||
| 258 | (with-current-buffer | 264 | (with-current-buffer |
| 259 | buffer | 265 | buffer |
| 260 | (insert "File: " (file-name-nondirectory file) "\n"))) | 266 | (insert "File: " (file-name-nondirectory file) "\n"))) |
| 261 | (vc-git-command buffer 'async name "rev-list" "--pretty" "HEAD" "--"))) | 267 | (vc-git-command buffer 'async name "rev-list" "--pretty" "HEAD" "--")))) |
| 262 | 268 | ||
| 263 | (defvar log-view-message-re) | 269 | (defvar log-view-message-re) |
| 264 | (defvar log-view-file-re) | 270 | (defvar log-view-file-re) |
| @@ -369,10 +375,10 @@ | |||
| 369 | (defun vc-git-root (file) | 375 | (defun vc-git-root (file) |
| 370 | (vc-find-root file ".git")) | 376 | (vc-find-root file ".git")) |
| 371 | 377 | ||
| 372 | (defun vc-git-command (buffer okstatus file &rest flags) | 378 | (defun vc-git-command (buffer okstatus file-or-list &rest flags) |
| 373 | "A wrapper around `vc-do-command' for use in vc-git.el. | 379 | "A wrapper around `vc-do-command' for use in vc-git.el. |
| 374 | The difference to vc-do-command is that this function always invokes `git'." | 380 | The difference to vc-do-command is that this function always invokes `git'." |
| 375 | (apply 'vc-do-command buffer okstatus "git" file flags)) | 381 | (apply 'vc-do-command buffer okstatus "git" file-or-list flags)) |
| 376 | 382 | ||
| 377 | (defun vc-git--run-command-string (file &rest args) | 383 | (defun vc-git--run-command-string (file &rest args) |
| 378 | "Run a git command on FILE and return its output as string." | 384 | "Run a git command on FILE and return its output as string." |