Mercurial > emacs
annotate lisp/vc-svn.el @ 87718:126248279847
*** empty log message ***
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Fri, 11 Jan 2008 17:30:52 +0000 |
parents | 5947c9dc7f6b |
children | c2a952d12e21 |
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 |
79721 | 3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
4 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
5 ;; Author: FSF (see vc.el for full credits) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
6 ;; Maintainer: Stefan Monnier <monnier@gnu.org> |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
7 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
9 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
10 ;; GNU Emacs is free software; you can redistribute it and/or modify |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
78236
9355f9b7bbff
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
76025
diff
changeset
|
12 ;; the Free Software Foundation; either version 3, or (at your option) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
13 ;; any later version. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
14 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
15 ;; 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
|
16 ;; 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
|
17 ;; 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
|
18 ;; GNU General Public License for more details. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
19 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64091 | 22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
23 ;; Boston, MA 02110-1301, USA. | |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
24 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
25 ;;; Commentary: |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
26 |
85122
c2cc930bdd9e
This is the actual fix....
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85114
diff
changeset
|
27 ;; 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
|
28 ;; 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
|
29 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
30 ;;; Code: |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
31 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
32 (eval-when-compile |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
33 (require 'vc)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
34 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
35 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
36 ;;; Customization options |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
37 ;;; |
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 (defcustom vc-svn-global-switches nil |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
40 "*Global switches to pass to any SVN command." |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
41 :type '(choice (const :tag "None" nil) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
42 (string :tag "Argument String") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
43 (repeat :tag "Argument List" |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
44 :value ("") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
45 string)) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59446
diff
changeset
|
46 :version "22.1" |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
47 :group 'vc) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
48 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
49 (defcustom vc-svn-register-switches nil |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
50 "*Extra switches for registering a file into SVN. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
51 A string or list of strings passed to the checkin program by |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
52 \\[vc-register]." |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
53 :type '(choice (const :tag "None" nil) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
54 (string :tag "Argument String") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
55 (repeat :tag "Argument List" |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
56 :value ("") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
57 string)) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59446
diff
changeset
|
58 :version "22.1" |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
59 :group 'vc) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
60 |
52033
9b5f3940a1ef
(vc-svn-diff-switches): Don't default to vc-diff-switches.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51732
diff
changeset
|
61 (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
|
62 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
|
63 "String or list of strings specifying extra switches for svn diff under VC. |
9b5f3940a1ef
(vc-svn-diff-switches): Don't default to vc-diff-switches.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51732
diff
changeset
|
64 If nil, use the value of `vc-diff-switches'. |
9b5f3940a1ef
(vc-svn-diff-switches): Don't default to vc-diff-switches.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51732
diff
changeset
|
65 If you want to force an empty list of arguments, use t." |
9b5f3940a1ef
(vc-svn-diff-switches): Don't default to vc-diff-switches.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51732
diff
changeset
|
66 :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
|
67 (const :tag "None" t) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
68 (string :tag "Argument String") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
69 (repeat :tag "Argument List" |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
70 :value ("") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
71 string)) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59446
diff
changeset
|
72 :version "22.1" |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
73 :group 'vc) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
74 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
75 (defcustom vc-svn-header (or (cdr (assoc 'SVN vc-header-alist)) '("\$Id\$")) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
76 "*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
|
77 :version "22.1" |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
78 :type '(repeat string) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
79 :group 'vc) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
80 |
76025
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
81 ;; 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
|
82 ;; 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
|
83 ;; at dump time. |
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
84 ;; ;;;###autoload |
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
85 (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
|
86 (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
|
87 (getenv "SVN_ASP_DOT_NET_HACK")) |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
88 "_svn") |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
89 (t ".svn")) |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
90 "The name of the \".svn\" subdirectory or its equivalent.") |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
91 |
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
|
92 ;;; 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
|
93 |
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
|
94 (defun vc-svn-revision-granularity () |
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
|
95 'repository) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
96 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
97 ;;; State-querying functions |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
98 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
99 |
73848
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
100 ;;; 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
|
101 ;;; autoloaded function is called. |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
102 |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
103 ;;;###autoload (defun vc-svn-registered (f) |
73848
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
104 ;;;###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
|
105 ;;;###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
|
106 ;;;###autoload "_svn") |
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
107 ;;;###autoload (t ".svn")))) |
73848
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
108 ;;;###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
|
109 ;;;###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
|
110 ;;;###autoload (file-name-directory f))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
111 ;;;###autoload (load "vc-svn") |
73848
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
112 ;;;###autoload (vc-svn-registered f)))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
113 |
50999
c09edac18f97
(completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50927
diff
changeset
|
114 ;;;###autoload |
c09edac18f97
(completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50927
diff
changeset
|
115 (add-to-list 'completion-ignored-extensions ".svn/") |
c09edac18f97
(completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50927
diff
changeset
|
116 |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
117 (defun vc-svn-registered (file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
118 "Check if FILE is SVN registered." |
73848
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
119 (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
|
120 "/entries") |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
121 (file-name-directory file))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
122 (with-temp-buffer |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
123 (cd (file-name-directory file)) |
68651
3bd95f4f2941
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
67553
diff
changeset
|
124 (let ((status |
67553
10707dfc70f3
(vc-svn-registered): Use it to avoid popping up a spurious
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67547
diff
changeset
|
125 (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
|
126 ;; 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
|
127 (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
|
128 ;; 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
|
129 ;; 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
|
130 ;; 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
|
131 ;; 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
|
132 ;; 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
|
133 (error nil)))) |
10707dfc70f3
(vc-svn-registered): Use it to avoid popping up a spurious
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
67547
diff
changeset
|
134 (when (eq 0 status) |
87695
5947c9dc7f6b
(vc-svn-registered): Return the correct value for
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
135 (not (memq (vc-svn-parse-status file) |
5947c9dc7f6b
(vc-svn-registered): Return the correct value for
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
136 '(ignored unregistered)))))))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
137 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
138 (defun vc-svn-state (file &optional localp) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
139 "SVN-specific version of `vc-state'." |
50927
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
140 (setq localp (or localp (vc-stay-local-p file))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
141 (with-temp-buffer |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
142 (cd (file-name-directory file)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
143 (vc-svn-command t 0 file "status" (if localp "-v" "-u")) |
73444
ee7eeb5732b2
(vc-svn-parse-status): Remove unused arg `localp'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68740
diff
changeset
|
144 (vc-svn-parse-status file))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
145 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
146 (defun vc-svn-state-heuristic (file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
147 "SVN-specific state heuristic." |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
148 (vc-svn-state file 'local)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
149 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
150 (defun vc-svn-dir-state (dir &optional localp) |
87424
c0ee02a9ac55
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
86002
diff
changeset
|
151 "Find the SVN state of all files in DIR and its subdirectories." |
50927
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
152 (setq localp (or localp (vc-stay-local-p dir))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
153 (let ((default-directory dir)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
154 ;; Don't specify DIR in this command, the default-directory is |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
155 ;; enough. Otherwise it might fail with remote repositories. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
156 (with-temp-buffer |
87442
c5df210848ca
* vc-bzr.el, vc-cvs.el, vc-git.el, vc-hg.el, vc-mcvs.el, vc-svn.el:
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87426
diff
changeset
|
157 (buffer-disable-undo) ;; Because these buffers can get huge |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
158 (vc-svn-command t 0 nil "status" (if localp "-v" "-u")) |
73444
ee7eeb5732b2
(vc-svn-parse-status): Remove unused arg `localp'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68740
diff
changeset
|
159 (vc-svn-parse-status)))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
160 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
161 (defun vc-svn-working-revision (file) |
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
162 "SVN-specific version of `vc-working-revision'." |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
163 ;; 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
|
164 ;; 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
|
165 ;; is registered in SVN. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
166 (vc-svn-registered file) |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
167 (vc-file-getprop file 'vc-working-revision)) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
168 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
169 (defun vc-svn-checkout-model (file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
170 "SVN-specific version of `vc-checkout-model'." |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
171 ;; It looks like Subversion has no equivalent of CVSREAD. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
172 'implicit) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
173 |
51732
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
174 ;; 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
|
175 ;; works just fine. |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
176 |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
177 (defun vc-svn-dired-state-info (file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
178 "SVN-specific version of `vc-dired-state-info'." |
50900
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
179 (let ((svn-state (vc-state file))) |
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
180 (cond ((eq svn-state 'edited) |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
181 (if (equal (vc-working-revision file) "0") |
50900
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
182 "(added)" "(modified)")) |
87449
7477a697d7e1
* vc-cvs.el, vc-svn.el: Simplify backend dired-state-info
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87442
diff
changeset
|
183 (t |
7477a697d7e1
* vc-cvs.el, vc-svn.el: Simplify backend dired-state-info
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87442
diff
changeset
|
184 ;; fall back to the default VC representation |
7477a697d7e1
* vc-cvs.el, vc-svn.el: Simplify backend dired-state-info
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87442
diff
changeset
|
185 (vc-default-dired-state-info 'SVN file))))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
186 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
187 |
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
|
188 (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
|
189 (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
|
190 (when (< 0 newrev) |
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
191 (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
|
192 |
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
|
193 (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
|
194 (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
|
195 ;; 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
|
196 ;; 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
|
197 ;; 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
|
198 ;; 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
|
199 ;; 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
|
200 ;; from gracious to impolite. |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
201 (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
|
202 newrev) |
61cc95860e05
(vc-svn-previous-version, vc-svn-next-version): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
68651
diff
changeset
|
203 (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
|
204 |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
205 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
206 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
207 ;;; State-changing functions |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
208 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
209 |
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
|
210 (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
|
211 "Create a new SVN repository." |
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
|
212 (vc-do-command nil 0 "svnadmin" '("create" "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
|
213 (vc-do-command nil 0 "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
|
214 "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
|
215 |
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
|
216 (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
|
217 "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
|
218 The COMMENT argument is ignored This does an add but not a commit. |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
219 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
220 `vc-register-switches' and `vc-svn-register-switches' are passed to |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
221 the SVN command (in that order)." |
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
|
222 (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
|
223 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
224 (defun vc-svn-responsible-p (file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
225 "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
|
226 (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
|
227 (if (file-directory-p file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
228 file |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
229 (file-name-directory file))))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
230 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
231 (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
|
232 "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
|
233 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
|
234 |
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
|
235 (defun vc-svn-checkin (files rev comment) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
236 "SVN-specific version of `vc-backend-checkin'." |
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
|
237 (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
|
238 (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
|
239 '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
|
240 (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
|
241 (set-buffer "*vc*") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
242 (goto-char (point-min)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
243 (unless (equal status 0) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
244 ;; Check checkin problem. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
245 (cond |
50900
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
246 ((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
|
247 (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
|
248 files) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
249 (error (substitute-command-keys |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
250 (concat "Up-to-date check failed: " |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
251 "type \\[vc-next-action] to merge in changes")))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
252 (t |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
253 (pop-to-buffer (current-buffer)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
254 (goto-char (point-min)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
255 (shrink-window-if-larger-than-buffer) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
256 (error "Check-in failed")))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
257 ;; Update file properties |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
258 ;; (vc-file-setprop |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
259 ;; file 'vc-working-revision |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
260 ;; (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
|
261 )) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
262 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
263 (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
|
264 "SVN-specific retrieval of a specified version into a buffer." |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
265 (apply 'vc-svn-command |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
266 buffer 0 file |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
267 "cat" |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
268 (and rev (not (string= rev "")) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
269 (concat "-r" rev)) |
50900
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
270 (vc-switches 'SVN 'checkout))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
271 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
272 (defun vc-svn-checkout (file &optional editable rev) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
273 (message "Checking out %s..." file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
274 (with-current-buffer (or (get-file-buffer file) (current-buffer)) |
50900
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
275 (vc-call update file editable rev (vc-switches 'SVN 'checkout))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
276 (vc-mode-line file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
277 (message "Checking out %s...done" file)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
278 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
279 (defun vc-svn-update (file editable rev switches) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
280 (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
|
281 ;; 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
|
282 nil |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
283 ;; Check out a particular version (or recreate the file). |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
284 (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
|
285 (apply 'vc-svn-command nil 0 file |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
286 "update" |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
287 ;; default for verbose checkout: clear the sticky tag so |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
288 ;; that the actual update will get the head of the trunk |
51732
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
289 (cond |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
290 ((null rev) "-rBASE") |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
291 ((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
|
292 (t (concat "-r" rev))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
293 switches))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
294 |
50999
c09edac18f97
(completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50927
diff
changeset
|
295 (defun vc-svn-delete-file (file) |
c09edac18f97
(completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50927
diff
changeset
|
296 (vc-svn-command nil 0 file "remove")) |
c09edac18f97
(completion-ignored-extensions): Add .svn.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50927
diff
changeset
|
297 |
50922
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
298 (defun vc-svn-rename-file (old new) |
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
299 (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
|
300 |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
301 (defun vc-svn-revert (file &optional contents-done) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
302 "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
|
303 (unless contents-done |
76025
a4103f62dec5
Remove the code inherited from CVSREAD and `cvs edit'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
75719
diff
changeset
|
304 (vc-svn-command nil 0 file "revert"))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
305 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
306 (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
|
307 "Merge changes into current working copy of FILE. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
308 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
|
309 (vc-svn-command nil 0 file |
50822
0be6233722ec
(vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50821
diff
changeset
|
310 "merge" |
50823
83c8010f1eb2
(vc-svn-merge): Forgot quotes.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50822
diff
changeset
|
311 "-r" (if second-version |
50822
0be6233722ec
(vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50821
diff
changeset
|
312 (concat first-version ":" second-version) |
0be6233722ec
(vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50821
diff
changeset
|
313 first-version)) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
314 (vc-file-setprop file 'vc-state 'edited) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
315 (with-current-buffer (get-buffer "*vc*") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
316 (goto-char (point-min)) |
50822
0be6233722ec
(vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50821
diff
changeset
|
317 (if (looking-at "C ") |
0be6233722ec
(vc-svn-merge): First attempt.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50821
diff
changeset
|
318 1 ; signal conflict |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
319 0))) ; signal success |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
320 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
321 (defun vc-svn-merge-news (file) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
322 "Merge in any new changes made to FILE." |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
323 (message "Merging changes into %s..." file) |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
324 ;; (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
|
325 (vc-file-setprop file 'vc-checkout-time 0) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
326 (vc-svn-command nil 0 file "update") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
327 ;; 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
|
328 ;; file properties accordingly. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
329 (with-current-buffer (get-buffer "*vc*") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
330 (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
|
331 ;; get new working revision |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
332 (if (re-search-forward |
50821
33e415a24bb5
(vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50820
diff
changeset
|
333 "^\\(Updated to\\|At\\) revision \\([0-9]+\\)" nil t) |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
334 (vc-file-setprop file 'vc-working-revision (match-string 2)) |
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 ;; get file status |
50821
33e415a24bb5
(vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50820
diff
changeset
|
337 (goto-char (point-min)) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
338 (prog1 |
50821
33e415a24bb5
(vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50820
diff
changeset
|
339 (if (looking-at "At revision") |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
340 0 ;; there were no news; indicate success |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
341 (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
|
342 ;; 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
|
343 ;; 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
|
344 ;; 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
|
345 ;; 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
|
346 ;; 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
|
347 (concat "^\\(\\([ACGDU]\\)\\(.[B ]\\)? \\)" |
50821
33e415a24bb5
(vc-svn-merge-news): Adjust for subversion.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50820
diff
changeset
|
348 (regexp-quote (file-name-nondirectory file))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
349 nil t) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
350 (cond |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
351 ;; 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
|
352 ((string= (match-string 2) "U") |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
353 (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
|
354 (vc-file-setprop file 'vc-checkout-time |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
355 (nth 5 (file-attributes file))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
356 0);; indicate success to the caller |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
357 ;; 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
|
358 ((string= (match-string 2) "G") |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
359 (vc-file-setprop file 'vc-state 'edited) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
360 0);; indicate success to the caller |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
361 ;; Conflicts detected! |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
362 (t |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
363 (vc-file-setprop file 'vc-state 'edited) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
364 1);; signal the error to the caller |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
365 ) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
366 (pop-to-buffer "*vc*") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
367 (error "Couldn't analyze svn update result"))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
368 (message "Merging changes into %s...done" file)))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
369 |
87518
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
370 (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
|
371 "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
|
372 You must have ssh access to the repository host, and the directory Emacs |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
373 uses locally for temp files must also be writeable by you on that host." |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
374 (vc-do-command nil 0 "svn" nil "info") |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
375 (set-buffer "*vc*") |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
376 (goto-char (point-min)) |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
377 (unless (re-search-forward "Repository Root: svn\\+ssh://\\([^/]+\\)\\(/.*\\)" nil t) |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
378 (error "Repository information is unavailable.")) |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
379 (let* ((tempfile (make-temp-file user-mail-address)) |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
380 (host (match-string 1)) |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
381 (directory (match-string 2)) |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
382 (remotefile (concat host ":" tempfile))) |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
383 (with-temp-buffer |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
384 (insert comment) |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
385 (write-region (point-min) (point-max) tempfile)) |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
386 (unless (vc-do-command nil 0 "scp" nil "-q" tempfile remotefile) |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
387 (error "Copy of comment to %s failed" remotefile)) |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
388 (unless (vc-do-command nil 0 "ssh" nil |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
389 "-q" host |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
390 (format "svnadmin setlog --bypass-hooks %s -r %s %s; rm %s" |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
391 directory rev tempfile tempfile)) |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
392 (error "Log edit failed")) |
78fc69cc7bef
* vc-svn.el (vc-svn-modify-change comment): New function.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87514
diff
changeset
|
393 )) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
394 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
395 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
396 ;;; History functions |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
397 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
398 |
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
|
399 (defun vc-svn-print-log (files &optional buffer) |
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
|
400 "Get change log(s) associated with FILES." |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
401 (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
|
402 (vc-setup-buffer buffer) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
403 (let ((inhibit-read-only t)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
404 (goto-char (point-min)) |
87426
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
405 (if files |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
406 (dolist (file files) |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
407 (insert "Working file: " file "\n") |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
408 (vc-svn-command |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
409 buffer |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
410 'async |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
411 ;; (if (and (= (length files) 1) (vc-stay-local-p file)) 'async 0) |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
412 (list file) |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
413 "log" |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
414 ;; By default Subversion only shows the log up to the |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
415 ;; working revision, whereas we also want the log of the |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
416 ;; subsequent commits. At least that's what the |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
417 ;; vc-cvs.el code does. |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
418 "-rHEAD:0")) |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
419 ;; Dump log for the entire directory. |
47c02bd68801
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
420 (vc-svn-command buffer 0 nil "log" "-rHEAD:0"))))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
421 |
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
|
422 (defun vc-svn-wash-log () |
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
|
423 "Remove all non-comment information from log output." |
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
|
424 ;; FIXME: not implemented for 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
|
425 nil) |
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
|
426 |
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
|
427 (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
|
428 "Get a difference report using SVN between two revisions of fileset FILES." |
82909
01df6fb7c1e7
(vc-svn-diff): If the repository version of all the files is the same
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
429 (and oldvers |
01df6fb7c1e7
(vc-svn-diff): If the repository version of all the files is the same
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
430 (catch 'no |
01df6fb7c1e7
(vc-svn-diff): If the repository version of all the files is the same
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
431 (dolist (f files) |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85122
diff
changeset
|
432 (or (equal oldvers (vc-working-revision f)) |
82909
01df6fb7c1e7
(vc-svn-diff): If the repository version of all the files is the same
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
433 (throw 'no nil))) |
01df6fb7c1e7
(vc-svn-diff): If the repository version of all the files is the same
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
434 t) |
01df6fb7c1e7
(vc-svn-diff): If the repository version of all the files is the same
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
435 ;; Use nil rather than the current revision because svn handles |
01df6fb7c1e7
(vc-svn-diff): If the repository version of all the files is the same
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
436 ;; it better (i.e. locally). Note that if _any_ of the files |
01df6fb7c1e7
(vc-svn-diff): If the repository version of all the files is the same
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
437 ;; has a different revision, we fetch the lot, which is |
01df6fb7c1e7
(vc-svn-diff): If the repository version of all the files is the same
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
438 ;; obviously sub-optimal. |
01df6fb7c1e7
(vc-svn-diff): If the repository version of all the files is the same
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
439 (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
|
440 (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
|
441 (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
|
442 (vc-switches 'SVN 'diff) |
332e641fe2b1
(vc-svn-diff): Treat options from vc-svn-diff-switches and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55900
diff
changeset
|
443 (list "-x" (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
|
444 (async (and (not vc-disable-async-diff) |
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
|
445 (vc-stay-local-p files) |
86002
613df1ba1584
* vc.el (vc-diff-internal): Make the *vc-diff* buffer read only.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85462
diff
changeset
|
446 (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
|
447 (apply 'vc-svn-command buffer |
50922
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
448 (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
|
449 files "diff" |
50922
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
450 (append |
56777
332e641fe2b1
(vc-svn-diff): Treat options from vc-svn-diff-switches and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55900
diff
changeset
|
451 switches |
50922
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
452 (when oldvers |
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
453 (list "-r" (if newvers (concat oldvers ":" newvers) |
bdc62a6694f7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50900
diff
changeset
|
454 oldvers))))) |
50900
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
455 (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
|
456 ;; 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
|
457 ;; 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
|
458 (buffer-size (get-buffer buffer))))) |
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 ;;; Snapshot system |
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 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
464 (defun vc-svn-create-snapshot (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
|
465 "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
|
466 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
|
467 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
|
468 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
|
469 (vc-svn-command nil 0 dir "copy" name) |
f43bd5204ab4
(vc-svn-use-edit): Make it into a const.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50999
diff
changeset
|
470 (when branchp (vc-svn-retrieve-snapshot dir name nil))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
471 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
472 (defun vc-svn-retrieve-snapshot (dir name update) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
473 "Retrieve a snapshot at and below DIR. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
474 NAME is the name of the snapshot; 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
|
475 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
|
476 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
|
477 (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
|
478 ;; 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
|
479 ) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
480 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
481 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
482 ;;; Miscellaneous |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
483 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
484 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
485 ;; Subversion makes backups for us, so don't bother. |
50927
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
486 ;; (defalias 'vc-svn-make-version-backups-p 'vc-stay-local-p |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
487 ;; "Return non-nil if version backups should be made for FILE.") |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
488 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
489 (defun vc-svn-check-headers () |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
490 "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
|
491 (save-excursion |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
492 (goto-char (point-min)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
493 (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
|
494 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
495 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
496 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
497 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
498 ;;; Internal functions |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
499 ;;; |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
500 |
81306
114ec88248f4
(vc-svn-program): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
76025
diff
changeset
|
501 (defcustom vc-svn-program "svn" |
114ec88248f4
(vc-svn-program): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
76025
diff
changeset
|
502 "Name of the svn executable." |
114ec88248f4
(vc-svn-program): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
76025
diff
changeset
|
503 :type 'string |
114ec88248f4
(vc-svn-program): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
76025
diff
changeset
|
504 :group 'vc) |
114ec88248f4
(vc-svn-program): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
76025
diff
changeset
|
505 |
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
|
506 (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
|
507 "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
|
508 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
|
509 and that it passes `vc-svn-global-switches' to it before FLAGS." |
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
|
510 (apply 'vc-do-command buffer okstatus vc-svn-program file-or-list |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
511 (if (stringp vc-svn-global-switches) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
512 (cons vc-svn-global-switches flags) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
513 (append vc-svn-global-switches |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
514 flags)))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
515 |
50927
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
516 (defun vc-svn-repository-hostname (dirname) |
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
517 (with-temp-buffer |
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
518 (let ((coding-system-for-read |
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
519 (or file-name-coding-system |
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
520 default-file-name-coding-system))) |
73848
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
521 (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
|
522 "/entries") |
299d3322c8be
Fix typo in previous commit.
Chong Yidong <cyd@stupidchicken.com>
parents:
73847
diff
changeset
|
523 dirname))) |
50927
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
524 (goto-char (point-min)) |
6f478e2878c7
(vc-svn-rename-file): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50922
diff
changeset
|
525 (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
|
526 ;; 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
|
527 (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
|
528 "\\(?:[-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
|
529 "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
|
530 ;; 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
|
531 "\\|^\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
|
532 ;; 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
|
533 ;; 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
|
534 ;; 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
|
535 (match-string 1)))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
536 |
78914
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
537 (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
|
538 "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
|
539 (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
|
540 (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
|
541 (if (not (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
|
542 (vc-svn-command nil 0 buffer-file-name "resolved")))) |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
543 |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
544 ;; 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
|
545 (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
|
546 (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
|
547 ;; 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
|
548 ;; "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
|
549 (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
|
550 (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
|
551 (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
|
552 ;; 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
|
553 (progn |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
554 (smerge-mode 1) |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
555 (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
|
556 ;; 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
|
557 ;; 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
|
558 ;; 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
|
559 ;; 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
|
560 ;; 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
|
561 nil) |
9eca5b992f1f
(vc-svn-resolve-when-done, vc-svn-find-file-hook): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78236
diff
changeset
|
562 (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
|
563 |
73444
ee7eeb5732b2
(vc-svn-parse-status): Remove unused arg `localp'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68740
diff
changeset
|
564 (defun vc-svn-parse-status (&optional filename) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
565 "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
|
566 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
|
567 information about FILENAME and return its status." |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
568 (let (file status) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
569 (goto-char (point-min)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
570 (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
|
571 ;; Ignore the files with status X. |
87513
2af4faa10fab
* vc-svn.el (vc-svn-parse-status): Set the 'unregisted property correctly.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87512
diff
changeset
|
572 "^\\(\\?\\|[ 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
|
573 ;; 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
|
574 ;; 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
|
575 (setq file (or filename |
e52e99fc4ca5
(vc-svn-parse-status): Trust the filename argument more
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
73848
diff
changeset
|
576 (expand-file-name |
e52e99fc4ca5
(vc-svn-parse-status): Trust the filename argument more
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
73848
diff
changeset
|
577 (buffer-substring (point) (line-end-position))))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
578 (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
|
579 (if (eq status ??) |
87514
5c7eec3035ec
Remove some debugging code.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87513
diff
changeset
|
580 (vc-file-setprop file 'vc-state 'unregistered) |
73444
ee7eeb5732b2
(vc-svn-parse-status): Remove unused arg `localp'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68740
diff
changeset
|
581 ;; `vc-BACKEND-registered' must not set vc-backend, |
ee7eeb5732b2
(vc-svn-parse-status): Remove unused arg `localp'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68740
diff
changeset
|
582 ;; which is instead set in vc-registered. |
ee7eeb5732b2
(vc-svn-parse-status): Remove unused arg `localp'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68740
diff
changeset
|
583 (unless filename (vc-file-setprop file 'vc-backend 'SVN)) |
50900
d853a98e1678
(vc-svn-dired-state-info): Use `added' for added files and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50823
diff
changeset
|
584 ;; 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
|
585 ;; output works. |
87514
5c7eec3035ec
Remove some debugging code.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87513
diff
changeset
|
586 (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
|
587 ;; 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
|
588 (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
|
589 (vc-file-setprop |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
590 file 'vc-state |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
591 (cond |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
592 ((eq status ?\ ) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
593 (if (eq (char-after (match-beginning 1)) ?*) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
594 'needs-patch |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
595 (vc-file-setprop file 'vc-checkout-time |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
596 (nth 5 (file-attributes file))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
597 'up-to-date)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
598 ((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
|
599 ;; 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
|
600 (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
|
601 (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
|
602 'added) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
603 ((memq status '(?M ?C)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
604 (if (eq (char-after (match-beginning 1)) ?*) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
605 'needs-merge |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
606 'edited)) |
87450
71fc7b1db920
* vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87449
diff
changeset
|
607 ((eq status ?I) |
87514
5c7eec3035ec
Remove some debugging code.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87513
diff
changeset
|
608 (vc-file-setprop file 'vc-state 'ignored)) |
87477
b5060e79eb98
* vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87450
diff
changeset
|
609 ((eq status ?R) |
87514
5c7eec3035ec
Remove some debugging code.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87513
diff
changeset
|
610 (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
|
611 (t 'edited))))) |
ee7eeb5732b2
(vc-svn-parse-status): Remove unused arg `localp'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
68740
diff
changeset
|
612 (if filename (vc-file-getprop filename 'vc-state)))) |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
613 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
614 (defun vc-svn-dir-state-heuristic (dir) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
615 "Find the SVN state of all files in DIR, using only local information." |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
616 (vc-svn-dir-state dir 'local)) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
617 |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
618 (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
|
619 "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
|
620 ;; 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
|
621 ;; 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
|
622 ;; lowercase letters, digits, `-', and `_'. |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
623 (and (string-match "^[a-zA-Z]" tag) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
624 (not (string-match "[^a-z0-9A-Z-_]" tag)))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
625 |
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
|
626 (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
|
627 "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
|
628 (and (string-match "^[0-9]" tag) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
629 (not (string-match "[^0-9]" tag)))) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
630 |
58929
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
631 ;; Support for `svn annotate' |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
632 |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
633 (defun vc-svn-annotate-command (file buf &optional rev) |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
634 (vc-svn-command buf 0 file "annotate" (if rev (concat "-r" rev)))) |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
635 |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
636 (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
|
637 ;; 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
|
638 (/ (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
|
639 |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
640 (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
|
641 (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
|
642 |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
643 (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
|
644 |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
645 (defun vc-svn-annotate-time () |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
646 (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
|
647 (goto-char (match-end 0)) |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
648 (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
|
649 |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
650 (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
|
651 (save-excursion |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
652 (beginning-of-line) |
43248e1430b6
(vc-svn-repository-hostname): Adjust to new format.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
56777
diff
changeset
|
653 (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
|
654 |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
655 (provide 'vc-svn) |
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
656 |
56777
332e641fe2b1
(vc-svn-diff): Treat options from vc-svn-diff-switches and
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55900
diff
changeset
|
657 ;; arch-tag: 02f10c68-2b4d-453a-90fc-1eee6cfb268d |
50818
d3acfb11487e
First cut at vc-svn.el.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
658 ;;; vc-svn.el ends here |