Mercurial > emacs
comparison lisp/vc.el @ 49597:e88404e8f2cf
Trailing whitespace deleted.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Tue, 04 Feb 2003 12:29:42 +0000 |
parents | 7bba5b5ff0d2 |
children | b48f8839a782 |
comparison
equal
deleted
inserted
replaced
49596:b06535145619 | 49597:e88404e8f2cf |
---|---|
4 | 4 |
5 ;; Author: FSF (see below for full credits) | 5 ;; Author: FSF (see below for full credits) |
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
7 ;; Keywords: tools | 7 ;; Keywords: tools |
8 | 8 |
9 ;; $Id: vc.el,v 1.346 2002/11/03 15:08:29 spiegel Exp $ | 9 ;; $Id: vc.el,v 1.347 2002/12/26 14:04:21 spiegel Exp $ |
10 | 10 |
11 ;; This file is part of GNU Emacs. | 11 ;; This file is part of GNU Emacs. |
12 | 12 |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | 13 ;; GNU Emacs is free software; you can redistribute it and/or modify |
14 ;; it under the terms of the GNU General Public License as published by | 14 ;; it under the terms of the GNU General Public License as published by |
146 ;; Return non-nil if FILE is unchanged from its current workfile | 146 ;; Return non-nil if FILE is unchanged from its current workfile |
147 ;; version. This function should do a brief comparison of FILE's | 147 ;; version. This function should do a brief comparison of FILE's |
148 ;; contents with those of the master version. If the backend does not | 148 ;; contents with those of the master version. If the backend does not |
149 ;; have such a brief-comparison feature, the default implementation of | 149 ;; have such a brief-comparison feature, the default implementation of |
150 ;; this function can be used, which delegates to a full | 150 ;; this function can be used, which delegates to a full |
151 ;; vc-BACKEND-diff. (Note that vc-BACKEND-diff must not run | 151 ;; vc-BACKEND-diff. (Note that vc-BACKEND-diff must not run |
152 ;; asynchronously in this case.) | 152 ;; asynchronously in this case.) |
153 ;; | 153 ;; |
154 ;; - mode-line-string (file) | 154 ;; - mode-line-string (file) |
155 ;; | 155 ;; |
156 ;; If provided, this function should return the VC-specific mode line | 156 ;; If provided, this function should return the VC-specific mode line |
720 (substring rev (match-beginning 0) (match-end 0))) | 720 (substring rev (match-beginning 0) (match-end 0))) |
721 | 721 |
722 (defun vc-default-previous-version (backend file rev) | 722 (defun vc-default-previous-version (backend file rev) |
723 "Guess the version number immediately preceding REV for FILE. | 723 "Guess the version number immediately preceding REV for FILE. |
724 This default implementation works for <major>.<minor>-style version numbers | 724 This default implementation works for <major>.<minor>-style version numbers |
725 as used by RCS and CVS." | 725 as used by RCS and CVS." |
726 (let ((branch (vc-branch-part rev)) | 726 (let ((branch (vc-branch-part rev)) |
727 (minor-num (string-to-number (vc-minor-part rev)))) | 727 (minor-num (string-to-number (vc-minor-part rev)))) |
728 (when branch | 728 (when branch |
729 (if (> minor-num 1) | 729 (if (> minor-num 1) |
730 ;; version does probably not start a branch or release | 730 ;; version does probably not start a branch or release |
780 `(let ((,filevar (expand-file-name ,file))) | 780 `(let ((,filevar (expand-file-name ,file))) |
781 (or (vc-backend ,filevar) | 781 (or (vc-backend ,filevar) |
782 (error (format "File not under version control: `%s'" file))) | 782 (error (format "File not under version control: `%s'" file))) |
783 (unless (vc-editable-p ,filevar) | 783 (unless (vc-editable-p ,filevar) |
784 (let ((state (vc-state ,filevar))) | 784 (let ((state (vc-state ,filevar))) |
785 (if (stringp state) | 785 (if (stringp state) |
786 (error (format "`%s' is locking `%s'" state ,filevar)) | 786 (error (format "`%s' is locking `%s'" state ,filevar)) |
787 (vc-checkout ,filevar t)))) | 787 (vc-checkout ,filevar t)))) |
788 (save-excursion | 788 (save-excursion |
789 ,@body) | 789 ,@body) |
790 (vc-checkin ,filevar nil ,comment)))) | 790 (vc-checkin ,filevar nil ,comment)))) |
1785 ;; if the file is not up-to-date, use current version as older version | 1785 ;; if the file is not up-to-date, use current version as older version |
1786 ((not (vc-up-to-date-p file)) | 1786 ((not (vc-up-to-date-p file)) |
1787 (setq rel1-default (vc-workfile-version file))) | 1787 (setq rel1-default (vc-workfile-version file))) |
1788 ;; if the file is not locked, use last and previous version as default | 1788 ;; if the file is not locked, use last and previous version as default |
1789 (t | 1789 (t |
1790 (setq rel1-default (vc-call previous-version file | 1790 (setq rel1-default (vc-call previous-version file |
1791 (vc-workfile-version file))) | 1791 (vc-workfile-version file))) |
1792 (if (string= rel1-default "") (setq rel1-default nil)) | 1792 (if (string= rel1-default "") (setq rel1-default nil)) |
1793 (setq rel2-default (vc-workfile-version file)))) | 1793 (setq rel2-default (vc-workfile-version file)))) |
1794 ;; construct argument list | 1794 ;; construct argument list |
1795 (list file | 1795 (list file |
2185 (defun vc-dired-reformat-line (vc-info) | 2185 (defun vc-dired-reformat-line (vc-info) |
2186 "Reformat a directory-listing line. | 2186 "Reformat a directory-listing line. |
2187 Replace various columns with version control information, VC-INFO. | 2187 Replace various columns with version control information, VC-INFO. |
2188 This code, like dired, assumes UNIX -l format." | 2188 This code, like dired, assumes UNIX -l format." |
2189 (beginning-of-line) | 2189 (beginning-of-line) |
2190 (when (re-search-forward | 2190 (when (re-search-forward |
2191 ;; Match link count, owner, group, size. Group may be missing, | 2191 ;; Match link count, owner, group, size. Group may be missing, |
2192 ;; and only the size is present in OS/2 -l format. | 2192 ;; and only the size is present in OS/2 -l format. |
2193 "^..[drwxlts-]+ \\( *[0-9]+\\( [^ ]+ +\\([^ ]+ +\\)?[0-9]+\\)?\\) " | 2193 "^..[drwxlts-]+ \\( *[0-9]+\\( [^ ]+ +\\([^ ]+ +\\)?[0-9]+\\)?\\) " |
2194 (line-end-position) t) | 2194 (line-end-position) t) |
2195 (replace-match (substring (concat vc-info " ") 0 10) | 2195 (replace-match (substring (concat vc-info " ") 0 10) |
2512 ;;;###autoload | 2512 ;;;###autoload |
2513 (defun vc-update () | 2513 (defun vc-update () |
2514 "Update the current buffer's file to the latest version on its branch. | 2514 "Update the current buffer's file to the latest version on its branch. |
2515 If the file contains no changes, and is not locked, then this simply replaces | 2515 If the file contains no changes, and is not locked, then this simply replaces |
2516 the working file with the latest version on its branch. If the file contains | 2516 the working file with the latest version on its branch. If the file contains |
2517 changes, and the backend supports merging news, then any recent changes from | 2517 changes, and the backend supports merging news, then any recent changes from |
2518 the current branch are merged into the working file." | 2518 the current branch are merged into the working file." |
2519 (interactive) | 2519 (interactive) |
2520 (vc-ensure-vc-buffer) | 2520 (vc-ensure-vc-buffer) |
2521 (vc-buffer-sync nil) | 2521 (vc-buffer-sync nil) |
2522 (let ((file buffer-file-name)) | 2522 (let ((file buffer-file-name)) |
2523 (if (vc-up-to-date-p file) | 2523 (if (vc-up-to-date-p file) |
2524 (vc-checkout file nil "") | 2524 (vc-checkout file nil "") |
2525 (if (eq (vc-checkout-model file) 'locking) | 2525 (if (eq (vc-checkout-model file) 'locking) |
2526 (if (eq (vc-state file) 'edited) | 2526 (if (eq (vc-state file) 'edited) |
2527 (error | 2527 (error |
2528 (substitute-command-keys | 2528 (substitute-command-keys |
2529 "File is locked--type \\[vc-revert-buffer] to discard changes")) | 2529 "File is locked--type \\[vc-revert-buffer] to discard changes")) |
2530 (error | 2530 (error |
2531 (substitute-command-keys | 2531 (substitute-command-keys |
2532 "Unexpected file state (%s)--type \\[vc-next-action] to correct") | 2532 "Unexpected file state (%s)--type \\[vc-next-action] to correct") |
2533 (vc-state file))) | 2533 (vc-state file))) |
2534 (if (not (vc-find-backend-function (vc-backend file) 'merge-news)) | 2534 (if (not (vc-find-backend-function (vc-backend file) 'merge-news)) |
2535 (error "Sorry, merging news is not implemented for %s" | 2535 (error "Sorry, merging news is not implemented for %s" |
2536 (vc-backend file)) | 2536 (vc-backend file)) |
2537 (vc-call merge-news file) | 2537 (vc-call merge-news file) |
2538 (vc-resynch-window file t t)))))) | 2538 (vc-resynch-window file t t)))))) |
2539 | 2539 |
2540 (defun vc-version-backup-file (file &optional rev) | 2540 (defun vc-version-backup-file (file &optional rev) |