aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2007-07-23 16:01:25 +0000
committerDan Nicolaescu2007-07-23 16:01:25 +0000
commitb0f90937fa9779188cc87f37c34955a55e03fabf (patch)
tree5d7cb3efd6566d73e63aaaf3aea00bbdff532a34
parent4d3ac01e411ed927223d2774fb3e75bf0b2f71bd (diff)
downloademacs-b0f90937fa9779188cc87f37c34955a55e03fabf.tar.gz
emacs-b0f90937fa9779188cc87f37c34955a55e03fabf.zip
(vc-git-checkin): Delete unused parameter and the code
handling it. Use vc-git-command. (vc-git-find-version, vc-git-diff-tree): New functions. (vc-git-revert): Use vc-git-command. (vc-git--run-command): Delete.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/vc-git.el55
2 files changed, 39 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c46ad1166bc..f474a0b1997 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12007-07-23 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * vc-git.el (vc-git-checkin): Delete unused parameter and the code
4 handling it. Use vc-git-command.
5 (vc-git-find-version, vc-git-diff-tree): New functions.
6 (vc-git-revert): Use vc-git-command.
7 (vc-git--run-command): Delete.
8
12007-07-23 Alexandre Julliard <julliard@winehq.org> 92007-07-23 Alexandre Julliard <julliard@winehq.org>
2 10
3 * vc-git.el (vc-git-workfile-unchanged-p): Update comment. 11 * vc-git.el (vc-git-workfile-unchanged-p): Update comment.
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index 8b46c957cdf..82ae7f21510 100644
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -68,10 +68,10 @@
68;; - receive-file (file rev) ?? 68;; - receive-file (file rev) ??
69;; - unregister (file) NEEDED 69;; - unregister (file) NEEDED
70;; * checkin (files rev comment) OK 70;; * checkin (files rev comment) OK
71;; * find-version (file rev buffer) NEEDED! 71;; * find-version (file rev buffer) OK
72;; * checkout (file &optional editable rev) OK 72;; * checkout (file &optional editable rev) OK
73;; * revert (file &optional contents-done) OK 73;; * revert (file &optional contents-done) OK
74;; - rollback (files) NEEDED 74;; - rollback (files) ?? PROBABLY NOT NEEDED
75;; - merge (file rev1 rev2) NEEDED 75;; - merge (file rev1 rev2) NEEDED
76;; - merge-news (file) NEEDED 76;; - merge-news (file) NEEDED
77;; - steal-lock (file &optional version) NOT NEEDED 77;; - steal-lock (file &optional version) NOT NEEDED
@@ -85,7 +85,7 @@
85;; - update-changelog (files) ?? 85;; - update-changelog (files) ??
86;; * diff (file &optional rev1 rev2 buffer) PORT TO NEW VC INTERFACE 86;; * diff (file &optional rev1 rev2 buffer) PORT TO NEW VC INTERFACE
87;; - revision-completion-table (file) NEEDED? 87;; - revision-completion-table (file) NEEDED?
88;; - diff-tree (dir &optional rev1 rev2) NEEDED 88;; - diff-tree (dir &optional rev1 rev2) OK
89;; - annotate-command (file buf &optional rev) OK 89;; - annotate-command (file buf &optional rev) OK
90;; - annotate-time () OK 90;; - annotate-time () OK
91;; - annotate-current-time () ?? NOT NEEDED 91;; - annotate-current-time () ?? NOT NEEDED
@@ -101,12 +101,12 @@
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) NEEDED 104;; - delete-file (file) COMMENTED OUT, VERIFY IF CORRECT
105;; - rename-file (old new) NEEDED 105;; - rename-file (old new) COMMENTED OUT, VERIFY IF CORRECT
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)) 109(eval-when-compile (require 'cl) (require 'vc))
110 110
111(defvar git-commits-coding-system 'utf-8 111(defvar git-commits-coding-system 'utf-8
112 "Default coding system for git commits.") 112 "Default coding system for git commits.")
@@ -235,23 +235,21 @@
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-checkout (file &optional editable rev destfile) 238(defun vc-git-find-version (file rev buffer)
239 (if destfile 239 (let ((coding-system-for-read 'binary)
240 (let ((fullname (substring 240 (coding-system-for-write 'binary))
241 (vc-git--run-command-string file "ls-files" "-z" "--full-name" "--") 241 (vc-git-command
242 0 -1)) 242 buffer 0
243 (coding-system-for-read 'no-conversion) 243 (concat (if rev rev "HEAD") ":" file) "cat-file" "blob")))
244 (coding-system-for-write 'no-conversion)) 244
245 (with-temp-file destfile 245(defun vc-git-checkout (file &optional editable rev)
246 (eq 0 (call-process "git" nil t nil "cat-file" "blob" 246 (vc-git-command nil0 file "checkout" (or rev "HEAD")))
247 (concat (or rev "HEAD") ":" fullname)))))
248 (vc-git--run-command file "checkout" (or rev "HEAD"))))
249 247
250(defun vc-git-revert (file &optional contents-done) 248(defun vc-git-revert (file &optional contents-done)
251 "Revert FILE to the version stored in the git repository." 249 "Revert FILE to the version stored in the git repository."
252 (if contents-done 250 (if contents-done
253 (vc-git--run-command file "update-index" "--") 251 (vc-git-command nil 0 file "update-index" "--")
254 (vc-git--run-command file "checkout" "HEAD"))) 252 (vc-git-command nil 0 file "checkout" "HEAD")))
255 253
256;;; HISTORY FUNCTIONS 254;;; HISTORY FUNCTIONS
257 255
@@ -314,6 +312,9 @@
314 ;; git-diff-index doesn't set exit status like diff does 312 ;; git-diff-index doesn't set exit status like diff does
315 (if (vc-git-workfile-unchanged-p file) 0 1))) 313 (if (vc-git-workfile-unchanged-p file) 0 1)))
316 314
315(defun vc-git-diff-tree (dir &optional rev1 rev2)
316 (vc-git-diff dir rev1 rev2))
317
317(defun vc-git-annotate-command (file buf &optional rev) 318(defun vc-git-annotate-command (file buf &optional rev)
318 ;; FIXME: rev is ignored 319 ;; FIXME: rev is ignored
319 (let ((name (file-relative-name file))) 320 (let ((name (file-relative-name file)))
@@ -382,6 +383,17 @@
382 (point) 383 (point)
383 (progn (forward-line 1) (1- (point)))))))))) 384 (progn (forward-line 1) (1- (point))))))))))
384 385
386;; XXX verify this is correct
387;; (defun vc-hg-delete-file (file)
388;; (condition-case ()
389;; (delete-file file)
390;; (file-error nil))
391;; (vc-hg-command nil 0 file "update-index" "--remove"))
392
393;; XXX verify this is correct
394;; (defun vc-hg-rename-file (old new)
395;; (vc-git-command nil 0 new old "mv"))
396
385 397
386;; Internal commands 398;; Internal commands
387 399
@@ -403,11 +415,6 @@ The difference to vc-do-command is that this function always invokes `git'."
403 (setq ok nil)))))) 415 (setq ok nil))))))
404 (and ok str))) 416 (and ok str)))
405 417
406(defun vc-git--run-command (file &rest args)
407 "Run a git command on FILE, discarding any output."
408 (let ((name (file-relative-name file)))
409 (eq 0 (apply #'call-process "git" nil (get-buffer "*Messages") nil (append args (list name))))))
410
411(defun vc-git-symbolic-commit (commit) 418(defun vc-git-symbolic-commit (commit)
412 "Translate COMMIT string into symbolic form. 419 "Translate COMMIT string into symbolic form.
413Returns nil if not possible." 420Returns nil if not possible."