diff options
| author | André Spiegel | 2006-06-23 17:29:19 +0000 |
|---|---|---|
| committer | André Spiegel | 2006-06-23 17:29:19 +0000 |
| commit | 48033a08abf857780d8ec2cad67e1147db5b5458 (patch) | |
| tree | c92f9c4c838e18755c19d528161c940e08cf47ae | |
| parent | 11eced2faf50f6089b48101191295e7b5a2b01da (diff) | |
| download | emacs-48033a08abf857780d8ec2cad67e1147db5b5458.tar.gz emacs-48033a08abf857780d8ec2cad67e1147db5b5458.zip | |
(vc-diff-knows-L): New variable.
(vc-diff-internal): Use it to handle "diff" programs that don't
understand -L. This works automatically, no user action is necessary.
| -rw-r--r-- | lisp/vc.el | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/lisp/vc.el b/lisp/vc.el index 54237800e3c..c395a25798c 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -567,6 +567,13 @@ specific to any particular backend." | |||
| 567 | :group 'vc | 567 | :group 'vc |
| 568 | :version "21.1") | 568 | :version "21.1") |
| 569 | 569 | ||
| 570 | (defcustom vc-diff-knows-L nil | ||
| 571 | "*Indicates whether diff understands the -L option. | ||
| 572 | The value is either `yes', `no', or nil. If it is nil, VC tries | ||
| 573 | to use -L and sets this variable to remember whether it worked." | ||
| 574 | :type '(choice (const :tag "Work out" nil) (const yes) (const no)) | ||
| 575 | :group 'vc) | ||
| 576 | |||
| 570 | (defcustom vc-allow-async-revert nil | 577 | (defcustom vc-allow-async-revert nil |
| 571 | "Specifies whether the diff during \\[vc-revert-buffer] may be asynchronous. | 578 | "Specifies whether the diff during \\[vc-revert-buffer] may be asynchronous. |
| 572 | Enabling this option means that you can confirm a revert operation even | 579 | Enabling this option means that you can confirm a revert operation even |
| @@ -1837,18 +1844,36 @@ actually call the backend, but performs a local diff." | |||
| 1837 | (vc-version-backup-file file rev2))) | 1844 | (vc-version-backup-file file rev2))) |
| 1838 | (coding-system-for-read (vc-coding-system-for-diff file))) | 1845 | (coding-system-for-read (vc-coding-system-for-diff file))) |
| 1839 | (if (and file-rev1 file-rev2) | 1846 | (if (and file-rev1 file-rev2) |
| 1840 | (apply 'vc-do-command "*vc-diff*" 1 "diff" nil | 1847 | (let ((status |
| 1841 | (append (vc-switches nil 'diff) | 1848 | (if (eq vc-diff-knows-L 'no) |
| 1842 | ;; Provide explicit labels like RCS or CVS would do | 1849 | (apply 'vc-do-command "*vc-diff*" 1 "diff" |
| 1843 | ;; so diff-mode refers to `file' rather than to | 1850 | (append (vc-switches nil 'diff) |
| 1844 | ;; `file-rev1' when trying to find/apply/undo hunks. | 1851 | (list (file-relative-name file-rev1) |
| 1845 | (list "-L" (vc-diff-label file file-rev1 rev1) | 1852 | (file-relative-name file-rev2)))) |
| 1846 | "-L" (vc-diff-label file file-rev2 rev2) | 1853 | (apply 'vc-do-command "*vc-diff*" 2 "diff" nil |
| 1847 | (file-relative-name file-rev1) | 1854 | (append (vc-switches nil 'diff) |
| 1848 | (file-relative-name file-rev2)))) | 1855 | ;; Provide explicit labels like RCS or |
| 1856 | ;; CVS would do so diff-mode refers to | ||
| 1857 | ;; `file' rather than to `file-rev1' | ||
| 1858 | ;; when trying to find/apply/undo | ||
| 1859 | ;; hunks. | ||
| 1860 | (list "-L" (vc-diff-label file file-rev1 rev1) | ||
| 1861 | "-L" (vc-diff-label file file-rev2 rev2) | ||
| 1862 | (file-relative-name file-rev1) | ||
| 1863 | (file-relative-name file-rev2))))))) | ||
| 1864 | (if (eq status 2) | ||
| 1865 | (if (not vc-diff-knows-L) | ||
| 1866 | (setq vc-diff-knows-L 'no | ||
| 1867 | status (apply 'vc-do-command "*vc-diff*" 1 "diff" | ||
| 1868 | (append | ||
| 1869 | (vc-switches nil 'diff) | ||
| 1870 | (list (file-relative-name file-rev1) | ||
| 1871 | (file-relative-name file-rev2))))) | ||
| 1872 | (error "diff failed")) | ||
| 1873 | (if (not vc-diff-knows-L) (setq vc-diff-knows-L 'yes))) | ||
| 1874 | status) | ||
| 1849 | (vc-call diff file rev1 rev2)))) | 1875 | (vc-call diff file rev1 rev2)))) |
| 1850 | 1876 | ||
| 1851 | |||
| 1852 | (defun vc-switches (backend op) | 1877 | (defun vc-switches (backend op) |
| 1853 | (let ((switches | 1878 | (let ((switches |
| 1854 | (or (if backend | 1879 | (or (if backend |