comparison lisp/vc-git.el @ 82066:f599171df164

(vc-git-delete-file, vc-git-rename-file): New functions. (vc-git-find-version): Use the result of ls-files as a parameter for cat-file
author Dan Nicolaescu <dann@ics.uci.edu>
date Mon, 23 Jul 2007 20:51:02 +0000
parents 1120899d5359
children cbb38ceb3177
comparison
equal deleted inserted replaced
82065:e191c96a308d 82066:f599171df164
1 ;;; vc-git.el --- VC backend for the git version control system 1 ;;; vc-git.el --- VC backend for the git version control system
2 2
3 ;; Copyright (C) 2006, 2007 Free Software Foundation, Inc. 3 ;; Copyright (C) 2006, 2007 Free Software Foundation, Inc.
4 4
5 ;; Author: Alexandre Julliard 5 ;; Author: Alexandre Julliard <julliard@winehq.org>
6 ;; Keywords: tools 6 ;; Keywords: tools
7 7
8 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
9 9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify 10 ;; GNU Emacs is free software; you can redistribute it and/or modify
99 ;; - repository-hostname (dirname) ?? 99 ;; - repository-hostname (dirname) ??
100 ;; - previous-version (file rev) ?? 100 ;; - previous-version (file rev) ??
101 ;; - next-version (file rev) ?? 101 ;; - next-version (file rev) ??
102 ;; - check-headers () ?? 102 ;; - check-headers () ??
103 ;; - clear-headers () ?? 103 ;; - clear-headers () ??
104 ;; - delete-file (file) COMMENTED OUT, VERIFY IF CORRECT 104 ;; - delete-file (file) OK
105 ;; - rename-file (old new) COMMENTED OUT, VERIFY IF CORRECT 105 ;; - rename-file (old new) OK
106 ;; - find-file-hook () PROBABLY NOT NEEDED 106 ;; - find-file-hook () PROBABLY NOT NEEDED
107 ;; - find-file-not-found-hook () PROBABLY NOT NEEDED 107 ;; - find-file-not-found-hook () PROBABLY NOT NEEDED
108 108
109 (eval-when-compile (require 'cl) (require 'vc)) 109 (eval-when-compile (require 'cl) (require 'vc))
110 110
235 (let ((coding-system-for-write git-commits-coding-system)) 235 (let ((coding-system-for-write git-commits-coding-system))
236 (vc-git-command nil 0 files "commit" "-m" comment "--only" "--"))) 236 (vc-git-command nil 0 files "commit" "-m" comment "--only" "--")))
237 237
238 (defun vc-git-find-version (file rev buffer) 238 (defun vc-git-find-version (file rev buffer)
239 (let ((coding-system-for-read 'binary) 239 (let ((coding-system-for-read 'binary)
240 (coding-system-for-write 'binary)) 240 (coding-system-for-write 'binary)
241 (fullname (substring
242 (vc-git--run-command-string
243 file "ls-files" "-z" "--full-name" "--")
244 0 -1)))
241 (vc-git-command 245 (vc-git-command
242 buffer 0 246 buffer 0
243 (concat (if rev rev "HEAD") ":" file) "cat-file" "blob"))) 247 (concat (if rev rev "HEAD") ":" fullname) "cat-file" "blob")))
244 248
245 (defun vc-git-checkout (file &optional editable rev) 249 (defun vc-git-checkout (file &optional editable rev)
246 (vc-git-command nil0 file "checkout" (or rev "HEAD"))) 250 (vc-git-command nil0 file "checkout" (or rev "HEAD")))
247 251
248 (defun vc-git-revert (file &optional contents-done) 252 (defun vc-git-revert (file &optional contents-done)
381 (zerop (forward-line -1)) 385 (zerop (forward-line -1))
382 (buffer-substring-no-properties 386 (buffer-substring-no-properties
383 (point) 387 (point)
384 (progn (forward-line 1) (1- (point)))))))))) 388 (progn (forward-line 1) (1- (point))))))))))
385 389
386 ;; XXX verify this is correct 390 (defun vc-git-delete-file (file)
387 ;; (defun vc-git-delete-file (file) 391 (vc-git-command nil 0 file "rm" "-f" "--"))
388 ;; (condition-case () 392
389 ;; (delete-file file) 393 (defun vc-git-rename-file (old new)
390 ;; (file-error nil)) 394 (vc-git-command nil 0 (list old new) "mv" "-f" "--"))
391 ;; (vc-git-command nil 0 file "update-index" "--remove"))
392
393 ;; XXX verify this is correct
394 ;; (defun vc-git-rename-file (old new)
395 ;; (vc-git-command nil 0 new old "mv"))
396 395
397 396
398 ;; Internal commands 397 ;; Internal commands
399 398
400 (defun vc-git-root (file) 399 (defun vc-git-root (file)