1 ;;; vc-dav.el --- vc.el support for WebDAV
3 ;; Copyright (C) 2001, 2004-2017 Free Software Foundation, Inc.
5 ;; Author: Bill Perry <wmperry@gnu.org>
6 ;; Maintainer: Bill Perry <wmperry@gnu.org>
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
29 ;; - Some methods need to be updated to match the current vc.el.
30 ;; - rename "version" -> "revision"
31 ;; - some methods need to take a fileset as a parameter instead of a
39 ;;; Required functions for a vc backend
40 (defun vc-dav-registered (url)
41 "Return t if URL is registered with a DAV aware server."
42 (url-dav-vc-registered url
))
44 (defun vc-dav-state (url)
45 "Return the current version control state of URL.
46 For a list of possible values, see `vc-state'."
47 ;; Things we can support for WebDAV
49 ;; up-to-date - use lockdiscovery
50 ;; edited - check for an active lock by us
51 ;; USER - use lockdiscovery + owner
53 ;; These don't make sense for WebDAV
57 (let ((locks (url-dav-active-locks url
)))
59 ((null locks
) 'up-to-date
)
61 ;; SOMEBODY has a lock... let's find out who.
62 (setq locks
(cdr (assoc url locks
)))
63 (if (rassoc url-dav-lock-identifier locks
)
66 (cdr (car locks
)))))))
68 (defun vc-dav-checkout-model (url)
69 "Indicate whether URL needs to be \"checked out\" before it can be edited.
70 See `vc-checkout-model' for a list of possible values."
71 ;; The only thing we can support with webdav is 'locking
74 ;; This should figure out the version # of the file somehow. What is
75 ;; the most appropriate property in WebDAV to look at for this?
76 (defun vc-dav-workfile-version (url)
77 "Return the current workfile version of URL."
80 (defun vc-dav-register (url &optional _comment
)
81 "Register URL in the DAV backend."
82 ;; Do we need to do anything here? FIXME?
85 (defun vc-dav-checkin (url comment
&optional _rev
)
86 "Commit changes in URL to WebDAV. COMMENT is used as a check-in comment."
87 ;; This should PUT the resource and release any locks that we hold.
90 (defun vc-dav-checkout (url &optional rev destfile
)
91 "Check out revision REV of URL into the working area.
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.
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.
99 If optional arg DESTFILE is given, it is an alternate filename to
100 write the contents to.
102 ;; This should LOCK the resource.
105 (defun vc-dav-revert (url &optional contents-done
)
106 "Revert URL back to the current workfile version.
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.
112 ;; Should do a GET if !contents_done
113 ;; Should UNLOCK the file.
116 (defun vc-dav-print-log (url)
117 "Insert the revision log of URL into the *vc* buffer."
120 (defun vc-dav-diff (url &optional rev1 rev2 buffer async
)
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.
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).
129 ;; We should do this asynchronously...
130 ;; How would we do it at all, that is the question!
135 ;;; Optional functions
137 ;; This should use url-dav-get-properties with a depth of `1' to get
138 ;; all the properties.
139 (defun vc-dav-dir-state (url)
140 "find the version control state of all files in DIR in a fast way."
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.
148 ;;; Unimplemented functions
150 ;; vc-dav-mode-line-string(url)
151 ;; Return a dav-specific mode line string for URL. Are there any
152 ;; specific states that we want exposed?
156 ;; vc-dav-receive-file(url rev)
157 ;; Let this backend `receive' a file that is already registered
158 ;; under another backend. The default just calls `register', which
159 ;; should be sufficient for WebDAV.
161 ;; vc-dav-unregister(url)
162 ;; Unregister URL. Not possible with WebDAV, other than by
163 ;; deleting the resource.
167 ;;; vc-dav.el ends here