User: scop    
  Date: 06/06/28 14:02:17
  Modified:    packages/unsupported/scop/vc ChangeLog vc.el
Log:
Sync vc with upstream.
Revision  Changes    Path
1.63      +1 -1      XEmacs/packages/unsupported/scop/STATUS
Index: STATUS
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/unsupported/scop/STATUS,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -p -r1.62 -r1.63
--- STATUS	2006/06/12 19:31:39	1.62
+++ STATUS	2006/06/28 12:02:12	1.63
@@ -17,5 +17,5 @@ generic-modes: generic.el and generic-x.
 - Compiles, seems to work, auto-mode-alist and autoloads may need spanking.
 
 vc: vc*.el and a few other related files from GNU Emacs
-- Up to date with GNU Emacs CVS HEAD as of 2006-06-12.
+- Up to date with GNU Emacs CVS HEAD as of 2006-06-28.
 - Compiles, something even works.
1.51      +4 -0      XEmacs/packages/unsupported/scop/vc/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/unsupported/scop/vc/ChangeLog,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -p -r1.50 -r1.51
--- ChangeLog	2006/06/12 19:31:41	1.50
+++ ChangeLog	2006/06/28 12:02:16	1.51
@@ -1,3 +1,7 @@
+2006-06-28  Ville Skyttä  <scop(a)xemacs.org>
+
+	* vc.el: Sync with upstream.
+
 2006-06-12  Ville Skyttä  <scop(a)xemacs.org>
 
 	* Makefile (VERSION): 0.04.
1.29      +35 -10    XEmacs/packages/unsupported/scop/vc/vc.el
Index: vc.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/unsupported/scop/vc/vc.el,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -p -r1.28 -r1.29
--- vc.el	2006/06/12 19:31:42	1.28
+++ vc.el	2006/06/28 12:02:16	1.29
@@ -571,6 +571,13 @@ specific to any particular backend."
   :group 'vc
   :version "21.1")
 
+(defcustom vc-diff-knows-L nil
+  "*Indicates whether diff understands the -L option.
+The value is either `yes', `no', or nil.  If it is nil, VC tries
+to use -L and sets this variable to remember whether it worked."
+:type '(choice (const :tag "Work out" nil) (const yes) (const no))
+:group 'vc)
+
 (defcustom vc-allow-async-revert nil
   "Specifies whether the diff during \\[vc-revert-buffer] may be asynchronous.
 Enabling this option means that you can confirm a revert operation even
@@ -1853,17 +1860,35 @@ actually call the backend, but performs 
                      (vc-version-backup-file file rev2)))
         (coding-system-for-read (vc-coding-system-for-diff file)))
     (if (and file-rev1 file-rev2)
-        (apply 'vc-do-command "*vc-diff*" 1 "diff" nil
-	       (append (vc-switches nil 'diff)
-		       ;; Provide explicit labels like RCS or CVS would do
-		       ;; so diff-mode refers to `file' rather than to
-		       ;; `file-rev1' when trying to find/apply/undo hunks.
-		       (list "-L" (vc-diff-label file file-rev1 rev1)
-			     "-L" (vc-diff-label file file-rev2 rev2)
-			     (file-relative-name file-rev1)
-			     (file-relative-name file-rev2))))
+        (let ((status
+               (if (eq vc-diff-knows-L 'no)
+                   (apply 'vc-do-command "*vc-diff*" 1 "diff"
+                          (append (vc-switches nil 'diff)
+                                  (list (file-relative-name file-rev1)
+                                        (file-relative-name file-rev2))))
+                 (apply 'vc-do-command "*vc-diff*" 2 "diff" nil
+                        (append (vc-switches nil 'diff)
+                                ;; Provide explicit labels like RCS or
+                                ;; CVS would do so diff-mode refers to
+                                ;; `file' rather than to `file-rev1'
+                                ;; when trying to find/apply/undo
+                                ;; hunks.
+                                (list "-L" (vc-diff-label file file-rev1 rev1)
+                                      "-L" (vc-diff-label file file-rev2 rev2)
+                                      (file-relative-name file-rev1)
+                                      (file-relative-name file-rev2)))))))
+          (if (eq status 2)
+              (if (not vc-diff-knows-L)
+                  (setq vc-diff-knows-L 'no
+                        status (apply 'vc-do-command "*vc-diff*" 1 "diff"
+                                      (append 
+                                       (vc-switches nil 'diff)
+                                       (list (file-relative-name file-rev1)
+                                             (file-relative-name file-rev2)))))
+                (error "diff failed"))
+            (if (not vc-diff-knows-L) (setq vc-diff-knows-L 'yes)))
+          status)
       (vc-call diff file rev1 rev2))))
-
 
 (defun vc-switches (backend op)
   (let ((switches