From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Uwe Brauer Newsgroups: gmane.emacs.devel Subject: patch against vc-rcs.el: vc-rcs-checkin: allows user login to be added Date: Sun, 06 Sep 2015 20:55:34 +0200 Message-ID: <87d1xvv0m1.fsf@mat.ucm.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1441565818 30974 80.91.229.3 (6 Sep 2015 18:56:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 6 Sep 2015 18:56:58 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 06 20:56:44 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZYf7I-0000UJ-Jl for ged-emacs-devel@m.gmane.org; Sun, 06 Sep 2015 20:56:40 +0200 Original-Received: from localhost ([::1]:50139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYf7I-0000BS-Ji for ged-emacs-devel@m.gmane.org; Sun, 06 Sep 2015 14:56:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYf6R-0006bI-0C for emacs-devel@gnu.org; Sun, 06 Sep 2015 14:55:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYf6N-0004qN-MU for emacs-devel@gnu.org; Sun, 06 Sep 2015 14:55:46 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:43444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYf6N-0004px-Ez for emacs-devel@gnu.org; Sun, 06 Sep 2015 14:55:43 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZYf6K-0007yb-5P for emacs-devel@gnu.org; Sun, 06 Sep 2015 20:55:40 +0200 Original-Received: from 171.pool85-55-19.dynamic.orange.es ([85.55.19.171]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Sep 2015 20:55:40 +0200 Original-Received: from oub by 171.pool85-55-19.dynamic.orange.es with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Sep 2015 20:55:40 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 122 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 171.pool85-55-19.dynamic.orange.es Mail-Copies-To: never User-Agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:RTI512068l2ectXAS4S5BrQe1Rc= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:189652 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hello The following patch adds a new functionality to vc-rcs-checkin: The login user can be added optionally. Rationale: suppose your files are under RCS version control and you collaborate with somebody who does not use RCS. So when you check in his changes, it comes in handy to add the user login. This way vc-annotate distinguish between his and yours changes. Of course you don't want this behavior always since the majority of a typical RCS user are single managed and don't require to change the user in every checkin. That is why I introduced some new variables and a «toggling» function which allows to switch this feature on or off. I find my implementation quite a kludge, so if somebody finds this useful and wants to modify the code, please do. Uwe Brauer --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=vc-rcs.patch diff -u /home/oub/emacs/site-lisp/versch/add-ons/vc-rcs.el /home/oub/emacs/site-lisp/versch/add-ons/vc-rcs-new.el --- /home/oub/emacs/site-lisp/versch/add-ons/vc-rcs.el 2015-09-06 16:19:54.780811291 +0200 +++ /home/oub/emacs/site-lisp/versch/add-ons/vc-rcs-new.el 2015-09-06 16:27:04.662942964 +0200 @@ -106,6 +106,58 @@ :group 'vc-rcs) + +;; new variable for changing the login user + + +(defvar vc-rcs-ask-for-login nil + "*Variable which allows to change the login Id by a y-or-n question.") + +(defvar vc-rcs-login-user nil + "*Variable which saves the value of the rcs user who checks in.") + + +;; since changing the (login) user is not a frequent thing to do, the following functions +;; toggle this behaviour on an off + +;; the following function was written by Adrian Kubala +;; + +(defun make-repeat-command (symbol command-list) + "Command changes with each repetition. +SYMBOL is a symbol unique to this command." + (if (eq last-command symbol) + (set symbol (+ (eval symbol) 1)) + (set symbol 0)) + (if (>= (eval symbol) (length command-list)) + (set symbol 0)) + (call-interactively (nth (eval symbol) command-list)) + (setq this-command symbol)) + + +(defun vc-rcs-set-for-login () + (interactive) + (load-file "~/emacs/site-lisp/versch/vc-change-login.elc") + (setq vc-rcs-ask-for-login t) + (message "Now login will be changed when vc-rcs-checkin is called.")) + +(defun vc-rcs-remove-for-login () + (interactive) + (setq vc-rcs-ask-for-login nil) + (message "Now login will *NOT* be changed when vc-rcs-checkin is called.")) + + +(defun vc-ask-login-or-not () + (interactive) + (make-repeat-command 'vc-ask-login-or-not + '(vc-rcs-set-for-login + vc-rcs-remove-for-login))) + + +;; end of toggling functions + + + ;;; Properties of the backend (defun vc-rcs-revision-granularity () 'file) @@ -309,9 +361,11 @@ ;; It used to be possible to pass in a value for the variable rev, but ;; nothing in the rest of VC used this capability. Removing it makes the ;; backend interface simpler for all modes. -;; +;; modified (defun vc-rcs-checkin (files comment) - "RCS-specific version of `vc-backend-checkin'." + "RCS-specific version of `vc-backend-checkin'. If the variable +vc-rcs-ask-for-login is set to t, function asks for user login. +Useful for collaboration to distinguish different checkins." (let (rev (switches (vc-switches 'RCS 'checkin))) ;; Now operate on the files (dolist (file (vc-expand-dirs files 'RCS)) @@ -331,6 +385,12 @@ ;; if available, use the secure check-in option (and (vc-rcs-release-p "5.6.4") "-j") (concat "-u" rev) + (if vc-rcs-ask-for-login + (if (y-or-n-p (format "Do you want to change the login ")) + (progn + (setq vc-rcs-login-user (read-string "Enter New login: ")) + (concat "-w" vc-rcs-login-user)) + (concat "-m" comment))) (concat "-m" comment) switches) (vc-file-setprop file 'vc-working-revision nil) Diff finished. Sun Sep 6 16:27:33 2015 --=-=-=--