aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorEric S. Raymond2008-05-15 17:38:50 +0000
committerEric S. Raymond2008-05-15 17:38:50 +0000
commit370fded4f6cc9c10c776733a1944b1faab84e2bd (patch)
treed17c372c68ede44cfe53e0f8ff073756ded603bd /lisp
parente6d897b38e5b3286162a6f486dc221251dcbf9ba (diff)
downloademacs-370fded4f6cc9c10c776733a1944b1faab84e2bd.tar.gz
emacs-370fded4f6cc9c10c776733a1944b1faab84e2bd.zip
Snapshot primitives globally renamed to refer to tags, documentation updated.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/vc-cvs.el10
-rw-r--r--lisp/vc-git.el69
-rw-r--r--lisp/vc-hg.el7
-rw-r--r--lisp/vc-hooks.el16
-rw-r--r--lisp/vc-mcvs.el12
-rw-r--r--lisp/vc-rcs.el15
-rw-r--r--lisp/vc-sccs.el20
-rw-r--r--lisp/vc-svn.el12
-rw-r--r--lisp/vc.el78
10 files changed, 123 insertions, 121 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 96f0d611113..6504f1cfdbf 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
12008-05-15 Eric S. Raymond <esr@snark.thyrsus.com> 12008-05-15 Eric S. Raymond <esr@snark.thyrsus.com>
2 2
3 * vc-cvs.el, vc-git.el, vc-hg.el, vc-hooks.el, vc-mcvs.el,
4 vc-rcs.el, vc-sccs.el, vc-svn.el, vc.el: Rename
5 vc-*-create-snapshot and vc-*-retrieve-snapshot to vc-*-create-tag
6 and vc-*-retireve-tag respectively.
7
3 * vc-dispatcher.el: Fix an incorrect buffer name and remove an 8 * vc-dispatcher.el: Fix an incorrect buffer name and remove an
4 unneeded defalias. 9 unneeded defalias.
5 10
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el
index 41372debcf0..90a6b7b2e1f 100644
--- a/lisp/vc-cvs.el
+++ b/lisp/vc-cvs.el
@@ -622,19 +622,19 @@ systime, or nil if there is none."
622 nil))) 622 nil)))
623 623
624;;; 624;;;
625;;; Snapshot system 625;;; Tag system
626;;; 626;;;
627 627
628(defun vc-cvs-create-snapshot (dir name branchp) 628(defun vc-cvs-create-tag (dir name branchp)
629 "Assign to DIR's current revision a given NAME. 629 "Assign to DIR's current revision a given NAME.
630If BRANCHP is non-nil, the name is created as a branch (and the current 630If BRANCHP is non-nil, the name is created as a branch (and the current
631workspace is immediately moved to that new branch)." 631workspace is immediately moved to that new branch)."
632 (vc-cvs-command nil 0 dir "tag" "-c" (if branchp "-b") name) 632 (vc-cvs-command nil 0 dir "tag" "-c" (if branchp "-b") name)
633 (when branchp (vc-cvs-command nil 0 dir "update" "-r" name))) 633 (when branchp (vc-cvs-command nil 0 dir "update" "-r" name)))
634 634
635(defun vc-cvs-retrieve-snapshot (dir name update) 635(defun vc-cvs-retrieve-tag (dir name update)
636 "Retrieve a snapshot at and below DIR. 636 "Retrieve a tag at and below DIR.
637NAME is the name of the snapshot; if it is empty, do a `cvs update'. 637NAME is the name of the tag; if it is empty, do a `cvs update'.
638If UPDATE is non-nil, then update (resynch) any affected buffers." 638If UPDATE is non-nil, then update (resynch) any affected buffers."
639 (with-current-buffer (get-buffer-create "*vc*") 639 (with-current-buffer (get-buffer-create "*vc*")
640 (let ((default-directory dir) 640 (let ((default-directory dir)
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index b4704efc61e..4a5b7ab8403 100644
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -43,37 +43,39 @@
43;; beginning of vc.el. The current status is: 43;; beginning of vc.el. The current status is:
44;; ("??" means: "figure out what to do about it") 44;; ("??" means: "figure out what to do about it")
45;; 45;;
46;; FUNCTION NAME STATUS 46;; FUNCTION NAME STATUS
47;; BACKEND PROPERTIES 47;; BACKEND PROPERTIES
48;; * revision-granularity OK 48;; * revision-granularity OK
49;; STATE-QUERYING FUNCTIONS 49;; STATE-QUERYING FUNCTIONS
50;; * registered (file) OK 50;; * registered (file) OK
51;; * state (file) OK 51;; * state (file) OK
52;; - state-heuristic (file) NOT NEEDED 52;; - state-heuristic (file) NOT NEEDED
53;; * working-revision (file) OK 53;; * working-revision (file) OK
54;; - latest-on-branch-p (file) NOT NEEDED 54;; - latest-on-branch-p (file) NOT NEEDED
55;; * checkout-model (files) OK 55;; * checkout-model (files) OK
56;; - workfile-unchanged-p (file) OK 56;; - workfile-unchanged-p (file) OK
57;; - mode-line-string (file) OK 57;; - mode-line-string (file) OK
58;; - prettify-state-info (file) OK 58;; - prettify-state-info (file) OK
59;; STATE-CHANGING FUNCTIONS 59;; STATE-CHANGING FUNCTIONS
60;; * create-repo () OK 60;; * create-repo () OK
61;; * register (files &optional rev comment) OK 61;; * register (files &optional rev comment) OK
62;; - init-revision (file) NOT NEEDED 62;; - init-revision (file) NOT NEEDED
63;; - responsible-p (file) OK 63;; - responsible-p (file) OK
64;; - could-register (file) NOT NEEDED, DEFAULT IS GOOD 64;; - could-register (file) NOT NEEDED, DEFAULT IS GOOD
65;; - receive-file (file rev) NOT NEEDED 65;; - receive-file (file rev) NOT NEEDED
66;; - unregister (file) OK 66;; - unregister (file) OK
67;; * checkin (files rev comment) OK 67;; * checkin (files rev comment) OK
68;; * find-revision (file rev buffer) OK 68;; * find-revision (file rev buffer) OK
69;; * checkout (file &optional editable rev) OK 69;; * checkout (file &optional editable rev) OK
70;; * revert (file &optional contents-done) OK 70;; * revert (file &optional contents-done) OK
71;; - rollback (files) COULD BE SUPPORTED 71;; - rollback (files) COULD BE SUPPORTED
72;; - merge (file rev1 rev2) It would be possible to merge changes into 72;; - merge (file rev1 rev2) It would be possible to merge
73;; a single file, but when committing they 73;; changes into a single file, but when
74;; wouldn't be identified as a merge by git, 74;; committing they wouldn't
75;; so it's probably not a good idea. 75;; be identified as a merge
76;; - merge-news (file) see `merge' 76;; by git, so it's probably
77;; not a good idea.
78;; - merge-news (file) see `merge'
77;; - steal-lock (file &optional revision) NOT NEEDED 79;; - steal-lock (file &optional revision) NOT NEEDED
78;; HISTORY FUNCTIONS 80;; HISTORY FUNCTIONS
79;; * print-log (files &optional buffer) OK 81;; * print-log (files &optional buffer) OK
@@ -81,27 +83,26 @@
81;; - show-log-entry (revision) OK 83;; - show-log-entry (revision) OK
82;; - comment-history (file) ?? 84;; - comment-history (file) ??
83;; - update-changelog (files) COULD BE SUPPORTED 85;; - update-changelog (files) COULD BE SUPPORTED
84;; * diff (file &optional rev1 rev2 buffer) OK 86;; * diff (file &optional rev1 rev2 buffer) OK
85;; - revision-completion-table (files) OK 87;; - revision-completion-table (files) OK
86;; - annotate-command (file buf &optional rev) OK 88;; - annotate-command (file buf &optional rev) OK
87;; - annotate-time () OK 89;; - annotate-time () OK
88;; - annotate-current-time () NOT NEEDED 90;; - annotate-current-time () NOT NEEDED
89;; - annotate-extract-revision-at-line () OK 91;; - annotate-extract-revision-at-line () OK
90;; SNAPSHOT SYSTEM 92;; TAG SYSTEM
91;; - create-snapshot (dir name branchp) OK 93;; - create-tag (dir name branchp) OK
92;; - assign-name (file name) NOT NEEDED 94;; - retrieve-tag (dir name update) OK, needs to update buffers
93;; - retrieve-snapshot (dir name update) OK, needs to update buffers
94;; MISCELLANEOUS 95;; MISCELLANEOUS
95;; - make-version-backups-p (file) NOT NEEDED 96;; - make-version-backups-p (file) NOT NEEDED
96;; - repository-hostname (dirname) NOT NEEDED 97;; - repository-hostname (dirname) NOT NEEDED
97;; - previous-revision (file rev) OK 98;; - previous-revision (file rev) OK
98;; - next-revision (file rev) OK 99;; - next-revision (file rev) OK
99;; - check-headers () COULD BE SUPPORTED 100;; - check-headers () COULD BE SUPPORTED
100;; - clear-headers () NOT NEEDED 101;; - clear-headers () NOT NEEDED
101;; - delete-file (file) OK 102;; - delete-file (file) OK
102;; - rename-file (old new) OK 103;; - rename-file (old new) OK
103;; - find-file-hook () NOT NEEDED 104;; - find-file-hook () NOT NEEDED
104;; - find-file-not-found-hook () NOT NEEDED 105;; - find-file-not-found-hook () NOT NEEDED
105 106
106(eval-when-compile 107(eval-when-compile
107 (require 'cl) 108 (require 'cl)
@@ -554,16 +555,16 @@ or BRANCH^ (where \"^\" can be repeated)."
554 (and (looking-at "[0-9a-f^][0-9a-f]+") 555 (and (looking-at "[0-9a-f^][0-9a-f]+")
555 (buffer-substring-no-properties (match-beginning 0) (match-end 0))))) 556 (buffer-substring-no-properties (match-beginning 0) (match-end 0)))))
556 557
557;;; SNAPSHOT SYSTEM 558;;; TAG SYSTEM
558 559
559(defun vc-git-create-snapshot (dir name branchp) 560(defun vc-git-create-tag (dir name branchp)
560 (let ((default-directory dir)) 561 (let ((default-directory dir))
561 (and (vc-git-command nil 0 nil "update-index" "--refresh") 562 (and (vc-git-command nil 0 nil "update-index" "--refresh")
562 (if branchp 563 (if branchp
563 (vc-git-command nil 0 nil "checkout" "-b" name) 564 (vc-git-command nil 0 nil "checkout" "-b" name)
564 (vc-git-command nil 0 nil "tag" name))))) 565 (vc-git-command nil 0 nil "tag" name)))))
565 566
566(defun vc-git-retrieve-snapshot (dir name update) 567(defun vc-git-retrieve-tag (dir name update)
567 (let ((default-directory dir)) 568 (let ((default-directory dir))
568 (vc-git-command nil 0 nil "checkout" name) 569 (vc-git-command nil 0 nil "checkout" name)
569 ;; FIXME: update buffers if `update' is true 570 ;; FIXME: update buffers if `update' is true
diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el
index baa60589f9a..6b025c8cfa7 100644
--- a/lisp/vc-hg.el
+++ b/lisp/vc-hg.el
@@ -76,10 +76,9 @@
76;; - annotate-time () OK 76;; - annotate-time () OK
77;; - annotate-current-time () NOT NEEDED 77;; - annotate-current-time () NOT NEEDED
78;; - annotate-extract-revision-at-line () OK 78;; - annotate-extract-revision-at-line () OK
79;; SNAPSHOT SYSTEM 79;; TAG SYSTEM
80;; - create-snapshot (dir name branchp) NEEDED (probably branch?) 80;; - create-tag (dir name branchp) NEEDED
81;; - assign-name (file name) NOT NEEDED 81;; - retrieve-tag (dir name update) NEEDED
82;; - retrieve-snapshot (dir name update) ?? NEEDED??
83;; MISCELLANEOUS 82;; MISCELLANEOUS
84;; - make-version-backups-p (file) ?? 83;; - make-version-backups-p (file) ??
85;; - repository-hostname (dirname) ?? 84;; - repository-hostname (dirname) ??
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index ed44eba3498..738cf257562 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -981,8 +981,8 @@ Used in `find-file-not-found-functions'."
981 (define-key map "i" 'vc-register) 981 (define-key map "i" 'vc-register)
982 (define-key map "l" 'vc-print-log) 982 (define-key map "l" 'vc-print-log)
983 (define-key map "m" 'vc-merge) 983 (define-key map "m" 'vc-merge)
984 (define-key map "r" 'vc-retrieve-snapshot) 984 (define-key map "r" 'vc-retrieve-tag)
985 (define-key map "s" 'vc-create-snapshot) 985 (define-key map "s" 'vc-create-tag)
986 (define-key map "u" 'vc-revert) 986 (define-key map "u" 'vc-revert)
987 (define-key map "v" 'vc-next-action) 987 (define-key map "v" 'vc-next-action)
988 (define-key map "+" 'vc-update) 988 (define-key map "+" 'vc-update)
@@ -996,12 +996,12 @@ Used in `find-file-not-found-functions'."
996 (let ((map (make-sparse-keymap "Version Control"))) 996 (let ((map (make-sparse-keymap "Version Control")))
997 ;;(define-key map [show-files] 997 ;;(define-key map [show-files]
998 ;; '("Show Files under VC" . (vc-directory t))) 998 ;; '("Show Files under VC" . (vc-directory t)))
999 (define-key map [vc-retrieve-snapshot] 999 (define-key map [vc-retrieve-tag]
1000 '(menu-item "Retrieve Snapshot" vc-retrieve-snapshot 1000 '(menu-item "Retrieve Tag" vc-retrieve-tag
1001 :help "Retrieve snapshot")) 1001 :help "Retrieve tagged version or branch"))
1002 (define-key map [vc-create-snapshot] 1002 (define-key map [vc-create-tag]
1003 '(menu-item "Create Snapshot" vc-create-snapshot 1003 '(menu-item "Create Tag" vc-create-tag
1004 :help "Create Snapshot")) 1004 :help "Create version tag"))
1005 (define-key map [separator1] '("----")) 1005 (define-key map [separator1] '("----"))
1006 (define-key map [vc-annotate] 1006 (define-key map [vc-annotate]
1007 '(menu-item "Annotate" vc-annotate 1007 '(menu-item "Annotate" vc-annotate
diff --git a/lisp/vc-mcvs.el b/lisp/vc-mcvs.el
index dfe3bb1d1f9..32c7b99b41b 100644
--- a/lisp/vc-mcvs.el
+++ b/lisp/vc-mcvs.el
@@ -48,7 +48,7 @@
48 48
49;;; Bugs: 49;;; Bugs:
50 50
51;; - Retrieving snapshots doesn't filter `cvs update' output and thus 51;; - Retrieving tags doesn't filter `cvs update' output and thus
52;; parses bogus filenames. Don't know if it harms. 52;; parses bogus filenames. Don't know if it harms.
53 53
54;;; Code: 54;;; Code:
@@ -461,10 +461,10 @@ Optional arg REVISION is a revision to annotate from."
461(defalias 'vc-mcvs-annotate-time 'vc-cvs-annotate-time) 461(defalias 'vc-mcvs-annotate-time 'vc-cvs-annotate-time)
462 462
463;;; 463;;;
464;;; Snapshot system 464;;; Tag system
465;;; 465;;;
466 466
467(defun vc-mcvs-create-snapshot (dir name branchp) 467(defun vc-mcvs-create-tag (dir name branchp)
468 "Assign to DIR's current revision a given NAME. 468 "Assign to DIR's current revision a given NAME.
469If BRANCHP is non-nil, the name is created as a branch (and the current 469If BRANCHP is non-nil, the name is created as a branch (and the current
470workspace is immediately moved to that new branch)." 470workspace is immediately moved to that new branch)."
@@ -473,9 +473,9 @@ workspace is immediately moved to that new branch)."
473 (vc-mcvs-command nil 0 dir "branch" name) 473 (vc-mcvs-command nil 0 dir "branch" name)
474 (vc-mcvs-command nil 0 dir "switch" name))) 474 (vc-mcvs-command nil 0 dir "switch" name)))
475 475
476(defun vc-mcvs-retrieve-snapshot (dir name update) 476(defun vc-mcvs-retrieve-tag (dir name update)
477 "Retrieve a snapshot at and below DIR. 477 "Retrieve a tag at and below DIR.
478NAME is the name of the snapshot; if it is empty, do a `cvs update'. 478NAME is the name of the tag; if it is empty, do a `cvs update'.
479If UPDATE is non-nil, then update (resynch) any affected buffers." 479If UPDATE is non-nil, then update (resynch) any affected buffers."
480 (with-current-buffer (get-buffer-create "*vc*") 480 (with-current-buffer (get-buffer-create "*vc*")
481 (let ((default-directory dir) 481 (let ((default-directory dir)
diff --git a/lisp/vc-rcs.el b/lisp/vc-rcs.el
index 14a091c4a6f..bda6aec95c2 100644
--- a/lisp/vc-rcs.el
+++ b/lisp/vc-rcs.el
@@ -787,12 +787,19 @@ systime, or nil if there is none. Also, reposition point."
787 787
788 788
789;;; 789;;;
790;;; Snapshot system 790;;; Tag system
791;;; 791;;;
792 792
793(defun vc-rcs-assign-name (file name) 793(defun vc-rcs-create-tag (backend dir name branchp)
794 "Assign to FILE's latest version a given NAME." 794 (when branchp
795 (vc-do-command "*vc*" 0 "rcs" (vc-name file) (concat "-n" name ":"))) 795 (error "RCS backend %s does not support module branches."))
796 (let ((result (vc-tag-precondition dir)))
797 (if (stringp result)
798 (error "File %s is not up-to-date" result)
799 (vc-file-tree-walk
800 dir
801 (lambda (f)
802 (vc-do-command "*vc*" 0 "rcs" (vc-name f) (concat "-n" name ":")))))))
796 803
797 804
798;;; 805;;;
diff --git a/lisp/vc-sccs.el b/lisp/vc-sccs.el
index f8a98f52702..a5096da9643 100644
--- a/lisp/vc-sccs.el
+++ b/lisp/vc-sccs.el
@@ -352,12 +352,20 @@ revert all subfiles."
352 352
353 353
354;;; 354;;;
355;;; Snapshot system 355;;; Tag system. SCCS doesn't have tags, so we simulate them by maintaining
356;;; our own set of name-to-revision mappings.
356;;; 357;;;
357 358
358(defun vc-sccs-assign-name (file name) 359(defun vc-sccs-create-tag (backend dir name branchp)
359 "Assign to FILE's latest revision a given NAME." 360 (when branchp
360 (vc-sccs-add-triple name file (vc-working-revision file))) 361 (error "SCCS backend %s does not support module branches."))
362 (let ((result (vc-tag-precondition dir)))
363 (if (stringp result)
364 (error "File %s is not up-to-date" result)
365 (vc-file-tree-walk
366 dir
367 (lambda (f)
368 (vc-sccs-add-triple name f (vc-working-revision f)))))))
361 369
362 370
363;;; 371;;;
@@ -373,7 +381,7 @@ revert all subfiles."
373(defun vc-sccs-rename-file (old new) 381(defun vc-sccs-rename-file (old new)
374 ;; Move the master file (using vc-rcs-master-templates). 382 ;; Move the master file (using vc-rcs-master-templates).
375 (vc-rename-master (vc-name old) new vc-sccs-master-templates) 383 (vc-rename-master (vc-name old) new vc-sccs-master-templates)
376 ;; Update the snapshot file. 384 ;; Update the tag file.
377 (with-current-buffer 385 (with-current-buffer
378 (find-file-noselect 386 (find-file-noselect
379 (expand-file-name vc-sccs-name-assoc-file 387 (expand-file-name vc-sccs-name-assoc-file
@@ -446,7 +454,7 @@ The result is a list of the form ((REVISION . USER) (REVISION . USER) ...)."
446 (kill-buffer (current-buffer)))) 454 (kill-buffer (current-buffer))))
447 455
448(defun vc-sccs-lookup-triple (file name) 456(defun vc-sccs-lookup-triple (file name)
449 "Return the numeric revision corresponding to a named snapshot of FILE. 457 "Return the numeric revision corresponding to a named tag of FILE.
450If NAME is nil or a revision number string it's just passed through." 458If NAME is nil or a revision number string it's just passed through."
451 (if (or (null name) 459 (if (or (null name)
452 (let ((firstchar (aref name 0))) 460 (let ((firstchar (aref name 0)))
diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el
index 44f7e8eb44d..0b0828ac23d 100644
--- a/lisp/vc-svn.el
+++ b/lisp/vc-svn.el
@@ -465,20 +465,20 @@ or svn+ssh://."
465 (buffer-size (get-buffer buffer))))) 465 (buffer-size (get-buffer buffer)))))
466 466
467;;; 467;;;
468;;; Snapshot system 468;;; Tag system
469;;; 469;;;
470 470
471(defun vc-svn-create-snapshot (dir name branchp) 471(defun vc-svn-create-tag (dir name branchp)
472 "Assign to DIR's current revision a given NAME. 472 "Assign to DIR's current revision a given NAME.
473If BRANCHP is non-nil, the name is created as a branch (and the current 473If BRANCHP is non-nil, the name is created as a branch (and the current
474workspace is immediately moved to that new branch). 474workspace is immediately moved to that new branch).
475NAME is assumed to be a URL." 475NAME is assumed to be a URL."
476 (vc-svn-command nil 0 dir "copy" name) 476 (vc-svn-command nil 0 dir "copy" name)
477 (when branchp (vc-svn-retrieve-snapshot dir name nil))) 477 (when branchp (vc-svn-retrieve-tag dir name nil)))
478 478
479(defun vc-svn-retrieve-snapshot (dir name update) 479(defun vc-svn-retrieve-tag (dir name update)
480 "Retrieve a snapshot at and below DIR. 480 "Retrieve a tag at and below DIR.
481NAME is the name of the snapshot; if it is empty, do a `svn update'. 481NAME is the name of the tag; if it is empty, do a `svn update'.
482If UPDATE is non-nil, then update (resynch) any affected buffers. 482If UPDATE is non-nil, then update (resynch) any affected buffers.
483NAME is assumed to be a URL." 483NAME is assumed to be a URL."
484 (vc-svn-command nil 0 dir "switch" name) 484 (vc-svn-command nil 0 dir "switch" name)
diff --git a/lisp/vc.el b/lisp/vc.el
index 7f355a6c38a..57f8f092d0e 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -438,28 +438,23 @@
438;; corresponding to the current line, or nil if there is no revision 438;; corresponding to the current line, or nil if there is no revision
439;; corresponding to the current line. 439;; corresponding to the current line.
440;; 440;;
441;; SNAPSHOT SYSTEM 441;; TAG SYSTEM
442;; 442;;
443;; - create-snapshot (dir name branchp) 443;; - create-tag (dir name branchp)
444;; 444;;
445;; Take a snapshot of the current state of files under DIR and name it 445;; Attach the tag NAME to the state of the working copy. This
446;; NAME. This should make sure that files are up-to-date before 446;; should make sure that files are up-to-date before proceeding with
447;; proceeding with the action. DIR can also be a file and if BRANCHP 447;; the action. DIR can also be a file and if BRANCHP is specified,
448;; is specified, NAME should be created as a branch and DIR should be 448;; NAME should be created as a branch and DIR should be checked out
449;; checked out under this new branch. The default implementation does 449;; under this new branch. The default implementation does not
450;; not support branches but does a sanity check, a tree traversal and 450;; support branches but does a sanity check, a tree traversal and
451;; for each file calls `assign-name'. 451;; assigns the tag to each file.
452;; 452;;
453;; - assign-name (file name) 453;; - retrieve-tag (dir name update)
454;; 454;;
455;; Give name NAME to the working revision of FILE, assuming it is 455;; Retrieve the version tagged by NAME of all registered files at or below DIR.
456;; up-to-date. Only used by the default version of `create-snapshot'.
457;;
458;; - retrieve-snapshot (dir name update)
459;;
460;; Retrieve a named snapshot of all registered files at or below DIR.
461;; If UPDATE is non-nil, then update buffers of any files in the 456;; If UPDATE is non-nil, then update buffers of any files in the
462;; snapshot that are currently visited. The default implementation 457;; tag that are currently visited. The default implementation
463;; does a sanity check whether there aren't any uncommitted changes at 458;; does a sanity check whether there aren't any uncommitted changes at
464;; or below DIR, and then performs a tree walk, using the `checkout' 459;; or below DIR, and then performs a tree walk, using the `checkout'
465;; function to retrieve the corresponding revisions. 460;; function to retrieve the corresponding revisions.
@@ -570,8 +565,6 @@
570;; 565;;
571;;;; Improved branch and tag handling: 566;;;; Improved branch and tag handling:
572;; 567;;
573;; - "snapshots" should be renamed to "tags", and thoroughly reworked.
574;;
575;; - add a generic mechanism for remembering the current branch names, 568;; - add a generic mechanism for remembering the current branch names,
576;; display the branch name in the mode-line. Replace 569;; display the branch name in the mode-line. Replace
577;; vc-cvs-sticky-tag with that. 570;; vc-cvs-sticky-tag with that.
@@ -580,7 +573,7 @@
580;; adapted accordingly. Also, it considers RCS and CVS to be the same, 573;; adapted accordingly. Also, it considers RCS and CVS to be the same,
581;; which is pretty confusing. 574;; which is pretty confusing.
582;; 575;;
583;; - vc-create-snapshot and vc-retrieve-snapshot should update the 576;; - vc-create-tag and vc-retrieve-tag should update the
584;; buffers that might be visiting the affected files. 577;; buffers that might be visiting the affected files.
585;; 578;;
586;;;; Default Behavior: 579;;;; Default Behavior:
@@ -2047,10 +2040,10 @@ outside of VC) and one wants to do some operation on it."
2047 2040
2048;; Named-configuration entry points 2041;; Named-configuration entry points
2049 2042
2050(defun vc-snapshot-precondition (dir) 2043(defun vc-tag-precondition (dir)
2051 "Scan the tree below DIR, looking for files not up-to-date. 2044 "Scan the tree below DIR, looking for files not up-to-date.
2052If any file is not up-to-date, return the name of the first such file. 2045If any file is not up-to-date, return the name of the first such file.
2053\(This means, neither snapshot creation nor retrieval is allowed.\) 2046\(This means, neither tag creation nor retrieval is allowed.\)
2054If one or more of the files are currently visited, return `visited'. 2047If one or more of the files are currently visited, return `visited'.
2055Otherwise, return nil." 2048Otherwise, return nil."
2056 (let ((status nil)) 2049 (let ((status nil))
@@ -2063,40 +2056,40 @@ Otherwise, return nil."
2063 status))) 2056 status)))
2064 2057
2065;;;###autoload 2058;;;###autoload
2066(defun vc-create-snapshot (dir name branchp) 2059(defun vc-create-tag (dir name branchp)
2067 "Descending recursively from DIR, make a snapshot called NAME. 2060 "Descending recursively from DIR, make a tag called NAME.
2068For each registered file, the working revision becomes part of 2061For each registered file, the working revision becomes part of
2069the named configuration. If the prefix argument BRANCHP is 2062the named configuration. If the prefix argument BRANCHP is
2070given, the snapshot is made as a new branch and the files are 2063given, the tag is made as a new branch and the files are
2071checked out in that new branch." 2064checked out in that new branch."
2072 (interactive 2065 (interactive
2073 (list (read-file-name "Directory: " default-directory default-directory t) 2066 (list (read-file-name "Directory: " default-directory default-directory t)
2074 (read-string "New snapshot name: ") 2067 (read-string "New tag name: ")
2075 current-prefix-arg)) 2068 current-prefix-arg))
2076 (message "Making %s... " (if branchp "branch" "snapshot")) 2069 (message "Making %s... " (if branchp "branch" "tag"))
2077 (when (file-directory-p dir) (setq dir (file-name-as-directory dir))) 2070 (when (file-directory-p dir) (setq dir (file-name-as-directory dir)))
2078 (vc-call-backend (vc-responsible-backend dir) 2071 (vc-call-backend (vc-responsible-backend dir)
2079 'create-snapshot dir name branchp) 2072 'create-tag dir name branchp)
2080 (message "Making %s... done" (if branchp "branch" "snapshot"))) 2073 (message "Making %s... done" (if branchp "branch" "tag")))
2081 2074
2082;;;###autoload 2075;;;###autoload
2083(defun vc-retrieve-snapshot (dir name) 2076(defun vc-retrieve-tag (dir name)
2084 "Descending recursively from DIR, retrieve the snapshot called NAME. 2077 "Descending recursively from DIR, retrieve the tag called NAME.
2085If NAME is empty, it refers to the latest revisions. 2078If NAME is empty, it refers to the latest revisions.
2086If locking is used for the files in DIR, then there must not be any 2079If locking is used for the files in DIR, then there must not be any
2087locked files at or below DIR (but if NAME is empty, locked files are 2080locked files at or below DIR (but if NAME is empty, locked files are
2088allowed and simply skipped)." 2081allowed and simply skipped)."
2089 (interactive 2082 (interactive
2090 (list (read-file-name "Directory: " default-directory default-directory t) 2083 (list (read-file-name "Directory: " default-directory default-directory t)
2091 (read-string "Snapshot name to retrieve (default latest revisions): "))) 2084 (read-string "Tag name to retrieve (default latest revisions): ")))
2092 (let ((update (yes-or-no-p "Update any affected buffers? ")) 2085 (let ((update (yes-or-no-p "Update any affected buffers? "))
2093 (msg (if (or (not name) (string= name "")) 2086 (msg (if (or (not name) (string= name ""))
2094 (format "Updating %s... " (abbreviate-file-name dir)) 2087 (format "Updating %s... " (abbreviate-file-name dir))
2095 (format "Retrieving snapshot into %s... " 2088 (format "Retrieving tag into %s... "
2096 (abbreviate-file-name dir))))) 2089 (abbreviate-file-name dir)))))
2097 (message "%s" msg) 2090 (message "%s" msg)
2098 (vc-call-backend (vc-responsible-backend dir) 2091 (vc-call-backend (vc-responsible-backend dir)
2099 'retrieve-snapshot dir name update) 2092 'retrieve-tag dir name update)
2100 (message "%s" (concat msg "done")))) 2093 (message "%s" (concat msg "done"))))
2101 2094
2102;; Miscellaneous other entry points 2095;; Miscellaneous other entry points
@@ -2693,18 +2686,7 @@ to provide the `find-revision' operation instead."
2693 "Let BACKEND receive FILE from another version control system." 2686 "Let BACKEND receive FILE from another version control system."
2694 (vc-call-backend backend 'register file rev "")) 2687 (vc-call-backend backend 'register file rev ""))
2695 2688
2696(defun vc-default-create-snapshot (backend dir name branchp) 2689(defun vc-default-retrieve-tag (backend dir name update)
2697 (when branchp
2698 (error "VC backend %s does not support module branches" backend))
2699 (let ((result (vc-snapshot-precondition dir)))
2700 (if (stringp result)
2701 (error "File %s is not up-to-date" result)
2702 (vc-file-tree-walk
2703 dir
2704 (lambda (f)
2705 (vc-call-backend backend 'assign-name f name))))))
2706
2707(defun vc-default-retrieve-snapshot (backend dir name update)
2708 (if (string= name "") 2690 (if (string= name "")
2709 (progn 2691 (progn
2710 (vc-file-tree-walk 2692 (vc-file-tree-walk
@@ -2714,7 +2696,7 @@ to provide the `find-revision' operation instead."
2714 (vc-error-occurred 2696 (vc-error-occurred
2715 (vc-call-backend backend 'checkout f nil "") 2697 (vc-call-backend backend 'checkout f nil "")
2716 (when update (vc-resynch-buffer f t t))))))) 2698 (when update (vc-resynch-buffer f t t)))))))
2717 (let ((result (vc-snapshot-precondition dir))) 2699 (let ((result (vc-tag-precondition dir)))
2718 (if (stringp result) 2700 (if (stringp result)
2719 (error "File %s is locked" result) 2701 (error "File %s is locked" result)
2720 (setq update (and (eq result 'visited) update)) 2702 (setq update (and (eq result 'visited) update))
@@ -3290,7 +3272,7 @@ Invoke FUNC f ARGS on each VC-managed file f underneath it."
3290;; The performance problem, it turns out, simplifies in practice to the 3272;; The performance problem, it turns out, simplifies in practice to the
3291;; problem of making vc-state fast. The two other functions that call 3273;; problem of making vc-state fast. The two other functions that call
3292;; prs/rlog will not be so commonly used that the slowdown is a problem; one 3274;; prs/rlog will not be so commonly used that the slowdown is a problem; one
3293;; makes snapshots, the other deletes the calling user's last change in the 3275;; makes tags, the other deletes the calling user's last change in the
3294;; master. 3276;; master.
3295;; 3277;;
3296;; The race condition implies that we have to either (a) lock the master 3278;; The race condition implies that we have to either (a) lock the master