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