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