Mercurial > emacs
comparison lisp/vc/vc-dav.el @ 109063:c77749185234
merge trunk
author | Kenichi Handa <handa@etlken> |
---|---|
date | Thu, 24 Jun 2010 15:10:43 +0900 |
parents | lisp/vc-dav.el@1d1d5d9bd884 lisp/vc-dav.el@6ff48295959a |
children | 1b626601d32d |
comparison
equal
deleted
inserted
replaced
108814:9d7ea82188d8 | 109063:c77749185234 |
---|---|
1 ;;; vc-dav.el --- vc.el support for WebDAV | |
2 | |
3 ;; Copyright (C) 2001, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Bill Perry <wmperry@gnu.org> | |
6 ;; Maintainer: Bill Perry <wmperry@gnu.org> | |
7 ;; Keywords: url, vc | |
8 | |
9 ;; GNU Emacs is free software: you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation, either version 3 of the License, or | |
12 ;; (at your option) any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |
21 | |
22 | |
23 ;;; Commentary: | |
24 | |
25 ;;; Todo: | |
26 ;; | |
27 ;; - Some methods need to be updated to match the current vc.el. | |
28 ;; - rename "version" -> "revision" | |
29 ;; - some methods need to take a fileset as a parameter instead of a | |
30 ;; single file. | |
31 | |
32 ;;; Code: | |
33 | |
34 (require 'url) | |
35 (require 'url-dav) | |
36 | |
37 ;;; Required functions for a vc backend | |
38 (defun vc-dav-registered (url) | |
39 "Return t if URL is registered with a DAV aware server." | |
40 (url-dav-vc-registered url)) | |
41 | |
42 (defun vc-dav-state (url) | |
43 "Return the current version control state of URL. | |
44 For a list of possible values, see `vc-state'." | |
45 ;; Things we can support for WebDAV | |
46 ;; | |
47 ;; up-to-date - use lockdiscovery | |
48 ;; edited - check for an active lock by us | |
49 ;; USER - use lockdiscovery + owner | |
50 ;; | |
51 ;; These don't make sense for WebDAV | |
52 ;; needs-patch | |
53 ;; needs-merge | |
54 ;; unlocked-changes | |
55 (let ((locks (url-dav-active-locks url))) | |
56 (cond | |
57 ((null locks) 'up-to-date) | |
58 ((assoc url locks) | |
59 ;; SOMEBODY has a lock... let's find out who. | |
60 (setq locks (cdr (assoc url locks))) | |
61 (if (rassoc url-dav-lock-identifier locks) | |
62 ;; _WE_ have a lock | |
63 'edited | |
64 (cdr (car locks))))))) | |
65 | |
66 (defun vc-dav-checkout-model (url) | |
67 "Indicate whether URL needs to be \"checked out\" before it can be edited. | |
68 See `vc-checkout-model' for a list of possible values." | |
69 ;; The only thing we can support with webdav is 'locking | |
70 'locking) | |
71 | |
72 ;; This should figure out the version # of the file somehow. What is | |
73 ;; the most appropriate property in WebDAV to look at for this? | |
74 (defun vc-dav-workfile-version (url) | |
75 "Return the current workfile version of URL." | |
76 "Unknown") | |
77 | |
78 (defun vc-dav-register (url &optional rev comment) | |
79 "Register URL in the DAV backend." | |
80 ;; Do we need to do anything here? FIXME? | |
81 ) | |
82 | |
83 (defun vc-dav-checkin (url rev comment) | |
84 "Commit changes in URL to WebDAV. | |
85 If REV is non-nil, that should become the new revision number. | |
86 COMMENT is used as a check-in comment." | |
87 ;; This should PUT the resource and release any locks that we hold. | |
88 ) | |
89 | |
90 (defun vc-dav-checkout (url &optional editable rev destfile) | |
91 "Check out revision REV of URL into the working area. | |
92 | |
93 If EDITABLE is non-nil URL should be writable by the user and if | |
94 locking is used for URL, a lock should also be set. | |
95 | |
96 If REV is non-nil, that is the revision to check out. If REV is the | |
97 empty string, that means to check ou tht ehead of the trunk. | |
98 | |
99 If optional arg DESTFILE is given, it is an alternate filename to | |
100 write the contents to. | |
101 " | |
102 ;; This should LOCK the resource. | |
103 ) | |
104 | |
105 (defun vc-dav-revert (url &optional contents-done) | |
106 "Revert URL back to the current workfile version. | |
107 | |
108 If optional arg CONTENTS-DONE is non-nil, then the contents of FILE | |
109 have already been reverted from a version backup, and this function | |
110 only needs to update the status of URL within the backend. | |
111 " | |
112 ;; Should do a GET if !contents_done | |
113 ;; Should UNLOCK the file. | |
114 ) | |
115 | |
116 (defun vc-dav-print-log (url) | |
117 "Insert the revision log of URL into the *vc* buffer." | |
118 ) | |
119 | |
120 (defun vc-dav-diff (url &optional rev1 rev2) | |
121 "Insert the diff for URL into the *vc-diff* buffer. | |
122 If REV1 and REV2 are non-nil report differences from REV1 to REV2. | |
123 If REV1 is nil, use the current workfile version as the older version. | |
124 If REV2 is nil, use the current workfile contents as the nwer version. | |
125 | |
126 It should return a status of either 0 (no differences found), or | |
127 1 (either non-empty diff or the diff is run asynchronously). | |
128 " | |
129 ;; We should do this asynchronously... | |
130 ;; How would we do it at all, that is the question! | |
131 ) | |
132 | |
133 | |
134 | |
135 ;;; Optional functions | |
136 ;; Should be faster than vc-dav-state - but how? | |
137 (defun vc-dav-state-heuristic (url) | |
138 "Estimate the version control state of URL at visiting time." | |
139 (vc-dav-state url)) | |
140 | |
141 ;; This should use url-dav-get-properties with a depth of `1' to get | |
142 ;; all the properties. | |
143 (defun vc-dav-dir-state (url) | |
144 "find the version control state of all files in DIR in a fast way." | |
145 ) | |
146 | |
147 (defun vc-dav-workfile-unchanged-p (url) | |
148 "Return non-nil if URL is unchanged from its current workfile version." | |
149 ;; Probably impossible with webdav | |
150 ) | |
151 | |
152 (defun vc-dav-responsible-p (url) | |
153 "Return non-nil if DAV considers itself `responsible' for URL." | |
154 ;; Check for DAV support on the web server. | |
155 t) | |
156 | |
157 (defun vc-dav-could-register (url) | |
158 "Return non-nil if URL could be registered under this backend." | |
159 ;; Check for DAV support on the web server. | |
160 t) | |
161 | |
162 ;;; Unimplemented functions | |
163 ;; | |
164 ;; vc-dav-latest-on-branch-p(URL) | |
165 ;; Return non-nil if the current workfile version of FILE is the | |
166 ;; latest on its branch. There are no branches in webdav yet. | |
167 ;; | |
168 ;; vc-dav-mode-line-string(url) | |
169 ;; Return a dav-specific mode line string for URL. Are there any | |
170 ;; specific states that we want exposed? | |
171 ;; | |
172 ;; vc-dav-dired-state-info(url) | |
173 ;; Translate the `vc-state' property of URL into a string that can | |
174 ;; be used in a vc-dired buffer. Are there any extra states that | |
175 ;; we want exposed? | |
176 ;; | |
177 ;; vc-dav-receive-file(url rev) | |
178 ;; Let this backend `receive' a file that is already registered | |
179 ;; under another backend. The default just calls `register', which | |
180 ;; should be sufficient for WebDAV. | |
181 ;; | |
182 ;; vc-dav-unregister(url) | |
183 ;; Unregister URL. Not possible with WebDAV, other than by | |
184 ;; deleting the resource. | |
185 | |
186 (provide 'vc-dav) | |
187 | |
188 ;; arch-tag: 0a0fb9fe-8190-4c0a-a179-5c291d3a467e | |
189 ;;; vc-dav.el ends here |