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