370 |
with locking; it represents an erroneous condition that |
with locking; it represents an erroneous condition that |
371 |
should be resolved by the user (vc-next-action will |
should be resolved by the user (vc-next-action will |
372 |
prompt the user to do it)." |
prompt the user to do it)." |
373 |
|
;; FIXME: New (sub)states needed (?): |
374 |
|
;; - `added' (i.e. `edited' but with no base version yet, |
375 |
|
;; typically represented by vc-workfile-version = "0") |
376 |
|
;; - `conflict' (i.e. `edited' with conflict markers) |
377 |
|
;; - `removed' |
378 |
|
;; - `copied' and `moved' (might be handled by `removed' and `added') |
379 |
(or (vc-file-getprop file 'vc-state) |
(or (vc-file-getprop file 'vc-state) |
380 |
(if (vc-backend file) |
(if (vc-backend file) |
381 |
(vc-file-setprop file 'vc-state |
(vc-file-setprop file 'vc-state |
404 |
(defun vc-default-workfile-unchanged-p (backend file) |
(defun vc-default-workfile-unchanged-p (backend file) |
405 |
"Check if FILE is unchanged by diffing against the master version. |
"Check if FILE is unchanged by diffing against the master version. |
406 |
Return non-nil if FILE is unchanged." |
Return non-nil if FILE is unchanged." |
407 |
(zerop (vc-call diff file (vc-workfile-version file)))) |
;; If rev1 is nil, `diff' uses the current workfile version. |
408 |
|
(zerop (vc-call diff file))) |
409 |
|
|
410 |
(defun vc-workfile-version (file) |
(defun vc-workfile-version (file) |
411 |
"Return the version level of the current workfile FILE. |
"Return the version level of the current workfile FILE. |
590 |
;; If the user is root, and the file is not owner-writable, |
;; If the user is root, and the file is not owner-writable, |
591 |
;; then pretend that we can't write it |
;; then pretend that we can't write it |
592 |
;; even though we can (because root can write anything). |
;; even though we can (because root can write anything). |
593 |
;; This way, even root cannot modify a file that isn't locked. |
;; This way, even root cannot modify a file that isn't locked. |
594 |
(and (equal file buffer-file-name) |
(and (equal file buffer-file-name) |
595 |
(not buffer-read-only) |
(not buffer-read-only) |
596 |
(zerop (user-real-uid)) |
(zerop (user-real-uid)) |
597 |
(zerop (logand (file-modes buffer-file-name) 128)) |
(zerop (logand (file-modes buffer-file-name) 128)) |
598 |
(setq buffer-read-only t))) |
(setq buffer-read-only t))) |