comparison lisp/vc-hg.el @ 108322:a70c2c59b3f6

Fix hg envvar handling (Bug#5846). * vc-hg.el (vc-hg-state): Use HGRCPATH, not HGRC. (vc-hg-working-revision): Likewise. Use hg parents, not hg parent (Bug#5846).
author Chong Yidong <cyd@stupidchicken.com>
date Tue, 20 Apr 2010 11:57:54 -0400
parents d7f8e879d70c
children 973b5bc5fcfe 05bd64a0d747
comparison
equal deleted inserted replaced
108321:497767b878dc 108322:a70c2c59b3f6
166 standard-output 166 standard-output
167 (setq status 167 (setq status
168 (condition-case nil 168 (condition-case nil
169 ;; Ignore all errors. 169 ;; Ignore all errors.
170 (let ((process-environment 170 (let ((process-environment
171 ;; Avoid localization of messages so we can parse the output. 171 ;; Avoid localization of messages so we
172 (append (list "TERM=dumb" "LANGUAGE=C" "HGRC=") process-environment))) 172 ;; can parse the output.
173 173 (append (list "TERM=dumb" "LANGUAGE=C" "HGRCPATH=")
174 (process-file 174 process-environment)))
175 "hg" nil t nil 175 (process-file
176 "status" "-A" (file-relative-name file))) 176 "hg" nil t nil
177 "status" "-A" (file-relative-name file)))
177 ;; Some problem happened. E.g. We can't find an `hg' 178 ;; Some problem happened. E.g. We can't find an `hg'
178 ;; executable. 179 ;; executable.
179 (error nil))))))) 180 (error nil)))))))
180 (when (eq 0 status) 181 (when (eq 0 status)
181 (when (null (string-match ".*: No such file or directory$" out)) 182 (when (null (string-match ".*: No such file or directory$" out))
195 "Hg-specific version of `vc-working-revision'." 196 "Hg-specific version of `vc-working-revision'."
196 (let* 197 (let*
197 ((status nil) 198 ((status nil)
198 (default-directory (file-name-directory file)) 199 (default-directory (file-name-directory file))
199 ;; Avoid localization of messages so we can parse the output. 200 ;; Avoid localization of messages so we can parse the output.
200 (avoid-local-env (append (list "TERM=dumb" "LANGUAGE=C" "HGRC=") 201 (avoid-local-env (append (list "TERM=dumb" "LANGUAGE=C" "HGRCPATH=")
201 process-environment)) 202 process-environment))
202 (out 203 (out
203 (with-output-to-string 204 (with-output-to-string
204 (with-current-buffer 205 (with-current-buffer
205 standard-output 206 standard-output
207 (condition-case nil 208 (condition-case nil
208 (let ((process-environment avoid-local-env)) 209 (let ((process-environment avoid-local-env))
209 ;; Ignore all errors. 210 ;; Ignore all errors.
210 (process-file 211 (process-file
211 "hg" nil t nil 212 "hg" nil t nil
212 "parent" "--template" "{rev}" (file-relative-name file))) 213 "parents" "--template" "{rev}" (file-relative-name file)))
213 ;; Some problem happened. E.g. We can't find an `hg' 214 ;; Some problem happened. E.g. We can't find an `hg'
214 ;; executable. 215 ;; executable.
215 (error nil))))))) 216 (error nil)))))))
216 (if (eq 0 status) 217 (if (eq 0 status)
217 out 218 out