unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Fix for vc-bzr-diff when vc-bzr-diff-switches is t
@ 2011-01-26 13:53 Deniz Dogan
  2011-01-27  1:41 ` Glenn Morris
  2011-01-27  3:13 ` Stefan Monnier
  0 siblings, 2 replies; 6+ messages in thread
From: Deniz Dogan @ 2011-01-26 13:53 UTC (permalink / raw)
  To: Emacs-Devel devel

I have had problems with vc-bzr-diff for some time now, getting errors
about some file not being found.  After much digging around in the VC
architecture, I realized that the problem is of course that I don't
have the diff tool installed, as I'm on Windows 7 without cygwin.

But since "bzr diff" works for me in a command prompt, I figured doing
a bzr diff in Emacs should work too, as long as it doesn't pass
--diff-options to bzr, which would require the diff tool.

So I set vc-bzr-diff-switches to t which means that I don't want to
pass any options to diff.  However, Emacs still executes:

bzr diff --diff-options  the-file

This breaks bzr completely as bzr expects diff options after
--diff-options.  So I wrote the attached patch for vc-bzr.el which
takes care of the case when vc-bzr-diff-switches is t, i.e., when we
don't want any diff switches, resulting in:

bzr diff the-file

I'm not ready to say that the attached patch is good to go, as I'm
pretty new to the VC package in general, so I'd appreciate it if you
guys test it out.

Thanks

--
Deniz Dogan



# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: deniz.a.m.dogan@gmail.com-20110126134056-\
#   34dve8s23jpoym3a
# target_branch: bzr+ssh://damd@bzr.savannah.gnu.org/emacs/trunk/
# testament_sha1: ba35bbaf78d6175412e7b8afee93cc1452de2fc1
# timestamp: 2011-01-26 14:42:36 +0100
# base_revision_id: rgm@gnu.org-20110125174128-bjtiwgdubw4frnj1
#
# Begin patch
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog      2011-01-25 17:41:28 +0000
+++ lisp/ChangeLog      2011-01-26 13:40:56 +0000
@@ -1,3 +1,8 @@
+2011-01-26  Deniz Dogan  <deniz.a.m.dogan@gmail.com>
+
+       * vc/vc-bzr.el (vc-bzr-diff): Don't pass --diff-options if
+       vc-bzr-diff-switches is t.
+
 2011-01-25  Sam Steingold  <sds@gnu.org>

        * vc/vc-svn.el (vc-svn-diff): Use `diff-command' instead of the

=== modified file 'lisp/vc/vc-bzr.el'
--- lisp/vc/vc-bzr.el   2011-01-25 04:08:28 +0000
+++ lisp/vc/vc-bzr.el   2011-01-26 13:40:56 +0000
@@ -674,18 +674,23 @@

 (defun vc-bzr-diff (files &optional rev1 rev2 buffer)
   "VC bzr backend for diff."
-  ;; `bzr diff' exits with code 1 if diff is non-empty.
-  (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*")
-        (if vc-disable-async-diff 1 'async) files
-         "--diff-options" (mapconcat 'identity
-                                     (vc-switches 'bzr 'diff)
-                                    " ")
-         ;; This `when' is just an optimization because bzr-1.2 is *much*
-         ;; faster when the revision argument is not given.
-         (when (or rev1 rev2)
-           (list "-r" (format "%s..%s"
-                              (or rev1 "revno:-1")
-                              (or rev2 ""))))))
+  (let (args)
+    (unless (eq t vc-bzr-diff-switches) ;; t means "no switches"
+      (setq args
+            (list "--diff-options" (mapconcat 'identity
+                                              (vc-switches 'bzr 'diff)
+                                              " "))))
+    ;; This `when' is just an optimization because bzr-1.2 is *much*
+    ;; faster when the revision argument is not given.
+    (when (or rev1 rev2)
+      (setq args (append args (list "-r" (format "%s..%s"
+                                                 (or rev1 "revno:-1")
+                                                 (or rev2 ""))))))
+    ;; `bzr diff' exits with code 1 if diff is non-empty.
+    (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*")
+           (if vc-disable-async-diff 1 'async) files
+           args)))
+


 ;; FIXME: vc-{next,previous}-revision need fixing in vc.el to deal with

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWSMgy5gAAr/fgFDwWvP//18E
BAD////wUAWu7d2vee7tRzu9UrQHCBKImkNMJpPU8CmyTRkwIANGhkAlIIaaZBpDRAyPSaAAAAAE
kRoUeppqn6FPU9NT0TI0PSPUGgGgACRKJhIZNiJoaNAek0aAAB6gBJImjRoRPR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kOrn5GfOCL
OOckb5m/HliibA5X+DDES5bOYJ+jiViFG5GORgbpq3WMyQRwiXMhFgSSOEUQnJMzMhdDD1RRiZnP
CK7IaoQdvU4l9cGWCnlBy2qxDBeAbMrQyeyZFySYshWWvKL6OJrKweL66rkTnORo5fKPsdPcsOQg
vEeSUFD2RZ+8duubCLIZR5Miv0FzDECvdHqwfXAFNWRejID4CzIm8UbUcRDBw9JIlMECpgZo49Bj
djvia6ur7QPgR/IDidEzCL5cgrL68/A6xdIogpf290HQGenAzdmHiGqLRzyE6HsPXSYFYGVpfvkb
0UyVIEmDUhy6eNqGtzb58jucxDoAqSYoch/dyiaaltC9G5FoZPUrsZgN+UsmGBjY9QoY+4EzhStA
ra5zaENro2d1LKaE6kjqhK6L9TrooiaIFXyTDWGrTN4ibJ+fF37zbnGmTHQ1G/06SbfP2gUrau3H
eNtYxKiYsHRItqGczPKorBsaSuNDPllTkM7KHOwKXE74UDpgeubxYG2bK/OD5IerRtEqXg4jxQ9F
yM8o7dtWNlujQH3I0bKD6Xr8zz6vgxNNjrA2YKxK8HhTSfrcJxBEUcqIi3bsBzWAVHvQC2MEZJKr
v/4u5IpwoSBGQZcw



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-01-27 17:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-26 13:53 [PATCH] Fix for vc-bzr-diff when vc-bzr-diff-switches is t Deniz Dogan
2011-01-27  1:41 ` Glenn Morris
2011-01-27  2:53   ` Deniz Dogan
2011-01-27  3:13 ` Stefan Monnier
2011-01-27  9:50   ` Deniz Dogan
2011-01-27 17:19     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).