aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/vc-git.el68
2 files changed, 47 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 65239278624..ad836f8ef03 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12007-07-26 Alexandre Julliard <julliard@winehq.org>
2
3 * vc-git.el (vc-git-revision-table)
4 (vc-git-revision-completion-table): New functions.
5
12007-07-26 Vinicius Jose Latorre <viniciusjl@ig.com.br> 62007-07-26 Vinicius Jose Latorre <viniciusjl@ig.com.br>
2 7
3 * progmodes/ebnf-abn.el (ebnf-abn-skip-comment): 8 * progmodes/ebnf-abn.el (ebnf-abn-skip-comment):
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index 5dcdab94f47..619199fc287 100644
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -51,10 +51,10 @@
51;; STATE-QUERYING FUNCTIONS 51;; STATE-QUERYING FUNCTIONS
52;; * registered (file) OK 52;; * registered (file) OK
53;; * state (file) OK 53;; * state (file) OK
54;; - state-heuristic (file) ?? PROBABLY NOT NEEDED 54;; - state-heuristic (file) NOT NEEDED
55;; - dir-state (dir) OK 55;; - dir-state (dir) OK
56;; * workfile-version (file) OK 56;; * workfile-version (file) OK
57;; - latest-on-branch-p (file) ?? 57;; - latest-on-branch-p (file) NOT NEEDED
58;; * checkout-model (file) OK 58;; * checkout-model (file) OK
59;; - workfile-unchanged-p (file) OK 59;; - workfile-unchanged-p (file) OK
60;; - mode-line-string (file) NOT NEEDED 60;; - mode-line-string (file) NOT NEEDED
@@ -62,19 +62,19 @@
62;; STATE-CHANGING FUNCTIONS 62;; STATE-CHANGING FUNCTIONS
63;; * create-repo () OK 63;; * create-repo () OK
64;; * register (files &optional rev comment) OK 64;; * register (files &optional rev comment) OK
65;; - init-version (file) ?? 65;; - init-version (file) NOT NEEDED
66;; - responsible-p (file) OK 66;; - responsible-p (file) OK
67;; - could-register (file) NEEDED 67;; - could-register (file) NOT NEEDED, DEFAULT IS GOOD
68;; - receive-file (file rev) ?? 68;; - receive-file (file rev) NOT NEEDED
69;; - unregister (file) OK 69;; - unregister (file) OK
70;; * checkin (files rev comment) OK 70;; * checkin (files rev comment) OK
71;; * find-version (file rev buffer) OK 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) ?? PROBABLY NOT NEEDED 74;; - rollback (files) COULD BE SUPPORTED
75;; - merge (file rev1 rev2) It would be possible to merge changes into 75;; - merge (file rev1 rev2) It would be possible to merge changes into
76;; a single file, but when committing they 76;; a single file, but when committing they
77;; wouldn't be identified as a merge by git, 77;; wouldn't be identified as a merge by git,
78;; so it's probably not a good idea. 78;; so it's probably not a good idea.
79;; - merge-news (file) see `merge' 79;; - merge-news (file) see `merge'
80;; - steal-lock (file &optional version) NOT NEEDED 80;; - steal-lock (file &optional version) NOT NEEDED
@@ -82,32 +82,32 @@
82;; * print-log (files &optional buffer) OK 82;; * print-log (files &optional buffer) OK
83;; - log-view-mode () OK 83;; - log-view-mode () OK
84;; - show-log-entry (version) NOT NEEDED, DEFAULT IS GOOD 84;; - show-log-entry (version) NOT NEEDED, DEFAULT IS GOOD
85;; - wash-log (file) ?? 85;; - wash-log (file) COULD BE SUPPORTED
86;; - logentry-check () ?? 86;; - logentry-check () NOT NEEDED
87;; - comment-history (file) ?? 87;; - comment-history (file) ??
88;; - update-changelog (files) ?? 88;; - update-changelog (files) COULD BE SUPPORTED
89;; * diff (file &optional rev1 rev2 buffer) OK 89;; * diff (file &optional rev1 rev2 buffer) OK
90;; - revision-completion-table (file) NEEDED? 90;; - revision-completion-table (file) NEEDED?
91;; - diff-tree (dir &optional rev1 rev2) OK 91;; - diff-tree (dir &optional rev1 rev2) OK
92;; - annotate-command (file buf &optional rev) OK 92;; - annotate-command (file buf &optional rev) OK
93;; - annotate-time () OK 93;; - annotate-time () OK
94;; - annotate-current-time () ?? NOT NEEDED 94;; - annotate-current-time () NOT NEEDED
95;; - annotate-extract-revision-at-line () OK 95;; - annotate-extract-revision-at-line () OK
96;; SNAPSHOT SYSTEM 96;; SNAPSHOT SYSTEM
97;; - create-snapshot (dir name branchp) OK 97;; - create-snapshot (dir name branchp) OK
98;; - assign-name (file name) NOT NEEDED 98;; - assign-name (file name) NOT NEEDED
99;; - retrieve-snapshot (dir name update) OK, needs to update buffers 99;; - retrieve-snapshot (dir name update) OK, needs to update buffers
100;; MISCELLANEOUS 100;; MISCELLANEOUS
101;; - make-version-backups-p (file) ?? 101;; - make-version-backups-p (file) NOT NEEDED
102;; - repository-hostname (dirname) ?? 102;; - repository-hostname (dirname) NOT NEEDED
103;; - previous-version (file rev) OK 103;; - previous-version (file rev) OK
104;; - next-version (file rev) OK 104;; - next-version (file rev) OK
105;; - check-headers () ?? 105;; - check-headers () COULD BE SUPPORTED
106;; - clear-headers () ?? 106;; - clear-headers () NOT NEEDED
107;; - delete-file (file) OK 107;; - delete-file (file) OK
108;; - rename-file (old new) OK 108;; - rename-file (old new) OK
109;; - find-file-hook () PROBABLY NOT NEEDED 109;; - find-file-hook () NOT NEEDED
110;; - find-file-not-found-hook () PROBABLY NOT NEEDED 110;; - find-file-not-found-hook () NOT NEEDED
111 111
112(eval-when-compile (require 'cl) (require 'vc)) 112(eval-when-compile (require 'cl) (require 'vc))
113 113
@@ -146,7 +146,7 @@
146 (let ((str (buffer-string))) 146 (let ((str (buffer-string)))
147 (and (> (length str) (length name)) 147 (and (> (length str) (length name))
148 (string= (substring str 0 (1+ (length name))) (concat name "\0"))))))))) 148 (string= (substring str 0 (1+ (length name))) (concat name "\0")))))))))
149 149
150(defun vc-git-state (file) 150(defun vc-git-state (file)
151 "Git-specific version of `vc-state'." 151 "Git-specific version of `vc-state'."
152 (let ((diff (vc-git--run-command-string file "diff-index" "-z" "HEAD" "--"))) 152 (let ((diff (vc-git--run-command-string file "diff-index" "-z" "HEAD" "--")))
@@ -200,7 +200,7 @@
200 ;; stat info, so if the file has been modified it will always show 200 ;; stat info, so if the file has been modified it will always show
201 ;; up as modified in vc-git-state, even if the change has been 201 ;; up as modified in vc-git-state, even if the change has been
202 ;; undone, until git-update-index --refresh is run. 202 ;; undone, until git-update-index --refresh is run.
203 203
204 ;; OTOH the vc-git-workfile-unchanged-p implementation checks the 204 ;; OTOH the vc-git-workfile-unchanged-p implementation checks the
205 ;; actual content, so it will detect the case of a file reverted 205 ;; actual content, so it will detect the case of a file reverted
206 ;; back to its original state. 206 ;; back to its original state.
@@ -236,7 +236,7 @@
236 236
237(defun vc-git-unregister (file) 237(defun vc-git-unregister (file)
238 (vc-git-command nil 0 file "rm" "-f" "--cached" "--")) 238 (vc-git-command nil 0 file "rm" "-f" "--cached" "--"))
239 239
240 240
241(defun vc-git-checkin (files rev comment) 241(defun vc-git-checkin (files rev comment)
242 (let ((coding-system-for-write git-commits-coding-system)) 242 (let ((coding-system-for-write git-commits-coding-system))
@@ -246,11 +246,11 @@
246 (let ((coding-system-for-read 'binary) 246 (let ((coding-system-for-read 'binary)
247 (coding-system-for-write 'binary) 247 (coding-system-for-write 'binary)
248 (fullname (substring 248 (fullname (substring
249 (vc-git--run-command-string 249 (vc-git--run-command-string
250 file "ls-files" "-z" "--full-name" "--") 250 file "ls-files" "-z" "--full-name" "--")
251 0 -1))) 251 0 -1)))
252 (vc-git-command 252 (vc-git-command
253 buffer 0 253 buffer 0
254 (concat (if rev rev "HEAD") ":" fullname) "cat-file" "blob"))) 254 (concat (if rev rev "HEAD") ":" fullname) "cat-file" "blob")))
255 255
256(defun vc-git-checkout (file &optional editable rev) 256(defun vc-git-checkout (file &optional editable rev)
@@ -283,7 +283,7 @@
283 (with-current-buffer 283 (with-current-buffer
284 buffer 284 buffer
285 (insert "File: " (file-name-nondirectory file) "\n")) 285 (insert "File: " (file-name-nondirectory file) "\n"))
286 (vc-git-command buffer 'async (file-relative-name file) 286 (vc-git-command buffer 'async (file-relative-name file)
287 "rev-list" "--pretty" "HEAD" "--"))))) 287 "rev-list" "--pretty" "HEAD" "--")))))
288 288
289(defvar log-view-message-re) 289(defvar log-view-message-re)
@@ -318,6 +318,22 @@
318 (vc-git-command buf 1 files "diff-tree" "--exit-code" "-p" rev1 rev2 "--") 318 (vc-git-command buf 1 files "diff-tree" "--exit-code" "-p" rev1 rev2 "--")
319 (vc-git-command buf 1 files "diff-index" "--exit-code" "-p" (or rev1 "HEAD") "--")))) 319 (vc-git-command buf 1 files "diff-index" "--exit-code" "-p" (or rev1 "HEAD") "--"))))
320 320
321(defun vc-git-revision-table (file)
322 (let ((table (list "HEAD")))
323 (with-temp-buffer
324 (vc-git-command t nil nil "for-each-ref" "--format=%(refname)")
325 (goto-char (point-min))
326 (while (re-search-forward "^refs/\\(heads\\|tags\\)/\\(.*\\)$" nil t)
327 (push (match-string 2) table)))
328 table))
329
330(defun vc-git-revision-completion-table (file)
331 (lexical-let ((file file)
332 table)
333 (setq table (lazy-completion-table
334 table (lambda () (vc-git-revision-table file))))
335 table))
336
321(defun vc-git-diff-tree (dir &optional rev1 rev2) 337(defun vc-git-diff-tree (dir &optional rev1 rev2)
322 (vc-git-diff dir rev1 rev2)) 338 (vc-git-diff dir rev1 rev2))
323 339