aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2007-07-21 16:44:56 +0000
committerDan Nicolaescu2007-07-21 16:44:56 +0000
commit34b7fb850d3b2d3cea07e0895c4457e672c29004 (patch)
tree95d6feaba6a1260fd82098d2dd2f9d645fc6a94b
parent51063027dd8d60f4b66a7e6ce7be949d847c5853 (diff)
downloademacs-34b7fb850d3b2d3cea07e0895c4457e672c29004.tar.gz
emacs-34b7fb850d3b2d3cea07e0895c4457e672c29004.zip
(vc-hg-dir-state): Fix loop.
(vc-hg-print-log): Fix expected return value for vc-hg-command. (vc-hg-next-version, vc-hg-delete-file, vc-hg-rename-file) (vc-hg-register, vc-hg-create-repo, vc-hg-checkin) (vc-hg-revert): Likewise. (vc-hg-revision-table, vc-hg-revision-completion-table): New functions.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/vc-hg.el51
2 files changed, 44 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 81e89689913..7e47be7d079 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12007-07-21 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * vc-hg.el (vc-hg-dir-state): Fix loop.
4 (vc-hg-print-log): Fix expected return value for vc-hg-command.
5 (vc-hg-next-version, vc-hg-delete-file, vc-hg-rename-file)
6 (vc-hg-register, vc-hg-create-repo, vc-hg-checkin)
7 (vc-hg-revert): Likewise.
8 (vc-hg-revision-table, vc-hg-revision-completion-table): New
9 functions.
10
12007-07-20 Stefan Monnier <monnier@iro.umontreal.ca> 112007-07-20 Stefan Monnier <monnier@iro.umontreal.ca>
2 12
3 * add-log.el (change-log-resolve-conflict): Don't lose data if the 13 * add-log.el (change-log-resolve-conflict): Don't lose data if the
diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el
index 21ce5c38f41..b4aa7d3a124 100644
--- a/lisp/vc-hg.el
+++ b/lisp/vc-hg.el
@@ -76,9 +76,8 @@
76;; - comment-history (file) NOT NEEDED 76;; - comment-history (file) NOT NEEDED
77;; - update-changelog (files) NOT NEEDED 77;; - update-changelog (files) NOT NEEDED
78;; * diff (files &optional rev1 rev2 buffer) OK 78;; * diff (files &optional rev1 rev2 buffer) OK
79;; - revision-completion-table (file) ?? 79;; - revision-completion-table (file) OK
80;; - diff-tree (dir &optional rev1 rev2) TEST IT 80;; - diff-tree (dir &optional rev1 rev2) TEST IT
81;; - revision-completion-table (file) ??
82;; - annotate-command (file buf &optional rev) OK 81;; - annotate-command (file buf &optional rev) OK
83;; - annotate-time () OK 82;; - annotate-time () OK
84;; - annotate-current-time () ?? NOT NEEDED 83;; - annotate-current-time () ?? NOT NEEDED
@@ -115,6 +114,7 @@
115;;; Code: 114;;; Code:
116 115
117(eval-when-compile 116(eval-when-compile
117 (require 'cl)
118 (require 'vc)) 118 (require 'vc))
119 119
120;;; Customization options 120;;; Customization options
@@ -184,11 +184,12 @@
184 (goto-char (point-min)) 184 (goto-char (point-min))
185 (let ((status-char nil) 185 (let ((status-char nil)
186 (file nil)) 186 (file nil))
187 (while (eq 0 (forward-line)) 187 (while (not (eobp))
188 (setq status-char (char-after)) 188 (setq status-char (char-after))
189 (setq file 189 (setq file
190 (expand-file-name 190 (expand-file-name
191 (buffer-substring-no-properties (+ (point) 2) (line-end-position)))) 191 (buffer-substring-no-properties (+ (point) 2)
192 (line-end-position))))
192 (cond 193 (cond
193 ;; The rest of the possible states in "hg status" output: 194 ;; The rest of the possible states in "hg status" output:
194 ;; R = removed 195 ;; R = removed
@@ -203,7 +204,8 @@
203 (vc-file-setprop file 'vc-state 'edited)) 204 (vc-file-setprop file 'vc-state 'edited))
204 ((eq status-char ??) 205 ((eq status-char ??)
205 (vc-file-setprop file 'vc-backend 'none) 206 (vc-file-setprop file 'vc-backend 'none)
206 (vc-file-setprop file 'vc-state 'nil))))))) 207 (vc-file-setprop file 'vc-state 'nil)))
208 (forward-line)))))
207 209
208(defun vc-hg-workfile-version (file) 210(defun vc-hg-workfile-version (file)
209 "Hg-specific version of `vc-workfile-version'." 211 "Hg-specific version of `vc-workfile-version'."
@@ -248,7 +250,7 @@
248 (with-current-buffer 250 (with-current-buffer
249 buffer 251 buffer
250 (insert "File: " (file-name-nondirectory file) "\n")) 252 (insert "File: " (file-name-nondirectory file) "\n"))
251 (vc-hg-command buffer nil file "log")))) 253 (vc-hg-command buffer 0 file "log"))))
252 254
253(defvar log-view-message-re) 255(defvar log-view-message-re)
254(defvar log-view-file-re) 256(defvar log-view-file-re)
@@ -293,6 +295,21 @@
293 (list "-r" oldvers)) 295 (list "-r" oldvers))
294 (list "")))))) 296 (list ""))))))
295 297
298(defun vc-hg-revision-table (file)
299 (let ((default-directory (file-name-directory file)))
300 (with-temp-buffer
301 (vc-hg-command t nil file "log" "--template" "{rev} ")
302 (split-string
303 (buffer-substring-no-properties (point-min) (point-max))))))
304
305;; Modelled after the similar function in vc-cvs.el
306(defun vc-hg-revision-completion-table (file)
307 (lexical-let ((file file)
308 table)
309 (setq table (lazy-completion-table
310 table (lambda () (vc-hg-revision-table file))))
311 table))
312
296(defun vc-hg-diff-tree (file &optional oldvers newvers buffer) 313(defun vc-hg-diff-tree (file &optional oldvers newvers buffer)
297 (vc-hg-diff (list file) oldvers newvers buffer)) 314 (vc-hg-diff (list file) oldvers newvers buffer))
298 315
@@ -331,7 +348,7 @@ Optional arg VERSION is a version to annotate from."
331 (let ((newrev (1+ (string-to-number rev))) 348 (let ((newrev (1+ (string-to-number rev)))
332 (tip-version 349 (tip-version
333 (with-temp-buffer 350 (with-temp-buffer
334 (vc-hg-command t nil nil "tip") 351 (vc-hg-command t 0 nil "tip")
335 (goto-char (point-min)) 352 (goto-char (point-min))
336 (re-search-forward "^changeset:[ \t]*\\([0-9]+\\):") 353 (re-search-forward "^changeset:[ \t]*\\([0-9]+\\):")
337 (string-to-number (match-string-no-properties 1))))) 354 (string-to-number (match-string-no-properties 1)))))
@@ -346,22 +363,22 @@ Optional arg VERSION is a version to annotate from."
346 (condition-case () 363 (condition-case ()
347 (delete-file file) 364 (delete-file file)
348 (file-error nil)) 365 (file-error nil))
349 (vc-hg-command nil nil file "remove" "--after" "--force")) 366 (vc-hg-command nil 0 file "remove" "--after" "--force"))
350 367
351;; Modelled after the similar function in vc-bzr.el 368;; Modelled after the similar function in vc-bzr.el
352(defun vc-hg-rename-file (old new) 369(defun vc-hg-rename-file (old new)
353 "Rename file from OLD to NEW using `hg mv'." 370 "Rename file from OLD to NEW using `hg mv'."
354 (vc-hg-command nil nil new old "mv")) 371 (vc-hg-command nil 0 new old "mv"))
355 372
356(defun vc-hg-register (files &optional rev comment) 373(defun vc-hg-register (files &optional rev comment)
357 "Register FILES under hg. 374 "Register FILES under hg.
358REV is ignored. 375REV is ignored.
359COMMENT is ignored." 376COMMENT is ignored."
360 (vc-hg-command nil nil files "add")) 377 (vc-hg-command nil 0 files "add"))
361 378
362(defun vc-hg-create-repo () 379(defun vc-hg-create-repo ()
363 "Create a new Mercurial repository." 380 "Create a new Mercurial repository."
364 (vc-hg-command nil nil nil "init")) 381 (vc-hg-command nil 0 nil "init"))
365 382
366(defalias 'vc-hg-responsible-p 'vc-hg-root) 383(defalias 'vc-hg-responsible-p 'vc-hg-root)
367 384
@@ -384,14 +401,14 @@ COMMENT is ignored."
384(defun vc-hg-checkin (files rev comment) 401(defun vc-hg-checkin (files rev comment)
385 "HG-specific version of `vc-backend-checkin'. 402 "HG-specific version of `vc-backend-checkin'.
386REV is ignored." 403REV is ignored."
387 (vc-hg-command nil nil files "commit" "-m" comment)) 404 (vc-hg-command nil 0 files "commit" "-m" comment))
388 405
389(defun vc-hg-find-version (file rev buffer) 406(defun vc-hg-find-version (file rev buffer)
390 (let ((coding-system-for-read 'binary) 407 (let ((coding-system-for-read 'binary)
391 (coding-system-for-write 'binary)) 408 (coding-system-for-write 'binary))
392 (if rev 409 (if rev
393 (vc-hg-command buffer nil file "cat" "-r" rev) 410 (vc-hg-command buffer 0 file "cat" "-r" rev)
394 (vc-hg-command buffer nil file "cat")))) 411 (vc-hg-command buffer 0 file "cat"))))
395 412
396;; Modelled after the similar function in vc-bzr.el 413;; Modelled after the similar function in vc-bzr.el
397(defun vc-hg-checkout (file &optional editable rev) 414(defun vc-hg-checkout (file &optional editable rev)
@@ -402,8 +419,8 @@ REV is the revision to check out into WORKFILE."
402 (coding-system-for-write 'binary)) 419 (coding-system-for-write 'binary))
403 (with-current-buffer (or (get-file-buffer file) (current-buffer)) 420 (with-current-buffer (or (get-file-buffer file) (current-buffer))
404 (if rev 421 (if rev
405 (vc-hg-command t nil file "cat" "-r" rev) 422 (vc-hg-command t 0 file "cat" "-r" rev)
406 (vc-hg-command t nil file "cat"))))) 423 (vc-hg-command t 0 file "cat")))))
407 424
408(defun vc-hg-checkout-model (file) 425(defun vc-hg-checkout-model (file)
409 'implicit) 426 'implicit)
@@ -424,7 +441,7 @@ REV is the revision to check out into WORKFILE."
424;; Modelled after the similar function in vc-bzr.el 441;; Modelled after the similar function in vc-bzr.el
425(defun vc-hg-revert (file &optional contents-done) 442(defun vc-hg-revert (file &optional contents-done)
426 (unless contents-done 443 (unless contents-done
427 (with-temp-buffer (vc-hg-command t nil file "revert")))) 444 (with-temp-buffer (vc-hg-command t 0 file "revert"))))
428 445
429;;; Internal functions 446;;; Internal functions
430 447