# HG changeset patch # User Thien-Thi Nguyen # Date 1201180090 0 # Node ID bcbe422dacdd87141a5d3767b915c44b20eaf333 # Parent 603fbab24035481930b6f92f15a983cc11fbe8bb (vc-next-action): Fix two instances of "free-var file" bug: In both cases, convert single call to one wrapped in dolist. diff -r 603fbab24035 -r bcbe422dacdd lisp/vc.el --- a/lisp/vc.el Thu Jan 24 11:13:45 2008 +0000 +++ b/lisp/vc.el Thu Jan 24 13:08:10 2008 +0000 @@ -1564,15 +1564,28 @@ (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)