Mercurial > emacs
annotate lisp/vc-svn.el @ 107481:2630a1cf07ac
* mail-source.el (gnus-message): Declare.
(mail-source-delete-old-incoming): Require gnus-util.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 23 Mar 2010 20:21:53 -0700 |
parents | 1918e70c8b37 |
children |
rev | line source |
---|---|
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1 ;;; vc-svn.el --- non-resident support for Subversion version-control |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
98519
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
5 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
6 ;; Author: FSF (see vc.el for full credits) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
7 ;; Maintainer: Stefan Monnier <monnier@gnu.org> |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
8 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
10 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
14 ;; (at your option) any later version. |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
15 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
20 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
23 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
24 ;;; Commentary: |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
25 |
85122
c2cc930bdd9e
This is the actual fix....
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85114
diff
changeset
|
26 ;; Sync'd with Subversion's vc-svn.el as of revision 5801. but this version |
c2cc930bdd9e
This is the actual fix....
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85114
diff
changeset
|
27 ;; has been extensively modified since to handle filesets. |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
28 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
29 ;;; Code: |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
30 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
31 (eval-when-compile |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
32 (require 'vc)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
33 |
107095
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
34 ;; Clear up the cache to force vc-call to check again and discover |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
35 ;; new functions when we reload this file. |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
36 (put 'SVN 'vc-functions nil) |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
37 |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
38 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
39 ;;; Customization options |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
40 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
41 |
99782
6be2d2932794
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
99248
diff
changeset
|
42 ;; FIXME there is also svnadmin. |
6be2d2932794
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
99248
diff
changeset
|
43 (defcustom vc-svn-program "svn" |
6be2d2932794
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
99248
diff
changeset
|
44 "Name of the SVN executable." |
6be2d2932794
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
99248
diff
changeset
|
45 :type 'string |
6be2d2932794
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
99248
diff
changeset
|
46 :group 'vc) |
6be2d2932794
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
99248
diff
changeset
|
47 |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
48 (defcustom vc-svn-global-switches nil |
99782
6be2d2932794
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
99248
diff
changeset
|
49 "Global switches to pass to any SVN command." |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
50 :type '(choice (const :tag "None" nil) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
51 (string :tag "Argument String") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
52 (repeat :tag "Argument List" |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
53 :value ("") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
54 string)) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59446
diff
changeset
|
55 :version "22.1" |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
56 :group 'vc) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
57 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
58 (defcustom vc-svn-register-switches nil |
100206
0ae09d7be444
(vc-svn-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100185
diff
changeset
|
59 "Switches for registering a file into SVN. |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
60 A string or list of strings passed to the checkin program by |
100206
0ae09d7be444
(vc-svn-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100185
diff
changeset
|
61 \\[vc-register]. If nil, use the value of `vc-register-switches'. |
0ae09d7be444
(vc-svn-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100185
diff
changeset
|
62 If t, use no switches." |
0ae09d7be444
(vc-svn-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100185
diff
changeset
|
63 :type '(choice (const :tag "Unspecified" nil) |
0ae09d7be444
(vc-svn-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100185
diff
changeset
|
64 (const :tag "None" t) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
65 (string :tag "Argument String") |
100206
0ae09d7be444
(vc-svn-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100185
diff
changeset
|
66 (repeat :tag "Argument List" :value ("") string)) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59446
diff
changeset
|
67 :version "22.1" |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
68 :group 'vc) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
69 |
52033
9b5f3940a1ef
(vc-svn-diff-switches): Don't default to vc-diff-switches.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51732
diff
changeset
|
70 (defcustom vc-svn-diff-switches |
9b5f3940a1ef
(vc-svn-diff-switches): Don't default to vc-diff-switches.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51732
diff
changeset
|
71 t ;`svn' doesn't support common args like -c or -b. |
9b5f3940a1ef
(vc-svn-diff-switches): Don't default to vc-diff-switches.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51732
diff
changeset
|
72 "String or list of strings specifying extra switches for svn diff under VC. |
100059
18d556e2b8e1
(vc-svn-diff-switches): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
99782
diff
changeset
|
73 If nil, use the value of `vc-diff-switches' (or `diff-switches'), |
18d556e2b8e1
(vc-svn-diff-switches): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
99782
diff
changeset
|
74 together with \"-x --diff-cmd=diff\" (since svn diff does not |
18d556e2b8e1
(vc-svn-diff-switches): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
99782
diff
changeset
|
75 support the default \"-c\" value of `diff-switches'). If you |
18d556e2b8e1
(vc-svn-diff-switches): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
99782
diff
changeset
|
76 want to force an empty list of arguments, use t." |
52033
9b5f3940a1ef
(vc-svn-diff-switches): Don't default to vc-diff-switches.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51732
diff
changeset
|
77 :type '(choice (const :tag "Unspecified" nil) |
9b5f3940a1ef
(vc-svn-diff-switches): Don't default to vc-diff-switches.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51732
diff
changeset
|
78 (const :tag "None" t) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
79 (string :tag "Argument String") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
80 (repeat :tag "Argument List" |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
81 :value ("") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
82 string)) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59446
diff
changeset
|
83 :version "22.1" |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
84 :group 'vc) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
85 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
86 (defcustom vc-svn-header (or (cdr (assoc 'SVN vc-header-alist)) '("\$Id\$")) |
99782
6be2d2932794
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
99248
diff
changeset
|
87 "Header keywords to be inserted by `vc-insert-headers'." |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59446
diff
changeset
|
88 :version "22.1" |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
89 :type '(repeat string) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
90 :group 'vc) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
91 |
76025
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
92 ;; We want to autoload it for use by the autoloaded version of |
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
93 ;; vc-svn-registered, but we want the value to be compiled at startup, not |
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
94 ;; at dump time. |
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
95 ;; ;;;###autoload |
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
96 (defconst vc-svn-admin-directory |
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
97 (cond ((and (memq system-type '(cygwin windows-nt ms-dos)) |
73848
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
98 (getenv "SVN_ASP_DOT_NET_HACK")) |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
99 "_svn") |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
100 (t ".svn")) |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
101 "The name of the \".svn\" subdirectory or its equivalent.") |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
102 |
81968
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
103 ;;; Properties of the backend |
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
104 |
94563
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94521
diff
changeset
|
105 (defun vc-svn-revision-granularity () 'repository) |
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94521
diff
changeset
|
106 (defun vc-svn-checkout-model (files) 'implicit) |
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94521
diff
changeset
|
107 |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
108 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
109 ;;; State-querying functions |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
110 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
111 |
73848
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
112 ;;; vc-svn-admin-directory is generally not defined when the |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
113 ;;; autoloaded function is called. |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
114 |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
115 ;;;###autoload (defun vc-svn-registered (f) |
73848
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
116 ;;;###autoload (let ((admin-dir (cond ((and (eq system-type 'windows-nt) |
76025
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
117 ;;;###autoload (getenv "SVN_ASP_DOT_NET_HACK")) |
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
118 ;;;###autoload "_svn") |
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
119 ;;;###autoload (t ".svn")))) |
73848
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
120 ;;;###autoload (when (file-readable-p (expand-file-name |
76025
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
121 ;;;###autoload (concat admin-dir "/entries") |
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
122 ;;;###autoload (file-name-directory f))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
123 ;;;###autoload (load "vc-svn") |
73848
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
124 ;;;###autoload (vc-svn-registered f)))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
125 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
126 (defun vc-svn-registered (file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
127 "Check if FILE is SVN registered." |
73848
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
128 (when (file-readable-p (expand-file-name (concat vc-svn-admin-directory |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
129 "/entries") |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
130 (file-name-directory file))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
131 (with-temp-buffer |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
132 (cd (file-name-directory file)) |
104600
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
133 (let* (process-file-side-effects |
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
134 (status |
67553
10707dfc70f3
(vc-svn-registered): Use it to avoid popping up a spurious
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67547
diff
changeset
|
135 (condition-case nil |
10707dfc70f3
(vc-svn-registered): Use it to avoid popping up a spurious
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67547
diff
changeset
|
136 ;; Ignore all errors. |
10707dfc70f3
(vc-svn-registered): Use it to avoid popping up a spurious
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67547
diff
changeset
|
137 (vc-svn-command t t file "status" "-v") |
10707dfc70f3
(vc-svn-registered): Use it to avoid popping up a spurious
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67547
diff
changeset
|
138 ;; Some problem happened. E.g. We can't find an `svn' |
10707dfc70f3
(vc-svn-registered): Use it to avoid popping up a spurious
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67547
diff
changeset
|
139 ;; executable. We used to only catch `file-error' but when |
10707dfc70f3
(vc-svn-registered): Use it to avoid popping up a spurious
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67547
diff
changeset
|
140 ;; the process is run on a remote host via Tramp, the error |
10707dfc70f3
(vc-svn-registered): Use it to avoid popping up a spurious
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67547
diff
changeset
|
141 ;; is only reported via the exit status which is turned into |
10707dfc70f3
(vc-svn-registered): Use it to avoid popping up a spurious
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67547
diff
changeset
|
142 ;; an `error' by vc-do-command. |
10707dfc70f3
(vc-svn-registered): Use it to avoid popping up a spurious
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67547
diff
changeset
|
143 (error nil)))) |
10707dfc70f3
(vc-svn-registered): Use it to avoid popping up a spurious
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67547
diff
changeset
|
144 (when (eq 0 status) |
87864
54863df609a3
(vc-svn-registered): Make it work for non-existent
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87853
diff
changeset
|
145 (let ((parsed (vc-svn-parse-status file))) |
54863df609a3
(vc-svn-registered): Make it work for non-existent
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87853
diff
changeset
|
146 (and parsed (not (memq parsed '(ignored unregistered)))))))))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
147 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
148 (defun vc-svn-state (file &optional localp) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
149 "SVN-specific version of `vc-state'." |
104600
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
150 (let (process-file-side-effects) |
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
151 (setq localp (or localp (vc-stay-local-p file 'SVN))) |
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
152 (with-temp-buffer |
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
153 (cd (file-name-directory file)) |
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
154 (vc-svn-command t 0 file "status" (if localp "-v" "-u")) |
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
155 (vc-svn-parse-status file)))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
156 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
157 (defun vc-svn-state-heuristic (file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
158 "SVN-specific state heuristic." |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
159 (vc-svn-state file 'local)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
160 |
98519
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
161 ;; FIXME it would be better not to have the "remote" argument, |
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
162 ;; but to distinguish the two output formats based on content. |
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
163 (defun vc-svn-after-dir-status (callback &optional remote) |
87853
cec6a1fe32a4
* vc-svn.el (vc-svn-after-dir-status): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87845
diff
changeset
|
164 (let ((state-map '((?A . added) |
94006
a4655455212b
(vc-svn-after-dir-status): Complete last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
165 (?C . conflict) |
a4655455212b
(vc-svn-after-dir-status): Complete last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
166 (?I . ignored) |
a4655455212b
(vc-svn-after-dir-status): Complete last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
167 (?M . edited) |
103154
276b0724ed86
(vc-svn-parse-status): Accept ?D for removed files (bug#3213).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102974
diff
changeset
|
168 (?D . removed) |
94006
a4655455212b
(vc-svn-after-dir-status): Complete last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
169 (?R . removed) |
a4655455212b
(vc-svn-after-dir-status): Complete last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
170 (?? . unregistered) |
a4655455212b
(vc-svn-after-dir-status): Complete last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
171 ;; This is what vc-svn-parse-status does. |
a4655455212b
(vc-svn-after-dir-status): Complete last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
172 (?~ . edited))) |
106521
3ecd902dead9
(vc-svn-after-dir-status): Fix regexp. (Bug#4741)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106472
diff
changeset
|
173 (re (if remote "^\\(.\\)...... \\([ *]\\) +\\(?:[-0-9]+\\)? \\(.*\\)$" |
98519
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
174 ;; Subexp 2 is a dummy in this case, so the numbers match. |
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
175 "^\\(.\\)....\\(.\\) \\(.*\\)$")) |
87853
cec6a1fe32a4
* vc-svn.el (vc-svn-after-dir-status): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87845
diff
changeset
|
176 result) |
cec6a1fe32a4
* vc-svn.el (vc-svn-after-dir-status): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87845
diff
changeset
|
177 (goto-char (point-min)) |
98519
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
178 (while (re-search-forward re nil t) |
87853
cec6a1fe32a4
* vc-svn.el (vc-svn-after-dir-status): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87845
diff
changeset
|
179 (let ((state (cdr (assq (aref (match-string 1) 0) state-map))) |
98519
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
180 (filename (match-string 3))) |
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
181 (and remote (string-equal (match-string 2) "*") |
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
182 ;; FIXME are there other possible combinations? |
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
183 (cond ((eq state 'edited) (setq state 'needs-merge)) |
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
184 ((not state) (setq state 'needs-update)))) |
102974
04e540897dd1
(vc-svn-after-dir-status): Fix regexp to allow for
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101925
diff
changeset
|
185 (when (and state (not (string= "." filename))) |
93461
3afeea9a48a3
* vc.el (vc-status-add-entry): Assume ENTRY is a list not a cons.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93382
diff
changeset
|
186 (setq result (cons (list filename state) result))))) |
94006
a4655455212b
(vc-svn-after-dir-status): Complete last change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
187 (funcall callback result))) |
87853
cec6a1fe32a4
* vc-svn.el (vc-svn-after-dir-status): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87845
diff
changeset
|
188 |
94003
2ecb2ea8d5b5
Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93956
diff
changeset
|
189 (defun vc-svn-dir-status (dir callback) |
87853
cec6a1fe32a4
* vc-svn.el (vc-svn-after-dir-status): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87845
diff
changeset
|
190 "Run 'svn status' for DIR and update BUFFER via CALLBACK. |
cec6a1fe32a4
* vc-svn.el (vc-svn-after-dir-status): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87845
diff
changeset
|
191 CALLBACK is called as (CALLBACK RESULT BUFFER), where |
cec6a1fe32a4
* vc-svn.el (vc-svn-after-dir-status): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87845
diff
changeset
|
192 RESULT is a list of conses (FILE . STATE) for directory DIR." |
98519
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
193 ;; FIXME should this rather be all the files in dir? |
101713
6bc8fe0c390a
(vc-svn-dir-status): Disable the vc-stay-local-p
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101669
diff
changeset
|
194 ;; FIXME: the vc-stay-local-p logic below is disabled, it ends up |
6bc8fe0c390a
(vc-svn-dir-status): Disable the vc-stay-local-p
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101669
diff
changeset
|
195 ;; calling synchronously (vc-svn-registered DIR) => calling svn status -v DIR |
6bc8fe0c390a
(vc-svn-dir-status): Disable the vc-stay-local-p
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101669
diff
changeset
|
196 ;; which is VERY SLOW for big trees and it makes emacs |
6bc8fe0c390a
(vc-svn-dir-status): Disable the vc-stay-local-p
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101669
diff
changeset
|
197 ;; completely unresponsive during that time. |
103553
af4ee0cb7fb7
* vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103154
diff
changeset
|
198 (let* ((local (and nil (vc-stay-local-p dir 'SVN))) |
101713
6bc8fe0c390a
(vc-svn-dir-status): Disable the vc-stay-local-p
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101669
diff
changeset
|
199 (remote (or t (not local) (eq local 'only-file)))) |
98519
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
200 (vc-svn-command (current-buffer) 'async nil "status" |
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
201 (if remote "-u")) |
93382
8e46096e0cb3
* vc.el (vc-status-menu-map, vc-status-mode-map): Bind vc-revert.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93124
diff
changeset
|
202 (vc-exec-after |
98519
4031fe2e11ee
(vc-svn-after-dir-status): Handle `svn status -u' output.
Glenn Morris <rgm@gnu.org>
parents:
98495
diff
changeset
|
203 `(vc-svn-after-dir-status (quote ,callback) ,remote)))) |
87845
800f4ac6c848
* vc-svn.el (vc-svn-dir-status): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87785
diff
changeset
|
204 |
98495
e8a025cdac4a
* vc-svn.el (vc-svn-dir-status-files):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98086
diff
changeset
|
205 (defun vc-svn-dir-status-files (dir files default-state callback) |
e8a025cdac4a
* vc-svn.el (vc-svn-dir-status-files):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98086
diff
changeset
|
206 (apply 'vc-svn-command (current-buffer) 'async nil "status" files) |
e8a025cdac4a
* vc-svn.el (vc-svn-dir-status-files):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98086
diff
changeset
|
207 (vc-exec-after |
e8a025cdac4a
* vc-svn.el (vc-svn-dir-status-files):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98086
diff
changeset
|
208 `(vc-svn-after-dir-status (quote ,callback)))) |
e8a025cdac4a
* vc-svn.el (vc-svn-dir-status-files):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98086
diff
changeset
|
209 |
99159
b0dce7f34dda
* vc.el: Rename VC methods that were missed when vc-status was
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98675
diff
changeset
|
210 (defun vc-svn-dir-extra-headers (dir) |
95048
883c17cb4544
Add extra-headers method for SVN.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
95020
diff
changeset
|
211 "Generate extra status headers for a Subversion working copy." |
104600
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
212 (let (process-file-side-effects) |
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
213 (vc-svn-command "*vc*" 0 nil "info")) |
95048
883c17cb4544
Add extra-headers method for SVN.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
95020
diff
changeset
|
214 (let ((repo |
96003
243cf028ce86
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
215 (save-excursion |
95048
883c17cb4544
Add extra-headers method for SVN.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
95020
diff
changeset
|
216 (and (progn |
883c17cb4544
Add extra-headers method for SVN.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
95020
diff
changeset
|
217 (set-buffer "*vc*") |
883c17cb4544
Add extra-headers method for SVN.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
95020
diff
changeset
|
218 (goto-char (point-min)) |
883c17cb4544
Add extra-headers method for SVN.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
95020
diff
changeset
|
219 (re-search-forward "Repository Root: *\\(.*\\)" nil t)) |
883c17cb4544
Add extra-headers method for SVN.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
95020
diff
changeset
|
220 (match-string 1))))) |
883c17cb4544
Add extra-headers method for SVN.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
95020
diff
changeset
|
221 (concat |
883c17cb4544
Add extra-headers method for SVN.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
95020
diff
changeset
|
222 (cond (repo |
883c17cb4544
Add extra-headers method for SVN.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
95020
diff
changeset
|
223 (concat |
883c17cb4544
Add extra-headers method for SVN.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
95020
diff
changeset
|
224 (propertize "Repository : " 'face 'font-lock-type-face) |
883c17cb4544
Add extra-headers method for SVN.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
95020
diff
changeset
|
225 (propertize repo 'face 'font-lock-variable-name-face))) |
883c17cb4544
Add extra-headers method for SVN.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
95020
diff
changeset
|
226 (t ""))))) |
883c17cb4544
Add extra-headers method for SVN.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
95020
diff
changeset
|
227 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
228 (defun vc-svn-working-revision (file) |
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
229 "SVN-specific version of `vc-working-revision'." |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
230 ;; There is no need to consult RCS headers under SVN, because we |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
231 ;; get the workfile version for free when we recognize that a file |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
232 ;; is registered in SVN. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
233 (vc-svn-registered file) |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
234 (vc-file-getprop file 'vc-working-revision)) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
235 |
51732
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
236 ;; vc-svn-mode-line-string doesn't exist because the default implementation |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
237 ;; works just fine. |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
238 |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
239 (defun vc-svn-previous-revision (file rev) |
68653
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
240 (let ((newrev (1- (string-to-number rev)))) |
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
241 (when (< 0 newrev) |
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
242 (number-to-string newrev)))) |
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
243 |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
244 (defun vc-svn-next-revision (file rev) |
68653
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
245 (let ((newrev (1+ (string-to-number rev)))) |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
246 ;; The "working revision" is an uneasy conceptual fit under Subversion; |
68653
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
247 ;; we use it as the upper bound until a better idea comes along. If the |
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
248 ;; workfile version W coincides with the tree's latest revision R, then |
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
249 ;; this check prevents a "no such revision: R+1" error. Otherwise, it |
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
250 ;; inhibits showing of W+1 through R, which could be considered anywhere |
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
251 ;; from gracious to impolite. |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
252 (unless (< (string-to-number (vc-file-getprop file 'vc-working-revision)) |
68653
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
253 newrev) |
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
254 (number-to-string newrev)))) |
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
255 |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
256 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
257 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
258 ;;; State-changing functions |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
259 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
260 |
81968
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
261 (defun vc-svn-create-repo () |
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
262 "Create a new SVN repository." |
94847
5e64dca662f0
Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94806
diff
changeset
|
263 (vc-do-command "*vc*" 0 "svnadmin" '("create" "SVN")) |
99782
6be2d2932794
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
99248
diff
changeset
|
264 (vc-do-command "*vc*" 0 vc-svn-program '(".") |
81968
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
265 "checkout" (concat "file://" default-directory "SVN"))) |
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
266 |
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
267 (defun vc-svn-register (files &optional rev comment) |
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
268 "Register FILES into the SVN version-control system. |
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
269 The COMMENT argument is ignored This does an add but not a commit. |
100206
0ae09d7be444
(vc-svn-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100185
diff
changeset
|
270 Passes either `vc-svn-register-switches' or `vc-register-switches' |
0ae09d7be444
(vc-svn-register-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
100185
diff
changeset
|
271 to the SVN command." |
81968
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
272 (apply 'vc-svn-command nil 0 files "add" (vc-switches 'SVN 'register))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
273 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
274 (defun vc-svn-responsible-p (file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
275 "Return non-nil if SVN thinks it is responsible for FILE." |
73848
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
276 (file-directory-p (expand-file-name vc-svn-admin-directory |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
277 (if (file-directory-p file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
278 file |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
279 (file-name-directory file))))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
280 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
281 (defalias 'vc-svn-could-register 'vc-svn-responsible-p |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
282 "Return non-nil if FILE could be registered in SVN. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
283 This is only possible if SVN is responsible for FILE's directory.") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
284 |
107430
1918e70c8b37
Add special markup processing for commit logs.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107095
diff
changeset
|
285 (defun vc-svn-checkin (files rev comment &optional extra-args-ignored) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
286 "SVN-specific version of `vc-backend-checkin'." |
91989
582312e95923
(vc-svn-program): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
91979
diff
changeset
|
287 (if rev (error "Committing to a specific revision is unsupported in SVN")) |
55900
d8a2b8a11274
2004-06-03 Karl Fogel <kfogel@red-bean.com>
Karl Fogel <kfogel@red-bean.com>
parents:
55004
diff
changeset
|
288 (let ((status (apply |
81968
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
289 'vc-svn-command nil 1 files "ci" |
55900
d8a2b8a11274
2004-06-03 Karl Fogel <kfogel@red-bean.com>
Karl Fogel <kfogel@red-bean.com>
parents:
55004
diff
changeset
|
290 (nconc (list "-m" comment) (vc-switches 'SVN 'checkin))))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
291 (set-buffer "*vc*") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
292 (goto-char (point-min)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
293 (unless (equal status 0) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
294 ;; Check checkin problem. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
295 (cond |
50900
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
296 ((search-forward "Transaction is out of date" nil t) |
81968
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
297 (mapc (lambda (file) (vc-file-setprop file 'vc-state 'needs-merge)) |
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
298 files) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
299 (error (substitute-command-keys |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
300 (concat "Up-to-date check failed: " |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
301 "type \\[vc-next-action] to merge in changes")))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
302 (t |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
303 (pop-to-buffer (current-buffer)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
304 (goto-char (point-min)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
305 (shrink-window-if-larger-than-buffer) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
306 (error "Check-in failed")))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
307 ;; Update file properties |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
308 ;; (vc-file-setprop |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
309 ;; file 'vc-working-revision |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
310 ;; (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
311 )) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
312 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
313 (defun vc-svn-find-revision (file rev buffer) |
81968
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
314 "SVN-specific retrieval of a specified version into a buffer." |
104600
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
315 (let (process-file-side-effects) |
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
316 (apply 'vc-svn-command |
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
317 buffer 0 file |
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
318 "cat" |
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
319 (and rev (not (string= rev "")) |
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
320 (concat "-r" rev)) |
2209bd027daa
(vc-svn-dir-extra-headers, vc-svn-find-revision):
Michael Albinus <michael.albinus@gmx.de>
parents:
103553
diff
changeset
|
321 (vc-switches 'SVN 'checkout)))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
322 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
323 (defun vc-svn-checkout (file &optional editable rev) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
324 (message "Checking out %s..." file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
325 (with-current-buffer (or (get-file-buffer file) (current-buffer)) |
94805
89d37b54b964
* vc.el (vc-mark-resolved): Add `backend' argument.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94729
diff
changeset
|
326 (vc-svn-update file editable rev (vc-switches 'SVN 'checkout))) |
103553
af4ee0cb7fb7
* vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103154
diff
changeset
|
327 (vc-mode-line file 'SVN) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
328 (message "Checking out %s...done" file)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
329 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
330 (defun vc-svn-update (file editable rev switches) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
331 (if (and (file-exists-p file) (not rev)) |
76025
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
332 ;; If no revision was specified, there's nothing to do. |
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
333 nil |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
334 ;; Check out a particular version (or recreate the file). |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
335 (vc-file-setprop file 'vc-working-revision nil) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
336 (apply 'vc-svn-command nil 0 file |
107020
e59c65208b1c
* vc-svn.el (vc-svn-update): Use "svn --non-interactive". (Bug#4280)
Glenn Morris <rgm@gnu.org>
parents:
106846
diff
changeset
|
337 "--non-interactive" ; bug#4280 |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
338 "update" |
51732
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
339 (cond |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
340 ((null rev) "-rBASE") |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
341 ((or (eq rev t) (equal rev "")) nil) |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
342 (t (concat "-r" rev))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
343 switches))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
344 |
50999
c09edac18f97
(completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50927
diff
changeset
|
345 (defun vc-svn-delete-file (file) |
c09edac18f97
(completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50927
diff
changeset
|
346 (vc-svn-command nil 0 file "remove")) |
c09edac18f97
(completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50927
diff
changeset
|
347 |
50922
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
348 (defun vc-svn-rename-file (old new) |
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
349 (vc-svn-command nil 0 new "move" (file-relative-name old))) |
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
350 |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
351 (defun vc-svn-revert (file &optional contents-done) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
352 "Revert FILE to the version it was based on." |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
353 (unless contents-done |
76025
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
354 (vc-svn-command nil 0 file "revert"))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
355 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
356 (defun vc-svn-merge (file first-version &optional second-version) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
357 "Merge changes into current working copy of FILE. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
358 The changes are between FIRST-VERSION and SECOND-VERSION." |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
359 (vc-svn-command nil 0 file |
50822
0be6233722ec
(vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50821
diff
changeset
|
360 "merge" |
50823
83c8010f1eb2
(vc-svn-merge): Forgot quotes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50822
diff
changeset
|
361 "-r" (if second-version |
50822
0be6233722ec
(vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50821
diff
changeset
|
362 (concat first-version ":" second-version) |
0be6233722ec
(vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50821
diff
changeset
|
363 first-version)) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
364 (vc-file-setprop file 'vc-state 'edited) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
365 (with-current-buffer (get-buffer "*vc*") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
366 (goto-char (point-min)) |
50822
0be6233722ec
(vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50821
diff
changeset
|
367 (if (looking-at "C ") |
0be6233722ec
(vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50821
diff
changeset
|
368 1 ; signal conflict |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
369 0))) ; signal success |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
370 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
371 (defun vc-svn-merge-news (file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
372 "Merge in any new changes made to FILE." |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
373 (message "Merging changes into %s..." file) |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
374 ;; (vc-file-setprop file 'vc-working-revision nil) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
375 (vc-file-setprop file 'vc-checkout-time 0) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
376 (vc-svn-command nil 0 file "update") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
377 ;; Analyze the merge result reported by SVN, and set |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
378 ;; file properties accordingly. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
379 (with-current-buffer (get-buffer "*vc*") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
380 (goto-char (point-min)) |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
381 ;; get new working revision |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
382 (if (re-search-forward |
50821
33e415a24bb5
(vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50820
diff
changeset
|
383 "^\\(Updated to\\|At\\) revision \\([0-9]+\\)" nil t) |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
384 (vc-file-setprop file 'vc-working-revision (match-string 2)) |
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
385 (vc-file-setprop file 'vc-working-revision nil)) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
386 ;; get file status |
50821
33e415a24bb5
(vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50820
diff
changeset
|
387 (goto-char (point-min)) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
388 (prog1 |
50821
33e415a24bb5
(vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50820
diff
changeset
|
389 (if (looking-at "At revision") |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
390 0 ;; there were no news; indicate success |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
391 (if (re-search-forward |
75719
a8fd93a515a2
(vc-svn-merge-news): Understand the new format with two
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75233
diff
changeset
|
392 ;; Newer SVN clients have 3 columns of chars (one for the |
a8fd93a515a2
(vc-svn-merge-news): Understand the new format with two
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75233
diff
changeset
|
393 ;; file's contents, then second for its properties, and the |
a8fd93a515a2
(vc-svn-merge-news): Understand the new format with two
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75233
diff
changeset
|
394 ;; third for lock-grabbing info), before the 2 spaces. |
a8fd93a515a2
(vc-svn-merge-news): Understand the new format with two
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75233
diff
changeset
|
395 ;; We also used to match the filename in column 0 without any |
a8fd93a515a2
(vc-svn-merge-news): Understand the new format with two
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75233
diff
changeset
|
396 ;; meta-info before it, but I believe this can never happen. |
a8fd93a515a2
(vc-svn-merge-news): Understand the new format with two
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75233
diff
changeset
|
397 (concat "^\\(\\([ACGDU]\\)\\(.[B ]\\)? \\)" |
50821
33e415a24bb5
(vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50820
diff
changeset
|
398 (regexp-quote (file-name-nondirectory file))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
399 nil t) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
400 (cond |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
401 ;; Merge successful, we are in sync with repository now |
75719
a8fd93a515a2
(vc-svn-merge-news): Understand the new format with two
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75233
diff
changeset
|
402 ((string= (match-string 2) "U") |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
403 (vc-file-setprop file 'vc-state 'up-to-date) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
404 (vc-file-setprop file 'vc-checkout-time |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
405 (nth 5 (file-attributes file))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
406 0);; indicate success to the caller |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
407 ;; Merge successful, but our own changes are still in the file |
75719
a8fd93a515a2
(vc-svn-merge-news): Understand the new format with two
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75233
diff
changeset
|
408 ((string= (match-string 2) "G") |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
409 (vc-file-setprop file 'vc-state 'edited) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
410 0);; indicate success to the caller |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
411 ;; Conflicts detected! |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
412 (t |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
413 (vc-file-setprop file 'vc-state 'edited) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
414 1);; signal the error to the caller |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
415 ) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
416 (pop-to-buffer "*vc*") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
417 (error "Couldn't analyze svn update result"))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
418 (message "Merging changes into %s...done" file)))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
419 |
87518
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
420 (defun vc-svn-modify-change-comment (files rev comment) |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
421 "Modify the change comments for a specified REV. |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
422 You must have ssh access to the repository host, and the directory Emacs |
100144 | 423 uses locally for temp files must also be writable by you on that host. |
93886
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
424 This is only supported if the repository access method is either file:// |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
425 or svn+ssh://." |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
426 (let (tempfile host remotefile directory fileurl-p) |
87518
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
427 (with-temp-buffer |
99782
6be2d2932794
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
99248
diff
changeset
|
428 (vc-do-command (current-buffer) 0 vc-svn-program nil "info") |
93886
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
429 (goto-char (point-min)) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
430 (unless (re-search-forward "Repository Root: \\(file://\\(/.*\\)\\)\\|\\(svn\\+ssh://\\([^/]+\\)\\(/.*\\)\\)" nil t) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
431 (error "Repository information is unavailable")) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
432 (if (match-string 1) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
433 (progn |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
434 (setq fileurl-p t) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
435 (setq directory (match-string 2))) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
436 (setq host (match-string 4)) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
437 (setq directory (match-string 5)) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
438 (setq remotefile (concat host ":" tempfile)))) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
439 (with-temp-file (setq tempfile (make-temp-file user-mail-address)) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
440 (insert comment)) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
441 (if fileurl-p |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
442 ;; Repository Root is a local file. |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
443 (progn |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
444 (unless (vc-do-command |
94847
5e64dca662f0
Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94806
diff
changeset
|
445 "*vc*" 0 "svnadmin" nil |
96003
243cf028ce86
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
446 "setlog" "--bypass-hooks" directory |
93886
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
447 "-r" rev (format "%s" tempfile)) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
448 (error "Log edit failed")) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
449 (delete-file tempfile)) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
450 |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
451 ;; Remote repository, using svn+ssh. |
94847
5e64dca662f0
Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94806
diff
changeset
|
452 (unless (vc-do-command "*vc*" 0 "scp" nil "-q" tempfile remotefile) |
93886
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
453 (error "Copy of comment to %s failed" remotefile)) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
454 (unless (vc-do-command |
94847
5e64dca662f0
Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94806
diff
changeset
|
455 "*vc*" 0 "ssh" nil "-q" host |
93886
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
456 (format "svnadmin setlog --bypass-hooks %s -r %s %s; rm %s" |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
457 directory rev tempfile tempfile)) |
ed131d081eab
(vc-svn-modify-change-comment): Add support for the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93461
diff
changeset
|
458 (error "Log edit failed"))))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
459 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
460 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
461 ;;; History functions |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
462 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
463 |
96003
243cf028ce86
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
464 (defvar log-view-per-file-logs) |
243cf028ce86
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
465 |
95966
054335cbee3d
* log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
95048
diff
changeset
|
466 (define-derived-mode vc-svn-log-view-mode log-view-mode "SVN-Log-View" |
054335cbee3d
* log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
95048
diff
changeset
|
467 (require 'add-log) |
054335cbee3d
* log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
95048
diff
changeset
|
468 (set (make-local-variable 'log-view-per-file-logs) nil)) |
054335cbee3d
* log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
95048
diff
changeset
|
469 |
106472
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106082
diff
changeset
|
470 (defun vc-svn-print-log (files buffer &optional shortlog start-revision limit) |
81968
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
471 "Get change log(s) associated with FILES." |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
472 (save-current-buffer |
55004
ae9b6f1e3bdf
(vc-svn-print-log, vc-svn-diff): Add optional BUFFER arg.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
473 (vc-setup-buffer buffer) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
474 (let ((inhibit-read-only t)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
475 (goto-char (point-min)) |
87426
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
476 (if files |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
477 (dolist (file files) |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
478 (insert "Working file: " file "\n") |
106033
2bed02fa3041
* vc.el (vc-log-show-limit): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105011
diff
changeset
|
479 (apply |
2bed02fa3041
* vc.el (vc-log-show-limit): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105011
diff
changeset
|
480 'vc-svn-command |
87426
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
481 buffer |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
482 'async |
103553
af4ee0cb7fb7
* vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103154
diff
changeset
|
483 ;; (if (and (= (length files) 1) (vc-stay-local-p file 'SVN)) 'async 0) |
87426
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
484 (list file) |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
485 "log" |
106472
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106082
diff
changeset
|
486 (append |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106082
diff
changeset
|
487 (list |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106082
diff
changeset
|
488 (if start-revision |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106082
diff
changeset
|
489 (format "-r%s" start-revision) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106082
diff
changeset
|
490 ;; By default Subversion only shows the log up to the |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106082
diff
changeset
|
491 ;; working revision, whereas we also want the log of the |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106082
diff
changeset
|
492 ;; subsequent commits. At least that's what the |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106082
diff
changeset
|
493 ;; vc-cvs.el code does. |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106082
diff
changeset
|
494 "-rHEAD:0")) |
106846
f243845df25f
(vc-svn-print-log): Use --limit rather than -l since the
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
495 (when limit (list "--limit" (format "%s" limit)))))) |
87426
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
496 ;; Dump log for the entire directory. |
106472
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106082
diff
changeset
|
497 (apply 'vc-svn-command buffer 0 nil "log" |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106082
diff
changeset
|
498 (append |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106082
diff
changeset
|
499 (list |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106082
diff
changeset
|
500 (if start-revision (format "-r%s" start-revision) "-rHEAD:0")) |
106846
f243845df25f
(vc-svn-print-log): Use --limit rather than -l since the
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
501 (when limit (list "--limit" (format "%s" limit))))))))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
502 |
81968
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
503 (defun vc-svn-diff (files &optional oldvers newvers buffer) |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
504 "Get a difference report using SVN between two revisions of fileset FILES." |
101796
0dd7b7766a85
(vc-svn-diff): Revert previous change but add a test
Nick Roberts <nickrob@snap.net.nz>
parents:
101713
diff
changeset
|
505 (and oldvers |
0dd7b7766a85
(vc-svn-diff): Revert previous change but add a test
Nick Roberts <nickrob@snap.net.nz>
parents:
101713
diff
changeset
|
506 (not newvers) |
0dd7b7766a85
(vc-svn-diff): Revert previous change but add a test
Nick Roberts <nickrob@snap.net.nz>
parents:
101713
diff
changeset
|
507 files |
0dd7b7766a85
(vc-svn-diff): Revert previous change but add a test
Nick Roberts <nickrob@snap.net.nz>
parents:
101713
diff
changeset
|
508 (catch 'no |
0dd7b7766a85
(vc-svn-diff): Revert previous change but add a test
Nick Roberts <nickrob@snap.net.nz>
parents:
101713
diff
changeset
|
509 (dolist (f files) |
0dd7b7766a85
(vc-svn-diff): Revert previous change but add a test
Nick Roberts <nickrob@snap.net.nz>
parents:
101713
diff
changeset
|
510 (or (equal oldvers (vc-working-revision f)) |
0dd7b7766a85
(vc-svn-diff): Revert previous change but add a test
Nick Roberts <nickrob@snap.net.nz>
parents:
101713
diff
changeset
|
511 (throw 'no nil))) |
0dd7b7766a85
(vc-svn-diff): Revert previous change but add a test
Nick Roberts <nickrob@snap.net.nz>
parents:
101713
diff
changeset
|
512 t) |
0dd7b7766a85
(vc-svn-diff): Revert previous change but add a test
Nick Roberts <nickrob@snap.net.nz>
parents:
101713
diff
changeset
|
513 ;; Use nil rather than the current revision because svn handles |
0dd7b7766a85
(vc-svn-diff): Revert previous change but add a test
Nick Roberts <nickrob@snap.net.nz>
parents:
101713
diff
changeset
|
514 ;; it better (i.e. locally). Note that if _any_ of the files |
0dd7b7766a85
(vc-svn-diff): Revert previous change but add a test
Nick Roberts <nickrob@snap.net.nz>
parents:
101713
diff
changeset
|
515 ;; has a different revision, we fetch the lot, which is |
0dd7b7766a85
(vc-svn-diff): Revert previous change but add a test
Nick Roberts <nickrob@snap.net.nz>
parents:
101713
diff
changeset
|
516 ;; obviously sub-optimal. |
0dd7b7766a85
(vc-svn-diff): Revert previous change but add a test
Nick Roberts <nickrob@snap.net.nz>
parents:
101713
diff
changeset
|
517 (setq oldvers nil)) |
81968
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
518 (let* ((switches |
56777
332e641fe2b1
(vc-svn-diff): Treat options from vc-svn-diff-switches and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55900
diff
changeset
|
519 (if vc-svn-diff-switches |
332e641fe2b1
(vc-svn-diff): Treat options from vc-svn-diff-switches and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55900
diff
changeset
|
520 (vc-switches 'SVN 'diff) |
100059
18d556e2b8e1
(vc-svn-diff-switches): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
99782
diff
changeset
|
521 (list "--diff-cmd=diff" "-x" |
18d556e2b8e1
(vc-svn-diff-switches): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
99782
diff
changeset
|
522 (mapconcat 'identity (vc-switches nil 'diff) " ")))) |
59446
1ba18e657796
(vc-svn-diff): Don't diff asynchronously if vc-disable-async-diff is
André Spiegel <spiegel@gnu.org>
parents:
59317
diff
changeset
|
523 (async (and (not vc-disable-async-diff) |
103553
af4ee0cb7fb7
* vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103154
diff
changeset
|
524 (vc-stay-local-p files 'SVN) |
86002
613df1ba1584
* vc.el (vc-diff-internal): Make the *vc-diff* buffer read only.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85462
diff
changeset
|
525 (or oldvers newvers)))) ; Svn diffs those locally. |
55004
ae9b6f1e3bdf
(vc-svn-print-log, vc-svn-diff): Add optional BUFFER arg.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
526 (apply 'vc-svn-command buffer |
50922
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
527 (if async 'async 0) |
81968
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
528 files "diff" |
50922
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
529 (append |
56777
332e641fe2b1
(vc-svn-diff): Treat options from vc-svn-diff-switches and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55900
diff
changeset
|
530 switches |
50922
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
531 (when oldvers |
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
532 (list "-r" (if newvers (concat oldvers ":" newvers) |
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
533 oldvers))))) |
50900
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
534 (if async 1 ; async diff => pessimistic assumption |
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
535 ;; For some reason `svn diff' does not return a useful |
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
536 ;; status w.r.t whether the diff was empty or not. |
81968
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
537 (buffer-size (get-buffer buffer))))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
538 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
539 ;;; |
95020
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
540 ;;; Tag system |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
541 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
542 |
95020
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
543 (defun vc-svn-create-tag (dir name branchp) |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
544 "Assign to DIR's current revision a given NAME. |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
545 If BRANCHP is non-nil, the name is created as a branch (and the current |
51732
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
546 workspace is immediately moved to that new branch). |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
547 NAME is assumed to be a URL." |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
548 (vc-svn-command nil 0 dir "copy" name) |
95020
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
549 (when branchp (vc-svn-retrieve-tag dir name nil))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
550 |
95020
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
551 (defun vc-svn-retrieve-tag (dir name update) |
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
552 "Retrieve a tag at and below DIR. |
4da572dc4992
Snapshot primitives globally renamed to refer to tags, documentation updated.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94847
diff
changeset
|
553 NAME is the name of the tag; if it is empty, do a `svn update'. |
51732
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
554 If UPDATE is non-nil, then update (resynch) any affected buffers. |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
555 NAME is assumed to be a URL." |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
556 (vc-svn-command nil 0 dir "switch" name) |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
557 ;; FIXME: parse the output and obey `update'. |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
558 ) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
559 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
560 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
561 ;;; Miscellaneous |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
562 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
563 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
564 ;; Subversion makes backups for us, so don't bother. |
103553
af4ee0cb7fb7
* vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103154
diff
changeset
|
565 ;; (defun vc-svn-make-version-backups-p (file) |
af4ee0cb7fb7
* vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103154
diff
changeset
|
566 ;; "Return non-nil if version backups should be made for FILE." |
af4ee0cb7fb7
* vc-hooks.el (vc-stay-local-p, vc-state, vc-working-revision):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103154
diff
changeset
|
567 ;; (vc-stay-local-p file 'SVN)) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
568 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
569 (defun vc-svn-check-headers () |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
570 "Check if the current file has any headers in it." |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
571 (save-excursion |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
572 (goto-char (point-min)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
573 (re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\ |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
574 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
575 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
576 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
577 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
578 ;;; Internal functions |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
579 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
580 |
81968
1b5dfd1b9ca0
Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
81617
diff
changeset
|
581 (defun vc-svn-command (buffer okstatus file-or-list &rest flags) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
582 "A wrapper around `vc-do-command' for use in vc-svn.el. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
583 The difference to vc-do-command is that this function always invokes `svn', |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
584 and that it passes `vc-svn-global-switches' to it before FLAGS." |
94847
5e64dca662f0
Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94806
diff
changeset
|
585 (apply 'vc-do-command (or buffer "*vc*") okstatus vc-svn-program file-or-list |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
586 (if (stringp vc-svn-global-switches) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
587 (cons vc-svn-global-switches flags) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
588 (append vc-svn-global-switches |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
589 flags)))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
590 |
50927
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
591 (defun vc-svn-repository-hostname (dirname) |
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
592 (with-temp-buffer |
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
593 (let ((coding-system-for-read |
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
594 (or file-name-coding-system |
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
595 default-file-name-coding-system))) |
73848
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
596 (vc-insert-file (expand-file-name (concat vc-svn-admin-directory |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
597 "/entries") |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
598 dirname))) |
50927
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
599 (goto-char (point-min)) |
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
600 (when (re-search-forward |
75233
e52e99fc4ca5
(vc-svn-parse-status): Trust the filename argument more
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
73848
diff
changeset
|
601 ;; Old `svn' used name="svn:this_dir", newer use just name="". |
58929
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
602 (concat "name=\"\\(?:svn:this_dir\\)?\"[\n\t ]*" |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
603 "\\(?:[-a-z]+=\"[^\"]*\"[\n\t ]*\\)*?" |
81617
0a2fb180b0a5
(vc-svn-repository-hostname): Adjust to non-XML format of newer .svn/entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81306
diff
changeset
|
604 "url=\"\\(?1:[^\"]+\\)\"" |
0a2fb180b0a5
(vc-svn-repository-hostname): Adjust to non-XML format of newer .svn/entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81306
diff
changeset
|
605 ;; Yet newer ones don't use XML any more. |
0a2fb180b0a5
(vc-svn-repository-hostname): Adjust to non-XML format of newer .svn/entries.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81306
diff
changeset
|
606 "\\|^\ndir\n[0-9]+\n\\(?1:.*\\)") nil t) |
58929
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
607 ;; This is not a hostname but a URL. This may actually be considered |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
608 ;; as a feature since it allows vc-svn-stay-local to specify different |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
609 ;; behavior for different modules on the same server. |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
610 (match-string 1)))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
611 |
78914
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
612 (defun vc-svn-resolve-when-done () |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
613 "Call \"svn resolved\" if the conflict markers have been removed." |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
614 (save-excursion |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
615 (goto-char (point-min)) |
79848
316ed7573095
* vc-arch.el (vc-arch-delete-rej-if-obsolete): Remove the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79721
diff
changeset
|
616 (unless (re-search-forward "^<<<<<<< " nil t) |
316ed7573095
* vc-arch.el (vc-arch-delete-rej-if-obsolete): Remove the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79721
diff
changeset
|
617 (vc-svn-command nil 0 buffer-file-name "resolved") |
316ed7573095
* vc-arch.el (vc-arch-delete-rej-if-obsolete): Remove the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79721
diff
changeset
|
618 ;; Remove the hook so that it is not called multiple times. |
316ed7573095
* vc-arch.el (vc-arch-delete-rej-if-obsolete): Remove the
Dan Nicolaescu <dann@ics.uci.edu>
parents:
79721
diff
changeset
|
619 (remove-hook 'after-save-hook 'vc-svn-resolve-when-done t)))) |
78914
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
620 |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
621 ;; Inspired by vc-arch-find-file-hook. |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
622 (defun vc-svn-find-file-hook () |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
623 (when (eq ?C (vc-file-getprop buffer-file-name 'vc-svn-status)) |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
624 ;; If the file is marked as "conflicted", then we should try and call |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
625 ;; "svn resolved" when applicable. |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
626 (if (save-excursion |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
627 (goto-char (point-min)) |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
628 (re-search-forward "^<<<<<<< " nil t)) |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
629 ;; There are conflict markers. |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
630 (progn |
87785
8f1628da223f
* smerge-mode.el (smerge-start-session): Rename from smerge-auto.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87743
diff
changeset
|
631 (smerge-start-session) |
78914
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
632 (add-hook 'after-save-hook 'vc-svn-resolve-when-done nil t)) |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
633 ;; There are no conflict markers. This is problematic: maybe it means |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
634 ;; the conflict has been resolved and we should immediately call "svn |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
635 ;; resolved", or it means that the file's type does not allow Svn to |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
636 ;; use conflict markers in which case we don't really know what to do. |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
637 ;; So let's just punt for now. |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
638 nil) |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
639 (message "There are unresolved conflicts in this file"))) |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
640 |
73444
ee7eeb5732b2
(vc-svn-parse-status): Remove unused arg `localp'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68740
diff
changeset
|
641 (defun vc-svn-parse-status (&optional filename) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
642 "Parse output of \"svn status\" command in the current buffer. |
73444
ee7eeb5732b2
(vc-svn-parse-status): Remove unused arg `localp'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68740
diff
changeset
|
643 Set file properties accordingly. Unless FILENAME is non-nil, parse only |
ee7eeb5732b2
(vc-svn-parse-status): Remove unused arg `localp'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68740
diff
changeset
|
644 information about FILENAME and return its status." |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
645 (let (file status) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
646 (goto-char (point-min)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
647 (while (re-search-forward |
87477
b5060e79eb98
* vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87450
diff
changeset
|
648 ;; Ignore the files with status X. |
97336
701c14eb5b26
(vc-svn-parse-status): Use when instead of if.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96257
diff
changeset
|
649 "^\\(?:\\?\\|[ ACDGIMR!~][ MC][ L][ +][ S]..\\([ *]\\) +\\([-0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\)\\) +" nil t) |
75233
e52e99fc4ca5
(vc-svn-parse-status): Trust the filename argument more
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
73848
diff
changeset
|
650 ;; If the username contains spaces, the output format is ambiguous, |
e52e99fc4ca5
(vc-svn-parse-status): Trust the filename argument more
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
73848
diff
changeset
|
651 ;; so don't trust the output's filename unless we have to. |
e52e99fc4ca5
(vc-svn-parse-status): Trust the filename argument more
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
73848
diff
changeset
|
652 (setq file (or filename |
e52e99fc4ca5
(vc-svn-parse-status): Trust the filename argument more
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
73848
diff
changeset
|
653 (expand-file-name |
e52e99fc4ca5
(vc-svn-parse-status): Trust the filename argument more
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
73848
diff
changeset
|
654 (buffer-substring (point) (line-end-position))))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
655 (setq status (char-after (line-beginning-position))) |
87477
b5060e79eb98
* vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87450
diff
changeset
|
656 (if (eq status ??) |
87514
5c7eec3035ec
Remove some debugging code.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87513
diff
changeset
|
657 (vc-file-setprop file 'vc-state 'unregistered) |
50900
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
658 ;; Use the last-modified revision, so that searching in vc-print-log |
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
659 ;; output works. |
87514
5c7eec3035ec
Remove some debugging code.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87513
diff
changeset
|
660 (vc-file-setprop file 'vc-working-revision (match-string 3)) |
78914
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
661 ;; Remember Svn's own status. |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
662 (vc-file-setprop file 'vc-svn-status status) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
663 (vc-file-setprop |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
664 file 'vc-state |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
665 (cond |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
666 ((eq status ?\ ) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
667 (if (eq (char-after (match-beginning 1)) ?*) |
94521
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94519
diff
changeset
|
668 'needs-update |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
669 (vc-file-setprop file 'vc-checkout-time |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
670 (nth 5 (file-attributes file))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
671 'up-to-date)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
672 ((eq status ?A) |
50900
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
673 ;; If the file was actually copied, (match-string 2) is "-". |
87514
5c7eec3035ec
Remove some debugging code.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87513
diff
changeset
|
674 (vc-file-setprop file 'vc-working-revision "0") |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
675 (vc-file-setprop file 'vc-checkout-time 0) |
87477
b5060e79eb98
* vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87450
diff
changeset
|
676 'added) |
93956
bfc762f0b49c
* vc-hooks.el (vc-state): Add new state `conflict'.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93886
diff
changeset
|
677 ((eq status ?C) |
bfc762f0b49c
* vc-hooks.el (vc-state): Add new state `conflict'.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93886
diff
changeset
|
678 (vc-file-setprop file 'vc-state 'conflict)) |
bfc762f0b49c
* vc-hooks.el (vc-state): Add new state `conflict'.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93886
diff
changeset
|
679 ((eq status '?M) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
680 (if (eq (char-after (match-beginning 1)) ?*) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
681 'needs-merge |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
682 'edited)) |
87450
71fc7b1db920
* vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87449
diff
changeset
|
683 ((eq status ?I) |
87514
5c7eec3035ec
Remove some debugging code.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87513
diff
changeset
|
684 (vc-file-setprop file 'vc-state 'ignored)) |
103154
276b0724ed86
(vc-svn-parse-status): Accept ?D for removed files (bug#3213).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102974
diff
changeset
|
685 ((memq status '(?D ?R)) |
87514
5c7eec3035ec
Remove some debugging code.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87513
diff
changeset
|
686 (vc-file-setprop file 'vc-state 'removed)) |
73444
ee7eeb5732b2
(vc-svn-parse-status): Remove unused arg `localp'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68740
diff
changeset
|
687 (t 'edited))))) |
97336
701c14eb5b26
(vc-svn-parse-status): Use when instead of if.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96257
diff
changeset
|
688 (when filename (vc-file-getprop filename 'vc-state)))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
689 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
690 (defun vc-svn-valid-symbolic-tag-name-p (tag) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
691 "Return non-nil if TAG is a valid symbolic tag name." |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
692 ;; According to the SVN manual, a valid symbolic tag must start with |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
693 ;; an uppercase or lowercase letter and can contain uppercase and |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
694 ;; lowercase letters, digits, `-', and `_'. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
695 (and (string-match "^[a-zA-Z]" tag) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
696 (not (string-match "[^a-z0-9A-Z-_]" tag)))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
697 |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
698 (defun vc-svn-valid-revision-number-p (tag) |
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
699 "Return non-nil if TAG is a valid revision number." |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
700 (and (string-match "^[0-9]" tag) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
701 (not (string-match "[^0-9]" tag)))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
702 |
58929
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
703 ;; Support for `svn annotate' |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
704 |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
705 (defun vc-svn-annotate-command (file buf &optional rev) |
105011
8acc6fb9ffc9
* vc-mtn.el (vc-mtn-annotate-command):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105010
diff
changeset
|
706 (vc-svn-command buf 'async file "annotate" (if rev (concat "-r" rev)))) |
58929
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
707 |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
708 (defun vc-svn-annotate-time-of-rev (rev) |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
709 ;; Arbitrarily assume 10 commmits per day. |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
710 (/ (string-to-number rev) 10.0)) |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
711 |
96252
8c22ce277d5d
(vc-annotate-parent-rev): Pacify byte compiler.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96003
diff
changeset
|
712 (defvar vc-annotate-parent-rev) |
8c22ce277d5d
(vc-annotate-parent-rev): Pacify byte compiler.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96003
diff
changeset
|
713 |
58929
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
714 (defun vc-svn-annotate-current-time () |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
715 (vc-svn-annotate-time-of-rev vc-annotate-parent-rev)) |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
716 |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
717 (defconst vc-svn-annotate-re "[ \t]*\\([0-9]+\\)[ \t]+[^\t ]+ ") |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
718 |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
719 (defun vc-svn-annotate-time () |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
720 (when (looking-at vc-svn-annotate-re) |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
721 (goto-char (match-end 0)) |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
722 (vc-svn-annotate-time-of-rev (match-string 1)))) |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
723 |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
724 (defun vc-svn-annotate-extract-revision-at-line () |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
725 (save-excursion |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
726 (beginning-of-line) |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
727 (if (looking-at vc-svn-annotate-re) (match-string 1)))) |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
728 |
107095
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
729 (defun vc-svn-revision-table (files) |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
730 (let ((vc-svn-revisions '())) |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
731 (with-current-buffer "*vc*" |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
732 (vc-svn-command nil 0 files "log" "-q") |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
733 (goto-char (point-min)) |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
734 (forward-line) |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
735 (let ((start (point-min)) |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
736 (loglines (buffer-substring-no-properties (point-min) |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
737 (point-max)))) |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
738 (while (string-match "^r\\([0-9]+\\) " loglines) |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
739 (push (match-string 1 loglines) vc-svn-revisions) |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
740 (setq start (+ start (match-end 0))) |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
741 (setq loglines (buffer-substring-no-properties start (point-max))))) |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
742 vc-svn-revisions))) |
d1489c6b5705
add primative implementation of vc-svn-revision-table
Mark A. Hershberger <mah@everybody.org>
parents:
107020
diff
changeset
|
743 |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
744 (provide 'vc-svn) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
745 |
56777
332e641fe2b1
(vc-svn-diff): Treat options from vc-svn-diff-switches and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55900
diff
changeset
|
746 ;; arch-tag: 02f10c68-2b4d-453a-90fc-1eee6cfb268d |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
747 ;;; vc-svn.el ends here |