aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré Spiegel1996-12-26 12:06:13 +0000
committerAndré Spiegel1996-12-26 12:06:13 +0000
commit2a11c6f32f998b0f7374f177b2b5ca98be52b7cd (patch)
tree1815eab232178024bdc271940e9043f628879cd4
parent4e782c8e169054dd12269941f8caa9822b1892cc (diff)
downloademacs-2a11c6f32f998b0f7374f177b2b5ca98be52b7cd.tar.gz
emacs-2a11c6f32f998b0f7374f177b2b5ca98be52b7cd.zip
(vc-user-login-name): New function.
(vc-fetch-master-properties, vc-lock-from-permissions, vc-file-owner, vc-fetch-properties, vc-after-save, vc-mode-line, vc-status): Use `vc-user-login-name' instead of `user-login-name'.
-rw-r--r--lisp/vc-hooks.el24
1 files changed, 17 insertions, 7 deletions
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index fc9242980ea..89dff1ff4a8 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -289,7 +289,7 @@ See also variable `vc-consult-headers'.")
289 (vc-parse-buffer 289 (vc-parse-buffer
290 (list '("^\001d D \\([^ ]+\\)" 1) 290 (list '("^\001d D \\([^ ]+\\)" 1)
291 (list (concat "^\001d D \\([^ ]+\\) .* " 291 (list (concat "^\001d D \\([^ ]+\\) .* "
292 (regexp-quote (user-login-name)) " ") 1)) 292 (regexp-quote (vc-user-login-name)) " ") 1))
293 file 293 file
294 '(vc-latest-version vc-your-latest-version))) 294 '(vc-latest-version vc-your-latest-version)))
295 295
@@ -564,12 +564,22 @@ For CVS, the full name of CVS/Entries is returned."
564 (vc-file-setprop file 'vc-locking-user 'none)) 564 (vc-file-setprop file 'vc-locking-user 'none))
565 ((and (= (nth 2 attributes) (user-uid)) 565 ((and (= (nth 2 attributes) (user-uid))
566 (string-match ".rw..-..-." (nth 8 attributes))) 566 (string-match ".rw..-..-." (nth 8 attributes)))
567 (vc-file-setprop file 'vc-locking-user (user-login-name))) 567 (vc-file-setprop file 'vc-locking-user (vc-user-login-name)))
568 (nil))))) 568 (nil)))))
569 569
570(defun vc-user-login-name (&optional uid)
571 ;; Return the name under which the user is logged in, as a string.
572 ;; (With optional argument UID, return the name of that user.)
573 ;; This function does the same as `user-login-name', but unlike
574 ;; that, it never returns nil. If a UID cannot be resolved, that
575 ;; UID is returned as a string.
576 (or (user-login-name uid)
577 (and uid (number-to-string uid))
578 (number-to-string (user-uid))))
579
570(defun vc-file-owner (file) 580(defun vc-file-owner (file)
571 ;; Return who owns FILE (user name, as a string). 581 ;; Return who owns FILE (user name, as a string).
572 (user-login-name (nth 2 (file-attributes file)))) 582 (vc-user-login-name (nth 2 (file-attributes file))))
573 583
574(defun vc-rcs-lock-from-diff (file) 584(defun vc-rcs-lock-from-diff (file)
575 ;; Diff the file against the master version. If differences are found, 585 ;; Diff the file against the master version. If differences are found,
@@ -686,7 +696,7 @@ For CVS, the full name of CVS/Entries is returned."
686 (list (concat "^\\([0-9]+\\.[0-9.]+\\)\n" 696 (list (concat "^\\([0-9]+\\.[0-9.]+\\)\n"
687 "date[ \t]+\\([0-9.]+\\);[ \t]+" 697 "date[ \t]+\\([0-9.]+\\);[ \t]+"
688 "author[ \t]+" 698 "author[ \t]+"
689 (regexp-quote (user-login-name)) ";") 1 2)) 699 (regexp-quote (vc-user-login-name)) ";") 1 2))
690 file 700 file
691 '(vc-latest-version vc-your-latest-version)) 701 '(vc-latest-version vc-your-latest-version))
692 (if (get-buffer "*vc-info*") 702 (if (get-buffer "*vc-info*")
@@ -853,7 +863,7 @@ of the buffer. With prefix argument, ask for version number."
853 t) 863 t)
854 (not (vc-locking-user file)) 864 (not (vc-locking-user file))
855 (eq (vc-checkout-model file) 'implicit) 865 (eq (vc-checkout-model file) 'implicit)
856 (vc-file-setprop file 'vc-locking-user (user-login-name)) 866 (vc-file-setprop file 'vc-locking-user (vc-user-login-name))
857 (or (and (eq (vc-backend file) 'CVS) 867 (or (and (eq (vc-backend file) 'CVS)
858 (vc-file-setprop file 'vc-cvs-status nil)) 868 (vc-file-setprop file 'vc-cvs-status nil))
859 t) 869 t)
@@ -876,7 +886,7 @@ control system name."
876 (and vc-type 886 (and vc-type
877 (equal file (buffer-file-name)) 887 (equal file (buffer-file-name))
878 (vc-locking-user file) 888 (vc-locking-user file)
879 (not (string= (user-login-name) (vc-locking-user file))) 889 (not (string= (vc-user-login-name) (vc-locking-user file)))
880 (setq buffer-read-only t)) 890 (setq buffer-read-only t))
881 ;; If the user is root, and the file is not owner-writable, 891 ;; If the user is root, and the file is not owner-writable,
882 ;; then pretend that we can't write it 892 ;; then pretend that we can't write it
@@ -914,7 +924,7 @@ control system name."
914 " @@") 924 " @@")
915 ((not locker) 925 ((not locker)
916 (concat "-" rev)) 926 (concat "-" rev))
917 ((string= locker (user-login-name)) 927 ((string= locker (vc-user-login-name))
918 (concat ":" rev)) 928 (concat ":" rev))
919 (t 929 (t
920 (concat ":" locker ":" rev))))) 930 (concat ":" locker ":" rev)))))