Snapshot primitives globally renamed to refer to tags, documentation updated.
This commit is contained in:
parent
e6d897b38e
commit
370fded4f6
15 changed files with 199 additions and 195 deletions
|
@ -1,3 +1,10 @@
|
|||
2008-05-15 Eric S. Raymond <esr@snark.thyrsus.com>
|
||||
|
||||
* vc2-xtra.texi, emacs.texi, files.texi: Snapshots node renamed to
|
||||
Revision Tags and rewritten. Section now uses modern terminology
|
||||
(tags rather than snapshots) and describes post-SCCS systems more
|
||||
accurately.
|
||||
|
||||
2008-05-10 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* msdog.texi (Windows Files): Update documentation of
|
||||
|
|
|
@ -119,7 +119,7 @@ and to avoid conflicts.
|
|||
Completion
|
||||
Backup Files
|
||||
Auto-Saving: Protection Against Disasters
|
||||
Snapshots
|
||||
Tags
|
||||
Text Mode
|
||||
Outline Mode
|
||||
@TeX{} Mode
|
||||
|
@ -462,7 +462,7 @@ Version Control
|
|||
* Secondary VC Commands:: The commands used a little less frequently.
|
||||
* Branches:: Multiple lines of development.
|
||||
* Remote Repositories:: Efficient access to remote CVS servers.
|
||||
* Snapshots:: Sets of file versions treated as a unit.
|
||||
* Revision Tags:: Symbolic names for revisions
|
||||
* Miscellaneous VC:: Various other commands and features of VC.
|
||||
* Customizing VC:: Variables that change VC's behavior.
|
||||
|
||||
|
|
|
@ -1238,7 +1238,7 @@ customizable variable @code{vc-handled-backends} to @code{nil}
|
|||
* Branches:: Multiple lines of development.
|
||||
@ifnottex
|
||||
* Remote Repositories:: Efficient access to remote CVS servers.
|
||||
* Snapshots:: Sets of file versions treated as a unit.
|
||||
* Revision Tags:: Symbolic names for revisions
|
||||
* Miscellaneous VC:: Various other commands and features of VC.
|
||||
* Customizing VC:: Variables that change VC's behavior.
|
||||
@end ifnottex
|
||||
|
@ -1300,8 +1300,8 @@ git, and Mercurial.
|
|||
SCCS was the first version-control system ever built, and was long ago
|
||||
superseded by later and more advanced ones; Emacs supports it only for
|
||||
backward compatibility and historical reasons. VC compensates for
|
||||
certain features missing in SCCS (snapshots, for example) by
|
||||
implementing them itself, but some other VC features, such as multiple
|
||||
certain features missing in SCCS (tag names for releases, for example) by
|
||||
implementing them itself. Some other VC features, such as multiple
|
||||
branches, are not available with SCCS. Since SCCS is non-free you
|
||||
should not use it; use its free replacement CSSC instead. But you
|
||||
should use CSSC only if for some reason you cannot use a more
|
||||
|
@ -1895,19 +1895,19 @@ buffer in another window.
|
|||
|
||||
You can specify a checked-in revision by its ID; an empty input
|
||||
specifies the current contents of the work file (which may be different
|
||||
from all the checked-in revisions). You can also specify a snapshot name
|
||||
from all the checked-in revisions). You can also specify a tag or branch name
|
||||
@iftex
|
||||
(@pxref{Snapshots,,,emacs-xtra, Specialized Emacs Features})
|
||||
(@pxref{Tags,,,emacs-xtra, Specialized Emacs Features})
|
||||
@end iftex
|
||||
@ifnottex
|
||||
(@pxref{Snapshots})
|
||||
(@pxref{Tags})
|
||||
@end ifnottex
|
||||
instead of one or both revision ID.
|
||||
|
||||
Note that if your version-control system is file-oriented (SCCS,
|
||||
RCS, CVS) rather than fileset-oriented (Subversion, GNU Arch, git,
|
||||
Mercurial) specifying a revision of a multiple-file fileset by
|
||||
revision ID (as opposed to a snapshot name or RSCCS/RCS tag) is
|
||||
revision ID (as opposed to a symbolic tag name) is
|
||||
unlikely to return diffs that are connected in any meaningful way.
|
||||
|
||||
If you invoke @kbd{C-u C-x v =} or @kbd{C-u C-x v =} from a buffer
|
||||
|
|
|
@ -14,9 +14,9 @@ the Emacs Manual}). This chapter describes more advanced VC usage.
|
|||
|
||||
@menu
|
||||
* VC Directory Mode:: Listing files managed by version control.
|
||||
* VC Directory Commands:: Commands to use in a VC Dired buffer.
|
||||
* VC Directory Commands:: Commands to use in a VC Dired buffer.
|
||||
* Remote Repositories:: Efficient access to remote VCS servers.
|
||||
* Snapshots:: Sets of file versions treated as a unit.
|
||||
* Revision Tags:: Symbolic names for revisions
|
||||
* Miscellaneous VC:: Various other commands and features of VC.
|
||||
* Customizing VC:: Variables that change VC's behavior.
|
||||
@end menu
|
||||
|
|
|
@ -204,51 +204,57 @@ and what is not. So we suggest that you return from time to time to
|
|||
CVS-only operation, by committing your local changes back to the
|
||||
repository using @kbd{C-u C-x v v cvs @key{RET}}.
|
||||
|
||||
@node Snapshots
|
||||
@subsection Snapshots
|
||||
@cindex snapshots and version control
|
||||
@node Revision Tags
|
||||
@subsection Revision Tags
|
||||
@cindex tags and version control
|
||||
|
||||
A @dfn{snapshot} is a named set of file versions (one for each
|
||||
registered file) that you can treat as a unit. One important kind of
|
||||
snapshot is a @dfn{release}, a (theoretically) stable version of the
|
||||
system that is ready for distribution to users.
|
||||
In a VCS with per-file revision numbers (such as SCCS, RCS, or CVS)
|
||||
@dfn{tag} is a named set of file versions (one for each registered
|
||||
file) that you can treat as a unit. In a VCS with per-repository
|
||||
version numbers (Subversion and most later ones) a tag is simply
|
||||
a symbolic name for a revsion.
|
||||
|
||||
One important kind of tag is a @dfn{release}, a (theoretically)
|
||||
stable version of the system that is ready for distribution to users.
|
||||
|
||||
@menu
|
||||
* Making Snapshots:: The snapshot facilities.
|
||||
* Snapshot Caveats:: Things to be careful of when using snapshots.
|
||||
* Making Revision Tags:: The tag facilities.
|
||||
* Revision Tag Caveats:: Things to be careful of when using tags.
|
||||
@end menu
|
||||
|
||||
@node Making Snapshots
|
||||
@subsubsection Making and Using Snapshots
|
||||
@node Making Revision Tags
|
||||
@subsubsection Making and Using Revision Tags
|
||||
|
||||
There are two basic commands for snapshots; one makes a
|
||||
snapshot with a given name, the other retrieves a named snapshot.
|
||||
There are two basic commands for tags; one makes a
|
||||
tag with a given name, the other retrieves a named tag.
|
||||
|
||||
@table @code
|
||||
@kindex C-x v s
|
||||
@findex vc-create-snapshot
|
||||
@findex vc-create-tag
|
||||
@item C-x v s @var{name} @key{RET}
|
||||
Define the last saved versions of every registered file in or under the
|
||||
current directory as a snapshot named @var{name}
|
||||
(@code{vc-create-snapshot}).
|
||||
Define the working revision of every registered file in or under the
|
||||
current directory as a tag named @var{name}
|
||||
(@code{vc-create-tag}).
|
||||
|
||||
@kindex C-x v r
|
||||
@findex vc-retrieve-snapshot
|
||||
@findex vc-retrieve-tag
|
||||
@item C-x v r @var{name} @key{RET}
|
||||
For all registered files at or below the current directory level, select
|
||||
whatever versions correspond to the snapshot @var{name}
|
||||
(@code{vc-retrieve-snapshot}).
|
||||
For all registered files at or below the current directory level,
|
||||
retrieve the tagged revision @var{name}. This command will
|
||||
switch to a branch if @var{name} is a branch name and your VCS
|
||||
distinguishes branches from tags.
|
||||
(@code{vc-retrieve-tag}).
|
||||
|
||||
This command reports an error if any files are locked at or below the
|
||||
current directory, without changing anything; this is to avoid
|
||||
overwriting work in progress.
|
||||
@end table
|
||||
|
||||
A snapshot uses a very small amount of resources---just enough to record
|
||||
the list of file names and which version belongs to the snapshot. Thus,
|
||||
you need not hesitate to create snapshots whenever they are useful.
|
||||
Tags are inexpensive, so you need not hesitate to create them whenever
|
||||
they are useful. Branches vary in cost depending on your VCS; in
|
||||
older ones they may be expensive.
|
||||
|
||||
You can give a snapshot name as an argument to @kbd{C-x v =} or
|
||||
You can give a tag or branch name as an argument to @kbd{C-x v =} or
|
||||
@kbd{C-x v ~}
|
||||
@iftex
|
||||
(@pxref{Old Revisions,,,emacs, the Emacs Manual}).
|
||||
|
@ -256,50 +262,40 @@ you need not hesitate to create snapshots whenever they are useful.
|
|||
@ifnottex
|
||||
(@pxref{Old Revisions}).
|
||||
@end ifnottex
|
||||
Thus, you can use it to compare a snapshot against the current files,
|
||||
or two snapshots against each other, or a snapshot against a named
|
||||
version.
|
||||
Thus, you can use it to compare a tagged version against the current files,
|
||||
or two tagged versions against each other.
|
||||
|
||||
@node Snapshot Caveats
|
||||
@subsubsection Snapshot Caveats
|
||||
@node Revision Tag Caveats
|
||||
@subsubsection Revision Tag Caveats
|
||||
|
||||
@cindex named configurations (RCS)
|
||||
VC's snapshot facilities are modeled on RCS's named-configuration
|
||||
support. They use RCS's native facilities for this, so
|
||||
snapshots made using RCS through VC are visible even when you bypass VC.
|
||||
For SCCS, VC implements tags itself; these tags are visible only
|
||||
through VC. Most later systems (including CVS, Subversion, bzr, git,
|
||||
and hg) have a native tag facility, and VC uses it where
|
||||
available; those tags will be visible even when you bypass VC.
|
||||
|
||||
With CVS, Meta-CVS, and Subversion, VC also uses the native
|
||||
mechanism provided by that back end to make snapshots and retrieve them
|
||||
(@dfn{tags} for CVS and Meta-CVS, @dfn{copies} for Subversion).
|
||||
There is no support for VC tags using GNU Arch yet.
|
||||
|
||||
@c worded verbosely to avoid overfull hbox.
|
||||
For SCCS, VC implements snapshots itself. The files it uses contain
|
||||
name/file/version-number triples. These snapshots are visible only
|
||||
through VC.
|
||||
Under older VCSes (SCCS, RCS, CVS, early versions of Subversion),
|
||||
renaming and deletion could create some difficulties with tags. This is
|
||||
not a VC-specific problem, but a general design issue in version
|
||||
control systems that was not solved effectively until the earliest
|
||||
third-generation systems.
|
||||
|
||||
There is no support for VC snapshots using GNU Arch yet.
|
||||
In a file-oriented VCS, when you rename a registered file you need
|
||||
to rename its master along with it; the command @code{vc-rename-file}
|
||||
will do this automatically. If you are using SCCS, you must also
|
||||
update the records of the tag, to mention the file by its new name
|
||||
(@code{vc-rename-file} does this, too). An old tag that refers to a
|
||||
master file that no longer exists under the recorded name is invalid;
|
||||
VC can no longer retrieve it. It would be beyond the scope of this
|
||||
manual to explain enough about RCS and SCCS to explain how to update
|
||||
the tags by hand.
|
||||
|
||||
A snapshot is a set of checked-in versions. So make sure that all the
|
||||
files are checked in and not locked when you make a snapshot.
|
||||
|
||||
File renaming and deletion can create some difficulties with snapshots.
|
||||
This is not a VC-specific problem, but a general design issue in version
|
||||
control systems that no one has solved very well yet.
|
||||
|
||||
If you rename a registered file, you need to rename its master along
|
||||
with it (the command @code{vc-rename-file} does this automatically). If
|
||||
you are using SCCS, you must also update the records of the snapshot, to
|
||||
mention the file by its new name (@code{vc-rename-file} does this,
|
||||
too). An old snapshot that refers to a master file that no longer
|
||||
exists under the recorded name is invalid; VC can no longer retrieve
|
||||
it. It would be beyond the scope of this manual to explain enough about
|
||||
RCS and SCCS to explain how to update the snapshots by hand.
|
||||
|
||||
Using @code{vc-rename-file} makes the snapshot remain valid for
|
||||
Using @code{vc-rename-file} makes the tag remain valid for
|
||||
retrieval, but it does not solve all problems. For example, some of the
|
||||
files in your program probably refer to others by name. At the very
|
||||
least, the makefile probably mentions the file that you renamed. If you
|
||||
retrieve an old snapshot, the renamed file is retrieved under its new
|
||||
retrieve an old tag, the renamed file is retrieved under its new
|
||||
name, which is not the name that the makefile expects. So the program
|
||||
won't really work as retrieved.
|
||||
|
||||
|
@ -473,10 +469,9 @@ to avoid putting such trivia into @file{ChangeLog}.
|
|||
When you rename a registered file, you must also rename its master
|
||||
file correspondingly to get proper results. Use @code{vc-rename-file}
|
||||
to rename the source file as you specify, and rename its master file
|
||||
accordingly. It also updates any snapshots (@pxref{Snapshots}) that
|
||||
accordingly. It also updates any tags (@pxref{Revision Tags}) that
|
||||
mention the file, so that they use the new name; despite this, the
|
||||
snapshot thus modified may not completely work (@pxref{Snapshot
|
||||
Caveats}).
|
||||
tag thus modified may not completely work (@pxref{Revision Tag Caveats}).
|
||||
|
||||
Some back ends do not provide an explicit rename operation to their
|
||||
repositories. After issuing @code{vc-rename-file}, use @kbd{C-x v v}
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
2008-05-15 Eric S. Raymond <esr@snark.thyrsus.com>
|
||||
|
||||
* vc-cvs.el, vc-git.el, vc-hg.el, vc-hooks.el, vc-mcvs.el,
|
||||
vc-rcs.el, vc-sccs.el, vc-svn.el, vc.el: Rename
|
||||
vc-*-create-snapshot and vc-*-retrieve-snapshot to vc-*-create-tag
|
||||
and vc-*-retireve-tag respectively.
|
||||
|
||||
* vc-dispatcher.el: Fix an incorrect buffer name and remove an
|
||||
unneeded defalias.
|
||||
|
||||
|
|
|
@ -622,19 +622,19 @@ systime, or nil if there is none."
|
|||
nil)))
|
||||
|
||||
;;;
|
||||
;;; Snapshot system
|
||||
;;; Tag system
|
||||
;;;
|
||||
|
||||
(defun vc-cvs-create-snapshot (dir name branchp)
|
||||
(defun vc-cvs-create-tag (dir name branchp)
|
||||
"Assign to DIR's current revision a given NAME.
|
||||
If BRANCHP is non-nil, the name is created as a branch (and the current
|
||||
workspace is immediately moved to that new branch)."
|
||||
(vc-cvs-command nil 0 dir "tag" "-c" (if branchp "-b") name)
|
||||
(when branchp (vc-cvs-command nil 0 dir "update" "-r" name)))
|
||||
|
||||
(defun vc-cvs-retrieve-snapshot (dir name update)
|
||||
"Retrieve a snapshot at and below DIR.
|
||||
NAME is the name of the snapshot; if it is empty, do a `cvs update'.
|
||||
(defun vc-cvs-retrieve-tag (dir name update)
|
||||
"Retrieve a tag at and below DIR.
|
||||
NAME is the name of the tag; if it is empty, do a `cvs update'.
|
||||
If UPDATE is non-nil, then update (resynch) any affected buffers."
|
||||
(with-current-buffer (get-buffer-create "*vc*")
|
||||
(let ((default-directory dir)
|
||||
|
|
|
@ -43,37 +43,39 @@
|
|||
;; beginning of vc.el. The current status is:
|
||||
;; ("??" means: "figure out what to do about it")
|
||||
;;
|
||||
;; FUNCTION NAME STATUS
|
||||
;; FUNCTION NAME STATUS
|
||||
;; BACKEND PROPERTIES
|
||||
;; * revision-granularity OK
|
||||
;; * revision-granularity OK
|
||||
;; STATE-QUERYING FUNCTIONS
|
||||
;; * registered (file) OK
|
||||
;; * registered (file) OK
|
||||
;; * state (file) OK
|
||||
;; - state-heuristic (file) NOT NEEDED
|
||||
;; * working-revision (file) OK
|
||||
;; - latest-on-branch-p (file) NOT NEEDED
|
||||
;; * checkout-model (files) OK
|
||||
;; * working-revision (file) OK
|
||||
;; - latest-on-branch-p (file) NOT NEEDED
|
||||
;; * checkout-model (files) OK
|
||||
;; - workfile-unchanged-p (file) OK
|
||||
;; - mode-line-string (file) OK
|
||||
;; - prettify-state-info (file) OK
|
||||
;; - prettify-state-info (file) OK
|
||||
;; STATE-CHANGING FUNCTIONS
|
||||
;; * create-repo () OK
|
||||
;; * register (files &optional rev comment) OK
|
||||
;; * create-repo () OK
|
||||
;; * register (files &optional rev comment) OK
|
||||
;; - init-revision (file) NOT NEEDED
|
||||
;; - responsible-p (file) OK
|
||||
;; - could-register (file) NOT NEEDED, DEFAULT IS GOOD
|
||||
;; - receive-file (file rev) NOT NEEDED
|
||||
;; - unregister (file) OK
|
||||
;; - unregister (file) OK
|
||||
;; * checkin (files rev comment) OK
|
||||
;; * find-revision (file rev buffer) OK
|
||||
;; * checkout (file &optional editable rev) OK
|
||||
;; * revert (file &optional contents-done) OK
|
||||
;; - rollback (files) COULD BE SUPPORTED
|
||||
;; - merge (file rev1 rev2) It would be possible to merge changes into
|
||||
;; a single file, but when committing they
|
||||
;; wouldn't be identified as a merge by git,
|
||||
;; so it's probably not a good idea.
|
||||
;; - merge-news (file) see `merge'
|
||||
;; - rollback (files) COULD BE SUPPORTED
|
||||
;; - merge (file rev1 rev2) It would be possible to merge
|
||||
;; changes into a single file, but when
|
||||
;; committing they wouldn't
|
||||
;; be identified as a merge
|
||||
;; by git, so it's probably
|
||||
;; not a good idea.
|
||||
;; - merge-news (file) see `merge'
|
||||
;; - steal-lock (file &optional revision) NOT NEEDED
|
||||
;; HISTORY FUNCTIONS
|
||||
;; * print-log (files &optional buffer) OK
|
||||
|
@ -81,27 +83,26 @@
|
|||
;; - show-log-entry (revision) OK
|
||||
;; - comment-history (file) ??
|
||||
;; - update-changelog (files) COULD BE SUPPORTED
|
||||
;; * diff (file &optional rev1 rev2 buffer) OK
|
||||
;; * diff (file &optional rev1 rev2 buffer) OK
|
||||
;; - revision-completion-table (files) OK
|
||||
;; - annotate-command (file buf &optional rev) OK
|
||||
;; - annotate-time () OK
|
||||
;; - annotate-current-time () NOT NEEDED
|
||||
;; - annotate-extract-revision-at-line () OK
|
||||
;; SNAPSHOT SYSTEM
|
||||
;; - create-snapshot (dir name branchp) OK
|
||||
;; - assign-name (file name) NOT NEEDED
|
||||
;; - retrieve-snapshot (dir name update) OK, needs to update buffers
|
||||
;; - annotate-extract-revision-at-line () OK
|
||||
;; TAG SYSTEM
|
||||
;; - create-tag (dir name branchp) OK
|
||||
;; - retrieve-tag (dir name update) OK, needs to update buffers
|
||||
;; MISCELLANEOUS
|
||||
;; - make-version-backups-p (file) NOT NEEDED
|
||||
;; - repository-hostname (dirname) NOT NEEDED
|
||||
;; - make-version-backups-p (file) NOT NEEDED
|
||||
;; - repository-hostname (dirname) NOT NEEDED
|
||||
;; - previous-revision (file rev) OK
|
||||
;; - next-revision (file rev) OK
|
||||
;; - check-headers () COULD BE SUPPORTED
|
||||
;; - clear-headers () NOT NEEDED
|
||||
;; - delete-file (file) OK
|
||||
;; - rename-file (old new) OK
|
||||
;; - find-file-hook () NOT NEEDED
|
||||
;; - find-file-not-found-hook () NOT NEEDED
|
||||
;; - next-revision (file rev) OK
|
||||
;; - check-headers () COULD BE SUPPORTED
|
||||
;; - clear-headers () NOT NEEDED
|
||||
;; - delete-file (file) OK
|
||||
;; - rename-file (old new) OK
|
||||
;; - find-file-hook () NOT NEEDED
|
||||
;; - find-file-not-found-hook () NOT NEEDED
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl)
|
||||
|
@ -554,16 +555,16 @@ or BRANCH^ (where \"^\" can be repeated)."
|
|||
(and (looking-at "[0-9a-f^][0-9a-f]+")
|
||||
(buffer-substring-no-properties (match-beginning 0) (match-end 0)))))
|
||||
|
||||
;;; SNAPSHOT SYSTEM
|
||||
;;; TAG SYSTEM
|
||||
|
||||
(defun vc-git-create-snapshot (dir name branchp)
|
||||
(defun vc-git-create-tag (dir name branchp)
|
||||
(let ((default-directory dir))
|
||||
(and (vc-git-command nil 0 nil "update-index" "--refresh")
|
||||
(if branchp
|
||||
(vc-git-command nil 0 nil "checkout" "-b" name)
|
||||
(vc-git-command nil 0 nil "tag" name)))))
|
||||
|
||||
(defun vc-git-retrieve-snapshot (dir name update)
|
||||
(defun vc-git-retrieve-tag (dir name update)
|
||||
(let ((default-directory dir))
|
||||
(vc-git-command nil 0 nil "checkout" name)
|
||||
;; FIXME: update buffers if `update' is true
|
||||
|
|
|
@ -76,10 +76,9 @@
|
|||
;; - annotate-time () OK
|
||||
;; - annotate-current-time () NOT NEEDED
|
||||
;; - annotate-extract-revision-at-line () OK
|
||||
;; SNAPSHOT SYSTEM
|
||||
;; - create-snapshot (dir name branchp) NEEDED (probably branch?)
|
||||
;; - assign-name (file name) NOT NEEDED
|
||||
;; - retrieve-snapshot (dir name update) ?? NEEDED??
|
||||
;; TAG SYSTEM
|
||||
;; - create-tag (dir name branchp) NEEDED
|
||||
;; - retrieve-tag (dir name update) NEEDED
|
||||
;; MISCELLANEOUS
|
||||
;; - make-version-backups-p (file) ??
|
||||
;; - repository-hostname (dirname) ??
|
||||
|
|
|
@ -981,8 +981,8 @@ Used in `find-file-not-found-functions'."
|
|||
(define-key map "i" 'vc-register)
|
||||
(define-key map "l" 'vc-print-log)
|
||||
(define-key map "m" 'vc-merge)
|
||||
(define-key map "r" 'vc-retrieve-snapshot)
|
||||
(define-key map "s" 'vc-create-snapshot)
|
||||
(define-key map "r" 'vc-retrieve-tag)
|
||||
(define-key map "s" 'vc-create-tag)
|
||||
(define-key map "u" 'vc-revert)
|
||||
(define-key map "v" 'vc-next-action)
|
||||
(define-key map "+" 'vc-update)
|
||||
|
@ -996,12 +996,12 @@ Used in `find-file-not-found-functions'."
|
|||
(let ((map (make-sparse-keymap "Version Control")))
|
||||
;;(define-key map [show-files]
|
||||
;; '("Show Files under VC" . (vc-directory t)))
|
||||
(define-key map [vc-retrieve-snapshot]
|
||||
'(menu-item "Retrieve Snapshot" vc-retrieve-snapshot
|
||||
:help "Retrieve snapshot"))
|
||||
(define-key map [vc-create-snapshot]
|
||||
'(menu-item "Create Snapshot" vc-create-snapshot
|
||||
:help "Create Snapshot"))
|
||||
(define-key map [vc-retrieve-tag]
|
||||
'(menu-item "Retrieve Tag" vc-retrieve-tag
|
||||
:help "Retrieve tagged version or branch"))
|
||||
(define-key map [vc-create-tag]
|
||||
'(menu-item "Create Tag" vc-create-tag
|
||||
:help "Create version tag"))
|
||||
(define-key map [separator1] '("----"))
|
||||
(define-key map [vc-annotate]
|
||||
'(menu-item "Annotate" vc-annotate
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
;;; Bugs:
|
||||
|
||||
;; - Retrieving snapshots doesn't filter `cvs update' output and thus
|
||||
;; - Retrieving tags doesn't filter `cvs update' output and thus
|
||||
;; parses bogus filenames. Don't know if it harms.
|
||||
|
||||
;;; Code:
|
||||
|
@ -461,10 +461,10 @@ Optional arg REVISION is a revision to annotate from."
|
|||
(defalias 'vc-mcvs-annotate-time 'vc-cvs-annotate-time)
|
||||
|
||||
;;;
|
||||
;;; Snapshot system
|
||||
;;; Tag system
|
||||
;;;
|
||||
|
||||
(defun vc-mcvs-create-snapshot (dir name branchp)
|
||||
(defun vc-mcvs-create-tag (dir name branchp)
|
||||
"Assign to DIR's current revision a given NAME.
|
||||
If BRANCHP is non-nil, the name is created as a branch (and the current
|
||||
workspace is immediately moved to that new branch)."
|
||||
|
@ -473,9 +473,9 @@ workspace is immediately moved to that new branch)."
|
|||
(vc-mcvs-command nil 0 dir "branch" name)
|
||||
(vc-mcvs-command nil 0 dir "switch" name)))
|
||||
|
||||
(defun vc-mcvs-retrieve-snapshot (dir name update)
|
||||
"Retrieve a snapshot at and below DIR.
|
||||
NAME is the name of the snapshot; if it is empty, do a `cvs update'.
|
||||
(defun vc-mcvs-retrieve-tag (dir name update)
|
||||
"Retrieve a tag at and below DIR.
|
||||
NAME is the name of the tag; if it is empty, do a `cvs update'.
|
||||
If UPDATE is non-nil, then update (resynch) any affected buffers."
|
||||
(with-current-buffer (get-buffer-create "*vc*")
|
||||
(let ((default-directory dir)
|
||||
|
|
|
@ -787,12 +787,19 @@ systime, or nil if there is none. Also, reposition point."
|
|||
|
||||
|
||||
;;;
|
||||
;;; Snapshot system
|
||||
;;; Tag system
|
||||
;;;
|
||||
|
||||
(defun vc-rcs-assign-name (file name)
|
||||
"Assign to FILE's latest version a given NAME."
|
||||
(vc-do-command "*vc*" 0 "rcs" (vc-name file) (concat "-n" name ":")))
|
||||
(defun vc-rcs-create-tag (backend dir name branchp)
|
||||
(when branchp
|
||||
(error "RCS backend %s does not support module branches."))
|
||||
(let ((result (vc-tag-precondition dir)))
|
||||
(if (stringp result)
|
||||
(error "File %s is not up-to-date" result)
|
||||
(vc-file-tree-walk
|
||||
dir
|
||||
(lambda (f)
|
||||
(vc-do-command "*vc*" 0 "rcs" (vc-name f) (concat "-n" name ":")))))))
|
||||
|
||||
|
||||
;;;
|
||||
|
|
|
@ -352,12 +352,20 @@ revert all subfiles."
|
|||
|
||||
|
||||
;;;
|
||||
;;; Snapshot system
|
||||
;;; Tag system. SCCS doesn't have tags, so we simulate them by maintaining
|
||||
;;; our own set of name-to-revision mappings.
|
||||
;;;
|
||||
|
||||
(defun vc-sccs-assign-name (file name)
|
||||
"Assign to FILE's latest revision a given NAME."
|
||||
(vc-sccs-add-triple name file (vc-working-revision file)))
|
||||
(defun vc-sccs-create-tag (backend dir name branchp)
|
||||
(when branchp
|
||||
(error "SCCS backend %s does not support module branches."))
|
||||
(let ((result (vc-tag-precondition dir)))
|
||||
(if (stringp result)
|
||||
(error "File %s is not up-to-date" result)
|
||||
(vc-file-tree-walk
|
||||
dir
|
||||
(lambda (f)
|
||||
(vc-sccs-add-triple name f (vc-working-revision f)))))))
|
||||
|
||||
|
||||
;;;
|
||||
|
@ -373,7 +381,7 @@ revert all subfiles."
|
|||
(defun vc-sccs-rename-file (old new)
|
||||
;; Move the master file (using vc-rcs-master-templates).
|
||||
(vc-rename-master (vc-name old) new vc-sccs-master-templates)
|
||||
;; Update the snapshot file.
|
||||
;; Update the tag file.
|
||||
(with-current-buffer
|
||||
(find-file-noselect
|
||||
(expand-file-name vc-sccs-name-assoc-file
|
||||
|
@ -446,7 +454,7 @@ The result is a list of the form ((REVISION . USER) (REVISION . USER) ...)."
|
|||
(kill-buffer (current-buffer))))
|
||||
|
||||
(defun vc-sccs-lookup-triple (file name)
|
||||
"Return the numeric revision corresponding to a named snapshot of FILE.
|
||||
"Return the numeric revision corresponding to a named tag of FILE.
|
||||
If NAME is nil or a revision number string it's just passed through."
|
||||
(if (or (null name)
|
||||
(let ((firstchar (aref name 0)))
|
||||
|
|
|
@ -465,20 +465,20 @@ or svn+ssh://."
|
|||
(buffer-size (get-buffer buffer)))))
|
||||
|
||||
;;;
|
||||
;;; Snapshot system
|
||||
;;; Tag system
|
||||
;;;
|
||||
|
||||
(defun vc-svn-create-snapshot (dir name branchp)
|
||||
(defun vc-svn-create-tag (dir name branchp)
|
||||
"Assign to DIR's current revision a given NAME.
|
||||
If BRANCHP is non-nil, the name is created as a branch (and the current
|
||||
workspace is immediately moved to that new branch).
|
||||
NAME is assumed to be a URL."
|
||||
(vc-svn-command nil 0 dir "copy" name)
|
||||
(when branchp (vc-svn-retrieve-snapshot dir name nil)))
|
||||
(when branchp (vc-svn-retrieve-tag dir name nil)))
|
||||
|
||||
(defun vc-svn-retrieve-snapshot (dir name update)
|
||||
"Retrieve a snapshot at and below DIR.
|
||||
NAME is the name of the snapshot; if it is empty, do a `svn update'.
|
||||
(defun vc-svn-retrieve-tag (dir name update)
|
||||
"Retrieve a tag at and below DIR.
|
||||
NAME is the name of the tag; if it is empty, do a `svn update'.
|
||||
If UPDATE is non-nil, then update (resynch) any affected buffers.
|
||||
NAME is assumed to be a URL."
|
||||
(vc-svn-command nil 0 dir "switch" name)
|
||||
|
|
78
lisp/vc.el
78
lisp/vc.el
|
@ -438,28 +438,23 @@
|
|||
;; corresponding to the current line, or nil if there is no revision
|
||||
;; corresponding to the current line.
|
||||
;;
|
||||
;; SNAPSHOT SYSTEM
|
||||
;; TAG SYSTEM
|
||||
;;
|
||||
;; - create-snapshot (dir name branchp)
|
||||
;; - create-tag (dir name branchp)
|
||||
;;
|
||||
;; Take a snapshot of the current state of files under DIR and name it
|
||||
;; NAME. This should make sure that files are up-to-date before
|
||||
;; proceeding with the action. DIR can also be a file and if BRANCHP
|
||||
;; is specified, NAME should be created as a branch and DIR should be
|
||||
;; checked out under this new branch. The default implementation does
|
||||
;; not support branches but does a sanity check, a tree traversal and
|
||||
;; for each file calls `assign-name'.
|
||||
;; Attach the tag NAME to the state of the working copy. This
|
||||
;; should make sure that files are up-to-date before proceeding with
|
||||
;; the action. DIR can also be a file and if BRANCHP is specified,
|
||||
;; NAME should be created as a branch and DIR should be checked out
|
||||
;; under this new branch. The default implementation does not
|
||||
;; support branches but does a sanity check, a tree traversal and
|
||||
;; assigns the tag to each file.
|
||||
;;
|
||||
;; - assign-name (file name)
|
||||
;; - retrieve-tag (dir name update)
|
||||
;;
|
||||
;; Give name NAME to the working revision of FILE, assuming it is
|
||||
;; up-to-date. Only used by the default version of `create-snapshot'.
|
||||
;;
|
||||
;; - retrieve-snapshot (dir name update)
|
||||
;;
|
||||
;; Retrieve a named snapshot of all registered files at or below DIR.
|
||||
;; Retrieve the version tagged by NAME of all registered files at or below DIR.
|
||||
;; If UPDATE is non-nil, then update buffers of any files in the
|
||||
;; snapshot that are currently visited. The default implementation
|
||||
;; tag that are currently visited. The default implementation
|
||||
;; does a sanity check whether there aren't any uncommitted changes at
|
||||
;; or below DIR, and then performs a tree walk, using the `checkout'
|
||||
;; function to retrieve the corresponding revisions.
|
||||
|
@ -570,8 +565,6 @@
|
|||
;;
|
||||
;;;; Improved branch and tag handling:
|
||||
;;
|
||||
;; - "snapshots" should be renamed to "tags", and thoroughly reworked.
|
||||
;;
|
||||
;; - add a generic mechanism for remembering the current branch names,
|
||||
;; display the branch name in the mode-line. Replace
|
||||
;; vc-cvs-sticky-tag with that.
|
||||
|
@ -580,7 +573,7 @@
|
|||
;; adapted accordingly. Also, it considers RCS and CVS to be the same,
|
||||
;; which is pretty confusing.
|
||||
;;
|
||||
;; - vc-create-snapshot and vc-retrieve-snapshot should update the
|
||||
;; - vc-create-tag and vc-retrieve-tag should update the
|
||||
;; buffers that might be visiting the affected files.
|
||||
;;
|
||||
;;;; Default Behavior:
|
||||
|
@ -2047,10 +2040,10 @@ outside of VC) and one wants to do some operation on it."
|
|||
|
||||
;; Named-configuration entry points
|
||||
|
||||
(defun vc-snapshot-precondition (dir)
|
||||
(defun vc-tag-precondition (dir)
|
||||
"Scan the tree below DIR, looking for files not up-to-date.
|
||||
If any file is not up-to-date, return the name of the first such file.
|
||||
\(This means, neither snapshot creation nor retrieval is allowed.\)
|
||||
\(This means, neither tag creation nor retrieval is allowed.\)
|
||||
If one or more of the files are currently visited, return `visited'.
|
||||
Otherwise, return nil."
|
||||
(let ((status nil))
|
||||
|
@ -2063,40 +2056,40 @@ Otherwise, return nil."
|
|||
status)))
|
||||
|
||||
;;;###autoload
|
||||
(defun vc-create-snapshot (dir name branchp)
|
||||
"Descending recursively from DIR, make a snapshot called NAME.
|
||||
(defun vc-create-tag (dir name branchp)
|
||||
"Descending recursively from DIR, make a tag called NAME.
|
||||
For each registered file, the working revision becomes part of
|
||||
the named configuration. If the prefix argument BRANCHP is
|
||||
given, the snapshot is made as a new branch and the files are
|
||||
given, the tag is made as a new branch and the files are
|
||||
checked out in that new branch."
|
||||
(interactive
|
||||
(list (read-file-name "Directory: " default-directory default-directory t)
|
||||
(read-string "New snapshot name: ")
|
||||
(read-string "New tag name: ")
|
||||
current-prefix-arg))
|
||||
(message "Making %s... " (if branchp "branch" "snapshot"))
|
||||
(message "Making %s... " (if branchp "branch" "tag"))
|
||||
(when (file-directory-p dir) (setq dir (file-name-as-directory dir)))
|
||||
(vc-call-backend (vc-responsible-backend dir)
|
||||
'create-snapshot dir name branchp)
|
||||
(message "Making %s... done" (if branchp "branch" "snapshot")))
|
||||
'create-tag dir name branchp)
|
||||
(message "Making %s... done" (if branchp "branch" "tag")))
|
||||
|
||||
;;;###autoload
|
||||
(defun vc-retrieve-snapshot (dir name)
|
||||
"Descending recursively from DIR, retrieve the snapshot called NAME.
|
||||
(defun vc-retrieve-tag (dir name)
|
||||
"Descending recursively from DIR, retrieve the tag called NAME.
|
||||
If NAME is empty, it refers to the latest revisions.
|
||||
If locking is used for the files in DIR, then there must not be any
|
||||
locked files at or below DIR (but if NAME is empty, locked files are
|
||||
allowed and simply skipped)."
|
||||
(interactive
|
||||
(list (read-file-name "Directory: " default-directory default-directory t)
|
||||
(read-string "Snapshot name to retrieve (default latest revisions): ")))
|
||||
(read-string "Tag name to retrieve (default latest revisions): ")))
|
||||
(let ((update (yes-or-no-p "Update any affected buffers? "))
|
||||
(msg (if (or (not name) (string= name ""))
|
||||
(format "Updating %s... " (abbreviate-file-name dir))
|
||||
(format "Retrieving snapshot into %s... "
|
||||
(format "Retrieving tag into %s... "
|
||||
(abbreviate-file-name dir)))))
|
||||
(message "%s" msg)
|
||||
(vc-call-backend (vc-responsible-backend dir)
|
||||
'retrieve-snapshot dir name update)
|
||||
'retrieve-tag dir name update)
|
||||
(message "%s" (concat msg "done"))))
|
||||
|
||||
;; Miscellaneous other entry points
|
||||
|
@ -2693,18 +2686,7 @@ to provide the `find-revision' operation instead."
|
|||
"Let BACKEND receive FILE from another version control system."
|
||||
(vc-call-backend backend 'register file rev ""))
|
||||
|
||||
(defun vc-default-create-snapshot (backend dir name branchp)
|
||||
(when branchp
|
||||
(error "VC backend %s does not support module branches" backend))
|
||||
(let ((result (vc-snapshot-precondition dir)))
|
||||
(if (stringp result)
|
||||
(error "File %s is not up-to-date" result)
|
||||
(vc-file-tree-walk
|
||||
dir
|
||||
(lambda (f)
|
||||
(vc-call-backend backend 'assign-name f name))))))
|
||||
|
||||
(defun vc-default-retrieve-snapshot (backend dir name update)
|
||||
(defun vc-default-retrieve-tag (backend dir name update)
|
||||
(if (string= name "")
|
||||
(progn
|
||||
(vc-file-tree-walk
|
||||
|
@ -2714,7 +2696,7 @@ to provide the `find-revision' operation instead."
|
|||
(vc-error-occurred
|
||||
(vc-call-backend backend 'checkout f nil "")
|
||||
(when update (vc-resynch-buffer f t t)))))))
|
||||
(let ((result (vc-snapshot-precondition dir)))
|
||||
(let ((result (vc-tag-precondition dir)))
|
||||
(if (stringp result)
|
||||
(error "File %s is locked" result)
|
||||
(setq update (and (eq result 'visited) update))
|
||||
|
@ -3290,7 +3272,7 @@ Invoke FUNC f ARGS on each VC-managed file f underneath it."
|
|||
;; The performance problem, it turns out, simplifies in practice to the
|
||||
;; problem of making vc-state fast. The two other functions that call
|
||||
;; prs/rlog will not be so commonly used that the slowdown is a problem; one
|
||||
;; makes snapshots, the other deletes the calling user's last change in the
|
||||
;; makes tags, the other deletes the calling user's last change in the
|
||||
;; master.
|
||||
;;
|
||||
;; The race condition implies that we have to either (a) lock the master
|
||||
|
|
Loading…
Add table
Reference in a new issue