/
VersionControl
80 lines (60 loc) · 3.94 KB
/
VersionControl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Emacs comes with a generic version control interface called [::VC]. It supports the ConcurrentVersionsSystem (CVS), RevisionControlSystem (RCS), SCCS, [[Arch]], Git, Mercurial, Bzr, Monotone, MetaCVS and SubVersion (SVN). DaRcs support will appear in the next version of Emacs with VcDarcs -- and not DarcSum.
On [[2007-10-03]], the original author of VC mode, EricRaymond, announced a major rewrite of VC mode whose principal goal is "to change VC so that its primitive operations (notably checkin/commit) take sets of files as arguments rather than single files". The necessary changes to the VC backend have already been added to EmacsFromCVS.
See ForceBackups for the backup system integrated in Emacs that uses the `version-control' variable (and even understands the ##VERSION_CONTROL## environment variable as recognized in other GNU programs) for making "numbered backups" for each time a file is edited.
See CategoryVersionControl for other interfaces to other version control systems. They often use similar keybindings.
== Keybindings ==
C-x v v vc-next-action -- perform the next logical control operation on file
(C-x C-q by default, C-x C-q is no longer bound, so it's better to use the above binding)
C-x v i vc-register -- add a new file to version control
C-x v ~ vc-version-other-window -- look at other revisions
C-x v = vc-diff -- diff with other revisions
C-x v u vc-revert-buffer -- undo checkout
C-x v c vc-cancel-version -- delete the latest revision (often it makes more sense to look at an old revision and check that in again!)
C-x v d vc-directory -- show all files which are not up to date
C-x v g vc-annotate -- show when each line in a tracked file was added and by whom
C-x v s vc-create-snapshot -- tag all the files with a symbolic name
C-x v r vc-retrieve-snapshot -- undo checkouts and return to a snapshot with a symbolic name
C-x v l vc-print-log -- show log (not in ChangeLog format)
C-x v a vc-update-change-log -- update ChangeLog
C-x v m vc-merge
C-x v h vc-insert-headers
M-x vc-resolve-conflicts -- pop up an ediff-merge session on a file with conflict markers
The info pages have more about it: [[Manual:Version Control]].
[new]
Also, don't forget the powerful ediff--revision command which is part of the ediff package and uses the vc interface. See EdiffMode.
[new]
Be aware that the CVS mode will keep old revisions of your files in the current directory, even if you are using a BackupDirectory. This makes sense from a CVS point of view but can be maddening from a "no really, don't litter my fs tree" point of view. If I can find a fix for this that doesn't break CVS mode, I'll post it here. -- DavidBrady
[new]
Here is my two cents
(defun my-log-view-diff (beg end)
"Overwrite the default log-view-diff, make use of
log-view-get-marked --lgfang"
(interactive
(if (log-view-get-marked) (log-view-get-marked)
(list (log-view-current-tag (point))
(log-view-current-tag (point)))))
(when (string-equal beg end)
(save-excursion
(goto-char (point)) ;not marked
(log-view-msg-next)
(setq end (log-view-current-tag))))
(vc-version-diff
(if log-view-per-file-logs
(list (log-view-current-file))
log-view-vc-fileset)
beg end))
(eval-after-load "log-view" '(fset 'log-view-diff 'my-log-view-diff))
(defun my-log-view-revision ()
"get marked revision (or revision at point) --lgfang"
(interactive)
(let ((revision (if (log-view-get-marked) (car (log-view-get-marked))
(log-view-current-tag (point)))))
(switch-to-buffer-other-window
(vc-find-revision (log-view-current-file) revision))))
(eval-after-load "log-view"
'(define-key log-view-mode-map "v" 'my-log-view-revision))
----
See also
VersionControlAlways.
----
CategoryVersionControl