subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matti...@apache.org
Subject svn commit: r1310378 - /subversion/trunk/contrib/client-side/emacs/dsvn.el
Date Fri, 06 Apr 2012 15:02:26 GMT
Author: mattiase
Date: Fri Apr  6 15:02:26 2012
New Revision: 1310378

URL: http://svn.apache.org/viewvc?rev=1310378&view=rev
Log:
Run svn with US-English messages because those we are parsing them.
Before, dsvn did not run well at all with different locales.
This means that some user-visible messages are now always in
US-English, but that is a lesser evil.

* contrib/client-side/emacs/dsvn.el
  (svn-process-environment): New variable.
  (svn-call-in-svn-environment, svn-start-svn-process, svn-call-svn):
   New functions.
  (svn-call-process, svn-run-with-output, svn-run-hidden, svn-run-for-stdout,
   svn-run, svn-log-show-diff): Use new functions.

Modified:
    subversion/trunk/contrib/client-side/emacs/dsvn.el

Modified: subversion/trunk/contrib/client-side/emacs/dsvn.el
URL: http://svn.apache.org/viewvc/subversion/trunk/contrib/client-side/emacs/dsvn.el?rev=1310378&r1=1310377&r2=1310378&view=diff
==============================================================================
--- subversion/trunk/contrib/client-side/emacs/dsvn.el (original)
+++ subversion/trunk/contrib/client-side/emacs/dsvn.el Fri Apr  6 15:02:26 2012
@@ -137,12 +137,34 @@
 (setq svn-process-file
   (if (fboundp 'process-file) 'process-file 'call-process))
 
-(defun svn-call-process (program buffer &rest args)
+;; Run svn with default (US-English) messages, since we are going to
+;; parse them.
+(setq svn-process-environment '("LC_MESSAGES=C"))
+
+(defun svn-call-in-svn-environment (func)
+  ;; Dynamic rebinding of process-environment
+  (let ((process-environment
+         (append svn-process-environment process-environment)))
+    (funcall func)))
+
+(defun svn-start-svn-process (buffer args)
+  "Start an svn process associated to BUFFER, with command-line
+arguments ARGS. Return the process object for it."
+  (svn-call-in-svn-environment
+   (lambda ()
+     (apply svn-start-file-process "svn" buffer svn-program args))))
+
+(defun svn-call-svn (infile buffer display args)
+  "Call svn synchronously. Arguments are like process-file."
+  (svn-call-in-svn-environment
+   (lambda ()
+     (apply svn-process-file svn-program infile buffer display args))))
+
+(defun svn-call-process (buffer &rest args)
   "Run svn and wait for it to finish.
-Argument PROGRAM is the svn binary to run.
 Argument BUFFER is the buffer in which to insert output.
 Optional argument ARGS are the arguments to svn."
-  (let ((proc (apply svn-start-file-process "svn" buffer program args)))
+  (let ((proc (svn-start-svn-process buffer args)))
     (set-process-coding-system proc 'utf-8)
     (set-process-filter proc 'svn-output-filter)
     (while (eq (process-status proc) 'run)
@@ -166,9 +188,7 @@ Return non-NIL if there was any output."
         (fundamental-mode))
       (setq default-directory dir)
       (setq buffer-read-only t)
-      (let ((cmd `(,svn-program ,subcommand ,@args))
-            proc)
-        (setq proc (apply svn-start-file-process "svn" buf cmd))
+      (let ((proc (svn-start-svn-process buf (cons subcommand args))))
         (set-process-coding-system proc 'utf-8)
         (set-process-filter proc 'svn-output-filter)
         (while (eq (process-status proc) 'run)
@@ -191,7 +211,7 @@ Returns the buffer that holds the output
     (with-current-buffer buf
       (erase-buffer)
       (setq default-directory dir))
-    (apply svn-process-file svn-program nil buf nil (symbol-name command) args)
+    (svn-call-svn nil buf nil (cons (symbol-name command) args))
     buf))
 
 (defun svn-run-for-stdout (command args)
@@ -199,8 +219,8 @@ Returns the buffer that holds the output
 Argument COMMAND is the svn subcommand to run.
 Optional argument ARGS is a list of arguments."
   (let ((output-buffer (generate-new-buffer "*svn-stdout*")))
-    (apply svn-process-file svn-program nil (list output-buffer nil) nil
-	   (symbol-name command) args)
+    (svn-call-svn nil (list output-buffer nil) nil
+                  (cons (symbol-name command) args))
     (let ((stdout (with-current-buffer output-buffer (buffer-string))))
       (kill-buffer output-buffer)
       stdout)))
@@ -262,8 +282,7 @@ buffer to describe what is going on."
             args (cons "-v" args)))
     (unless (memq command svn-noninteractive-blacklist)
       (setq args (cons "--non-interactive" args)))
-    (setq proc (apply svn-start-file-process "svn" (current-buffer)
-                      svn-program command-s args))
+    (setq proc (svn-start-svn-process (current-buffer) (cons command-s args)))
     (if (fboundp filter-func)
         (set-process-filter proc filter-func)
       (set-process-filter proc 'svn-default-filter))
@@ -553,7 +572,7 @@ VERBOSE-P."
       (setq buffer-read-only t)
       (erase-buffer)
       (setq default-directory dir)
-      (svn-call-process svn-program diff-buf
+      (svn-call-process diff-buf
                         "diff" "-r"
                         (format "%d:%d" (1- commit-id) commit-id)))))
 



Mime
View raw message