Mercurial > emacs
comparison lisp/vc-cvs.el @ 50923:3eab629b1239
(vc-cvs-mode-line-string): Use vc-default-mode-line-string.
(vc-cvs-delete-file, vc-cvs-rename-file): New functions.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 09 May 2003 14:32:01 +0000 |
parents | 8c4130079acf |
children | 0b871f4efb59 |
comparison
equal
deleted
inserted
replaced
50922:bdc62a6694f7 | 50923:3eab629b1239 |
---|---|
3 ;; Copyright (C) 1995,98,99,2000,2001,2002 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1995,98,99,2000,2001,2002 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: FSF (see vc.el for full credits) | 5 ;; Author: FSF (see vc.el for full credits) |
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
7 | 7 |
8 ;; $Id: vc-cvs.el,v 1.58 2003/05/08 20:08:12 monnier Exp $ | 8 ;; $Id: vc-cvs.el,v 1.59 2003/05/08 20:44:50 monnier Exp $ |
9 | 9 |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 | 11 |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
255 (defun vc-cvs-mode-line-string (file) | 255 (defun vc-cvs-mode-line-string (file) |
256 "Return string for placement into the modeline for FILE. | 256 "Return string for placement into the modeline for FILE. |
257 Compared to the default implementation, this function does two things: | 257 Compared to the default implementation, this function does two things: |
258 Handle the special case of a CVS file that is added but not yet | 258 Handle the special case of a CVS file that is added but not yet |
259 committed and support display of sticky tags." | 259 committed and support display of sticky tags." |
260 (let* ((state (vc-state file)) | 260 (let ((sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag)) |
261 (rev (vc-workfile-version file)) | 261 (string (if (string= (vc-workfile-version file) "0") |
262 (sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag)) | 262 ;; A file that is added but not yet committed. |
263 (sticky-tag-printable (and sticky-tag | 263 "CVS @@" |
264 (not (string= sticky-tag "")) | 264 (vc-default-mode-line-string 'CVS file)))) |
265 (concat "[" sticky-tag "]")))) | 265 (if (zerop (length sticky-tag)) |
266 (cond ((string= rev "0") | 266 string |
267 ;; A file that is added but not yet committed. | 267 (concat string "[" sticky-tag "]")))) |
268 "CVS @@") | |
269 ((or (eq state 'up-to-date) | |
270 (eq state 'needs-patch)) | |
271 (concat "CVS-" rev sticky-tag-printable)) | |
272 ((stringp state) | |
273 (concat "CVS:" state ":" rev sticky-tag-printable)) | |
274 (t | |
275 ;; Not just for the 'edited state, but also a fallback | |
276 ;; for all other states. Think about different symbols | |
277 ;; for 'needs-patch and 'needs-merge. | |
278 (concat "CVS:" rev sticky-tag-printable))))) | |
279 | 268 |
280 (defun vc-cvs-dired-state-info (file) | 269 (defun vc-cvs-dired-state-info (file) |
281 "CVS-specific version of `vc-dired-state-info'." | 270 "CVS-specific version of `vc-dired-state-info'." |
282 (let ((cvs-state (vc-state file))) | 271 (let ((cvs-state (vc-state file))) |
283 (cond ((eq cvs-state 'edited) | 272 (cond ((eq cvs-state 'edited) |
446 (concat "-r" rev)) | 435 (concat "-r" rev)) |
447 switches)))) | 436 switches)))) |
448 (vc-mode-line file) | 437 (vc-mode-line file) |
449 (message "Checking out %s...done" filename))))) | 438 (message "Checking out %s...done" filename))))) |
450 | 439 |
440 (defun vc-cvs-delete-file (file) | |
441 (vc-cvs-command nil 0 file "remove" "-f")) | |
442 | |
443 (defun vc-cvs-rename-file (old new) | |
444 ;; CVS doesn't know how to move files, so we just remove&add. | |
445 (condition-case nil | |
446 (add-name-to-file old new) | |
447 (error (rename-file old new))) | |
448 (vc-cvs-delete-file old) | |
449 (with-current-buffer (find-file-noselect new) | |
450 (vc-register))) | |
451 | |
451 (defun vc-cvs-revert (file &optional contents-done) | 452 (defun vc-cvs-revert (file &optional contents-done) |
452 "Revert FILE to the version it was based on." | 453 "Revert FILE to the version it was based on." |
453 (unless contents-done | 454 (unless contents-done |
454 ;; Check out via standard output (caused by the final argument | 455 ;; Check out via standard output (caused by the final argument |
455 ;; FILE below), so that no sticky tag is set. | 456 ;; FILE below), so that no sticky tag is set. |