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