aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2008-01-18 14:12:44 +0000
committerDan Nicolaescu2008-01-18 14:12:44 +0000
commite166638d11e7acb0e79523f984a111111fb71992 (patch)
treeca187806e99fdbabe11c6c63e97f23f6f233d368
parenta11ded73f4fa2d41ae0bc909f3fd5d5368964afc (diff)
downloademacs-e166638d11e7acb0e79523f984a111111fb71992.tar.gz
emacs-e166638d11e7acb0e79523f984a111111fb71992.zip
Add a TODO note about vc-state.
(vc-next-action): Register 'unregistered and 'ignored files. Use when and unless instead of if where appropriate. (vc-start-entry): Fix typo. (vc-status): Autoload it.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/vc.el70
2 files changed, 46 insertions, 34 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9c95f77c428..36d57f9caa0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12008-01-18 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * vc.el: Add a TODO note about vc-state.
4 (vc-next-action): Register 'unregistered and 'ignored files. Use
5 when and unless instead of if where appropriate.
6 (vc-start-entry): Fix typo.
7 (vc-status): Autoload it.
8
12008-01-18 Glenn Morris <rgm@gnu.org> 92008-01-18 Glenn Morris <rgm@gnu.org>
2 10
3 * ffap.el (ffap-alist): Remove space from RFC regexp. 11 * ffap.el (ffap-alist): Remove space from RFC regexp.
@@ -12,7 +20,7 @@
12 * ibuffer.el (ibuffer-mode): Fix typo in previous change. 20 * ibuffer.el (ibuffer-mode): Fix typo in previous change.
13 21
142008-01-17 Vinicius Jose Latorre <viniciusjl@ig.com.br> 222008-01-17 Vinicius Jose Latorre <viniciusjl@ig.com.br>
152008-01-17 Miles Bader <miles@gnu.org> 23 Miles Bader <miles@gnu.org>
16 24
17 * blank-mode.el: New file. Minor mode to visualise (HARD) SPACE, 25 * blank-mode.el: New file. Minor mode to visualise (HARD) SPACE,
18 TAB, NEWLINE. Miles Bader <miles@gnu.org> wrote the original code 26 TAB, NEWLINE. Miles Bader <miles@gnu.org> wrote the original code
diff --git a/lisp/vc.el b/lisp/vc.el
index ac83365613b..bb05625f577 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -537,6 +537,9 @@
537;; - make it easier to write logs, maybe C-x 4 a should add to the log 537;; - make it easier to write logs, maybe C-x 4 a should add to the log
538;; buffer if there's one instead of the ChangeLog. 538;; buffer if there's one instead of the ChangeLog.
539;; 539;;
540;; - make vc-state for all backends return 'unregistered instead of
541;; nil for unregistered files, then update vc-next-action.
542;;
540;; - deal with push/pull operations. 543;; - deal with push/pull operations.
541;; 544;;
542;; - decide if vc-status should replace vc-dired. 545;; - decide if vc-status should replace vc-dired.
@@ -1434,9 +1437,9 @@ merge in the changes into your working copy."
1434 revision) 1437 revision)
1435 ;; Verify that the fileset is homogenous 1438 ;; Verify that the fileset is homogenous
1436 (dolist (file (cdr files)) 1439 (dolist (file (cdr files))
1437 (if (not (vc-compatible-state (vc-state file) state)) 1440 (unless (vc-compatible-state (vc-state file) state)
1438 (error "Fileset is in a mixed-up state")) 1441 (error "Fileset is in a mixed-up state"))
1439 (if (not (eq (vc-checkout-model file) model)) 1442 (unless (eq (vc-checkout-model file) model)
1440 (error "Fileset has mixed checkout models"))) 1443 (error "Fileset has mixed checkout models")))
1441 ;; Check for buffers in the fileset not matching the on-disk contents. 1444 ;; Check for buffers in the fileset not matching the on-disk contents.
1442 (dolist (file files) 1445 (dolist (file files)
@@ -1458,13 +1461,15 @@ merge in the changes into your working copy."
1458 (error "Aborted")) 1461 (error "Aborted"))
1459 ;; Now, check if we have unsaved changes. 1462 ;; Now, check if we have unsaved changes.
1460 (vc-buffer-sync t) 1463 (vc-buffer-sync t)
1461 (if (buffer-modified-p) 1464 (when (buffer-modified-p)
1462 (or (y-or-n-p (message "Use %s on disk, keeping modified buffer? " file)) 1465 (or (y-or-n-p (message "Use %s on disk, keeping modified buffer? " file))
1463 (error "Aborted"))))))) 1466 (error "Aborted")))))))
1464 ;; Do the right thing 1467 ;; Do the right thing
1465 (cond 1468 (cond
1466 ;; Files aren't registered 1469 ;; Files aren't registered
1467 ((not state) 1470 ((or (not state) ;; RCS uses nil for unregistered files.
1471 (eq state 'unregistered)
1472 (eq state 'ignored))
1468 (mapc 'vc-register files)) 1473 (mapc 'vc-register files))
1469 ;; Files are up-to-date, or need a merge and user specified a revision 1474 ;; Files are up-to-date, or need a merge and user specified a revision
1470 ((or (eq state 'up-to-date) (and verbose (eq state 'needs-patch))) 1475 ((or (eq state 'up-to-date) (and verbose (eq state 'needs-patch)))
@@ -1488,32 +1493,30 @@ merge in the changes into your working copy."
1488 (let ((ready-for-commit files)) 1493 (let ((ready-for-commit files))
1489 ;; If files are edited but read-only, give user a chance to correct 1494 ;; If files are edited but read-only, give user a chance to correct
1490 (dolist (file files) 1495 (dolist (file files)
1491 (if (not (file-writable-p file)) 1496 (unless (file-writable-p file)
1492 (progn 1497 ;; Make the file+buffer read-write.
1493 ;; Make the file+buffer read-write. 1498 (unless (y-or-n-p (format "%s is edited but read-only; make it writable and continue?" file))
1494 (unless (y-or-n-p (format "%s is edited but read-only; make it writable and continue?" file)) 1499 (error "Aborted"))
1495 (error "Aborted")) 1500 (set-file-modes file (logior (file-modes file) 128))
1496 (set-file-modes file (logior (file-modes file) 128)) 1501 (let ((visited (get-file-buffer file)))
1497 (let ((visited (get-file-buffer file))) 1502 (when visited
1498 (if visited 1503 (with-current-buffer visited
1499 (with-current-buffer visited 1504 (toggle-read-only -1))))))
1500 (toggle-read-only -1)))))))
1501 ;; Allow user to revert files with no changes 1505 ;; Allow user to revert files with no changes
1502 (save-excursion 1506 (save-excursion
1503 (dolist (file files) 1507 (dolist (file files)
1504 (let ((visited (get-file-buffer file))) 1508 (let ((visited (get-file-buffer file)))
1505 ;; For files with locking, if the file does not contain 1509 ;; For files with locking, if the file does not contain
1506 ;; any changes, just let go of the lock, i.e. revert. 1510 ;; any changes, just let go of the lock, i.e. revert.
1507 (if (and (not (eq model 'implicit)) 1511 (when (and (not (eq model 'implicit))
1508 (vc-workfile-unchanged-p file) 1512 (vc-workfile-unchanged-p file)
1509 ;; If buffer is modified, that means the user just 1513 ;; If buffer is modified, that means the user just
1510 ;; said no to saving it; in that case, don't revert, 1514 ;; said no to saving it; in that case, don't revert,
1511 ;; because the user might intend to save after 1515 ;; because the user might intend to save after
1512 ;; finishing the log entry and committing. 1516 ;; finishing the log entry and committing.
1513 (not (and visited (buffer-modified-p)))) 1517 (not (and visited (buffer-modified-p))))
1514 (progn 1518 (vc-revert-file file)
1515 (vc-revert-file file) 1519 (delete file ready-for-commit)))))
1516 (delete file ready-for-commit))))))
1517 ;; Remaining files need to be committed 1520 ;; Remaining files need to be committed
1518 (if (not ready-for-commit) 1521 (if (not ready-for-commit)
1519 (message "No files remain to be committed") 1522 (message "No files remain to be committed")
@@ -1539,16 +1542,16 @@ merge in the changes into your working copy."
1539 "%s is not up-to-date. Get latest revision? " 1542 "%s is not up-to-date. Get latest revision? "
1540 (file-name-nondirectory file))) 1543 (file-name-nondirectory file)))
1541 (vc-checkout file (eq model 'implicit) t) 1544 (vc-checkout file (eq model 'implicit) t)
1542 (if (and (not (eq model 'implicit)) 1545 (when (and (not (eq model 'implicit))
1543 (yes-or-no-p "Lock this revision? ")) 1546 (yes-or-no-p "Lock this revision? "))
1544 (vc-checkout file t))))) 1547 (vc-checkout file t)))))
1545 ;; needs-merge 1548 ;; needs-merge
1546 ((eq state 'needs-merge) 1549 ((eq state 'needs-merge)
1547 (dolist (file files) 1550 (dolist (file files)
1548 (if (yes-or-no-p (format 1551 (when (yes-or-no-p (format
1549 "%s is not up-to-date. Merge in changes now? " 1552 "%s is not up-to-date. Merge in changes now? "
1550 (file-name-nondirectory file))) 1553 (file-name-nondirectory file)))
1551 (vc-maybe-resolve-conflicts file (vc-call merge-news file))))) 1554 (vc-maybe-resolve-conflicts file (vc-call merge-news file)))))
1552 1555
1553 ;; unlocked-changes 1556 ;; unlocked-changes
1554 ((eq state 'unlocked-changes) 1557 ((eq state 'unlocked-changes)
@@ -1697,7 +1700,7 @@ INITIAL-CONTENTS is nil, do action immediately as if the user had
1697entered COMMENT. If COMMENT is t, also do action immediately with an 1700entered COMMENT. If COMMENT is t, also do action immediately with an
1698empty comment. Remember the file's buffer in `vc-parent-buffer' 1701empty comment. Remember the file's buffer in `vc-parent-buffer'
1699\(current one if no file). AFTER-HOOK specifies the local value 1702\(current one if no file). AFTER-HOOK specifies the local value
1700for vc-log-operation-hook." 1703for `vc-log-after-operation-hook'."
1701 (let ((parent 1704 (let ((parent
1702 (if (eq major-mode 'vc-dired-mode) 1705 (if (eq major-mode 'vc-dired-mode)
1703 ;; If we are called from VC dired, the parent buffer is 1706 ;; If we are called from VC dired, the parent buffer is
@@ -2562,6 +2565,7 @@ With prefix arg READ-SWITCHES, specify a value to override
2562 ;; Must be in sync with vc-status-printer. 2565 ;; Must be in sync with vc-status-printer.
2563 (forward-char 25)) 2566 (forward-char 25))
2564 2567
2568;;;###autoload
2565(defun vc-status (dir) 2569(defun vc-status (dir)
2566 "Show the VC status for DIR." 2570 "Show the VC status for DIR."
2567 (interactive "DVC status for directory: ") 2571 (interactive "DVC status for directory: ")