all messages for Emacs-related lists mirrored at yhetil.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
kRoUeppqn6FPU9NT0TI0PSPUGgGgACRKJhIZNiJoaNAek0aAAB6gBJImjRoR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MhkOrn5GfOCL
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

* Re: [PATCH] Fix for vc-bzr-diff when vc-bzr-diff-switches is t
  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
  1 sibling, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2011-01-27  1:41 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: Emacs-Devel devel

Deniz Dogan wrote:

> +  (let (args)
> +    (unless (eq t vc-bzr-diff-switches) ;; t means "no switches"

I think it's better to check for zero-length return from
(vc-switches 'bzr 'diff).



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

* Re: [PATCH] Fix for vc-bzr-diff when vc-bzr-diff-switches is t
  2011-01-27  1:41 ` Glenn Morris
@ 2011-01-27  2:53   ` Deniz Dogan
  0 siblings, 0 replies; 6+ messages in thread
From: Deniz Dogan @ 2011-01-27  2:53 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Emacs-Devel devel

2011/1/27 Glenn Morris <rgm@gnu.org>:
> Deniz Dogan wrote:
>
>> +  (let (args)
>> +    (unless (eq t vc-bzr-diff-switches) ;; t means "no switches"
>
> I think it's better to check for zero-length return from
> (vc-switches 'bzr 'diff).
>

How about this?

-- 
Deniz Dogan


# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: deniz.a.m.dogan@gmail.com-20110127025053-\
#   8qw1p28em01t5or7
# target_branch: bzr+ssh://damd@bzr.savannah.gnu.org/emacs/trunk/
# testament_sha1: 8e019713af179638969ba99256119208c84fe0ca
# timestamp: 2011-01-27 03:51:25 +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-27 02:50:53 +0000
@@ -1,3 +1,8 @@
+2011-01-27  Deniz Dogan  <deniz.a.m.dogan@gmail.com>
+
+	* vc/vc-bzr.el (vc-bzr-diff): Pass --diff-options only if using
+	diff switches.
+
 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-27 02:50:53 +0000
@@ -674,18 +674,21 @@

 (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 ((switches (vc-switches 'bzr 'diff))
+        args)
+    (when (> (length switches) 0)
+      (setq args (list "--diff-options" (mapconcat 'identity switches " "))))
+    ;; 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
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWWbRlmMABTlfgFTwWvP//18E
RAD////wYAifegUAAAAAAAAABzCYBMAJhMJpgAAEyaaBjmEwCYATCYTTAAAJk00DHMJgEwAmEwmm
AAATJpoGGhJlGgeUAADQAaGgAAAcwmATACYTCaYAABMmmgYSSAgEyYQAQJiaDRJmptTGIalpQkzJ
UIy+fz7cptv3URShU/6y5HxsZn9OQ90abBqr99JYHcH9Ulx+fNa0iXAprnzjAiDo4YFSAgQQPGho
EKjYIQ4QMDDB/BGcL6vvefdy+kbMWcRIqt7mnHdaQIKX8g+AzDBAP+ryGAZMZT/8lVtsdNMfVhxu
CRs2QHD3v6M9oDGbG+3AuGPyHuD3mWH4W+g3Zfzp4Q91cg1fbmW3G95dnVbOabiDgvueEDU9V3RF
Z44VmGu21qAHRM53P7wnc33YnCDyPdv5uzOJmdh02M1BM8jsHw1GpzjJg/RBOhwh7IYYG8Y36QIj
GhCymWcwITIRGcJRMeAcaDCBWFWgprTyMGZYEWT4p4dfX4N6WxYk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e08gXGBt9qBbuJ3Eio1cPacDaSDicbjiqkqQKiQ8gRE
b86Df0s27DYmMRMOTDv6Cswz2fRqG7CCS2ibcgVB7ktXYhbRHTj8g9zI7SGHSpuA8qed0IJ53RJ8
SiMULxDyDUWLvGTplwMgdqlwvOluHdgUiL+/ZRqEdpHNx+x4ExHdGol5OKKf5HhmGnsAzOm1HDrL
8BzQLj6icSE4D11dI9XHZWV2Au4dYDEVWAeFAiJIrZkyZINDtxBxt3qI7t9ojrOzkdx48OhWKwR3
uvSR4DC9PaHiFqPZ0crCpJiC8hbwGQl9EtZAZAwT3yA+6AGSg3FZrYNyBfgcELbEPBf7ia0iS8ys
sPI/Ij4DiRrRp5ISzQLghRRH4ILcj+KeBmRI0MIYVHkyLPRI80tolZxKD3sl/uiEoWBQ9ByQvJK3
koG5BwEdqBMB2edYisgBEKmAba6lx4gy47TqUBlUe6khchHqgTgP6QnhMB4yBZ2HcK0M7eZgHnQO
rUyIq/s8cRcRGenIZjzYHoExUFw4eoyQPGB4n+AyErUuRcpmnWs6iKoipSVbAYgOF4aXCGu5t+Te
HzDvQJ0QSpIE3CHnzLx4qU6oXAPUDRByA1C5vFZjughdhzPiBb0GBgGNxAUqBj7IUDnKZJKdJYuF
oj5AO0JtW5PygCHA9Ad5ESsRYd44XZICAEQJ+yAs0sdUHESMBhO6tew7Bh3B4NAeOThh0m/MCQ8b
kOg2SFKdBA01cUwaMzaggTSHBQurJmHhRrBhyk4fMRlSVMnDMQVaYkM7DCPwGcMuAEh4egEy0E4d
cTA7SObPoK+wvDZBhWHNJ5YgeK9NgV0vAcFHeIeBmB050HEwqNlt2svvDtEXm2gP2mvoHU83xGCB
A25IWzQVoL8AaJQSqKj98QTiIikR4E6Ujly2DDnDMXIVR75oS2sKgrSRUep/8XckU4UJBm0ZZjA=



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

* Re: [PATCH] Fix for vc-bzr-diff when vc-bzr-diff-switches is t
  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  3:13 ` Stefan Monnier
  2011-01-27  9:50   ` Deniz Dogan
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2011-01-27  3:13 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: Emacs-Devel devel

> +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.

The comment's fine.

> -  ;; `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)))

I suggest you try hard to directly give a value within `let' rather than
use (let (var) ...) and then give a value to var via `setq'.
In the above case, it would look like:

     (let ((args
            (append
             (unless (eq t vc-bzr-diff-switches) ;; t means "no switches"
               (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)
               (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)))

which you can also turn into

     ;; `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
            (append
             (unless (eq t vc-bzr-diff-switches) ;; t means "no switches"
               (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)
               (list "-r" (format "%s..%s"
                                  (or rev1 "revno:-1")
                                  (or rev2 ""))))))

if you prefer.  Also I agree with Glenn that it's better to check for
(zerop (length (vc-switches 'bzr 'diff))).


        Stefan



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

* Re: [PATCH] Fix for vc-bzr-diff when vc-bzr-diff-switches is t
  2011-01-27  3:13 ` Stefan Monnier
@ 2011-01-27  9:50   ` Deniz Dogan
  2011-01-27 17:19     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Deniz Dogan @ 2011-01-27  9:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs-Devel devel

Here is my third attempt given your comments.

I'm still unable to test this patch properly since I don't have the
diff tool, but looking at the commands that Emacs executes depending
on vc-bzr-diff-switches it looks fine.

-- 
Deniz Dogan



# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: deniz.a.m.dogan@gmail.com-20110127094656-\
#   wpy4g0ar18lokk25
# target_branch: bzr+ssh://damd@bzr.savannah.gnu.org/emacs/trunk/
# testament_sha1: 2aad3701c56f1c2975786049462e411b2f4fc43e
# timestamp: 2011-01-27 10:47:25 +0100
# base_revision_id: rgm@gnu.org-20110127083843-kh1tiktwkt13fl8f
#
# Begin patch
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2011-01-27 07:54:04 +0000
+++ lisp/ChangeLog	2011-01-27 09:46:56 +0000
@@ -1,3 +1,8 @@
+2011-01-27  Deniz Dogan  <deniz.a.m.dogan@gmail.com>
+
+	* vc/vc-bzr.el (vc-bzr-diff): Don't pass --diff-options unless
+	there are any diff switches.
+
 2011-01-27  Glenn Morris  <rgm@gnu.org>

 	* msb.el (msb-after-load-hooks): Make it an obsolete alias.

=== 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-27 09:46: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* ((switches (vc-switches 'bzr 'diff))
+         (args
+          (append
+           ;; Only add --diff-options if there are any diff switches.
+           (unless (zerop (length switches))
+             (list "--diff-options" (mapconcat 'identity switches " ")))
+           ;; 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 "")))))))
+    ;; `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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tYSDDTRHC9uzwkPMRxICrOZ
bcxeb4De3I7in126dcmMvoiUR5dtpt6kWETTWKCd8DPzAgtKUO97zX+2mixlXxf6MLQbxiF3LApk
4O/NFP3fpFnOYr5kmZGiB4+hqrNJP3QO4qInTZ72EcB8e/xn4pXQt6iN2jKXMU1W6d69OUQcCsg6
5jwuXRTPsJQrcIr4MES6LqIRjsRV4Cq9TqyuyK3b+HkSHl4HUpn4MOkiMjP59JEeHfOjUzfHjuRq
n4t4f040nLHWt2Vf+GIjdinSpwV3QvdmWL4xglwcojZkjvoRCMrAwwjxxLRw616OvTiRgPpIqCGa
Qg7eRxJLzLh3PNpyWKOQG94K6LkMc59s6Pqkvw4la42mmhOyF9nEmqhOT0vvZWiB0zmjp+Efk6Wo
3dBA9bRGCTlJWjRNvqfZMyGCbkyj4C5otA/jCfKwE+JM/NfU2wCE1a2oyApXcr0MIYH9qUUwLkxK
erBe2hO9tjONl2VBzA26PKOsD1CGURZiOS/pDAv2ZzrtFbi1Vd+5RWKDkQDfpZIQ9J9iJUdUScKX
OwWzIHDbcdCLgsBcwwQyqW3Sjo44f7M5nlEMgoBTNBSyH82CKumG8LEYIpDF6jVubiYxxYYGLHqi
Vh5vlgiSa3UBjRq02d0KWiaCJgMmjbJSTSyIv6YW2yJooq9Uwzccp6HSbWfPOGnysedpleEUrrhT
pW08eBg4rICcUhueqVaOYiz6RXyzYNCqHDrrvOSbkoMdoU1pM1sw4UYv/Dtc7OHwWBsocFrWIYMa
4vB2tNNiiCLcsaO6qOwup56vpeHxRrwnP1OPnng0CF9u1RSn3Sl4XpNwWSMgNiOyoXErWuLnOsAq
LLQWTgrPNEKe3/i7kinChIT7QvDA



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

* Re: [PATCH] Fix for vc-bzr-diff when vc-bzr-diff-switches is t
  2011-01-27  9:50   ` Deniz Dogan
@ 2011-01-27 17:19     ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2011-01-27 17:19 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: Emacs-Devel devel

> Here is my third attempt given your comments.

Looks good, please apply.

> +	* vc/vc-bzr.el (vc-bzr-diff): Don't pass --diff-options unless
> +	there are any diff switches.

IIRC in such positive sentences, you want to use "some" rather than
"any".


        Stefan



^ 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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.