From d36122a23ef6b5d37215c7f892cc9e4f938818db Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Thu, 24 Jan 2008 13:09:13 +0000 Subject: [PATCH] (vc-next-action): Fix two instances of "free-var file" bug: In both cases, convert single call to one wrapped in dolist. --- lisp/ChangeLog | 3 +++ lisp/vc.el | 25 +++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a80f7ef4f4..18baed6709 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -18,6 +18,9 @@ Don't do window resize if no window displays buffer. (vc-diff-internal): Use vc-diff-finish. + * vc.el (vc-next-action): Fix two instances of "free-var file" bug: + In both cases, convert single call to one wrapped in dolist. + 2008-01-24 Dan Nicolaescu * vc.el: Add a TODO item about missing files. diff --git a/lisp/vc.el b/lisp/vc.el index 1bb5c28d53..9d1c6682c4 100644 --- a/lisp/vc.el +++ b/lisp/vc.el @@ -1564,15 +1564,28 @@ merge in the changes into your working copy." (setq revision (read-string "New revision or backend: ")) (let ((vsym (intern (upcase revision)))) (if (member vsym vc-handled-backends) - (vc-transfer-file file vsym) + (dolist (file files) (vc-transfer-file file vsym)) (vc-checkin ready-for-commit revision)))))))) ;; locked by somebody else (locking VCSes only) ((stringp state) - (let ((revision - (if verbose - (read-string "Revision to steal: ") - (vc-working-revision file)))) - (dolist (file files) (vc-steal-lock file revision state)))) + ;; In the old days, we computed the revision once and used it on + ;; the single file. Then, for the 2007-2008 fileset rewrite, we + ;; computed the revision once (incorrectly, using a free var) and + ;; used it on all files. To fix the free var bug, we can either + ;; use `(car files)' or do what we do here: distribute the + ;; revision computation among `files'. Although this may be + ;; tedious for those backends where a "revision" is a trans-file + ;; concept, it is nonetheless correct for both those and (more + ;; importantly) for those where "revision" is a per-file concept. + ;; If the intersection of the former group and "locking VCSes" is + ;; non-empty [I vaguely doubt it --ttn], we can reinstate the + ;; pre-computation approach of yore. + (dolist (file files) + (vc-steal-lock + file (if verbose + (read-string (format "%s revision to steal: " file)) + (vc-working-revision file)) + state))) ;; needs-patch ((eq state 'needs-patch) (dolist (file files) -- 2.39.2