all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Matthias Meulien <orontee@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: emacs-devel@gnu.org
Subject: Re: Is vc-diff-mergebase broken on master?
Date: Sat, 04 Sep 2021 22:24:24 +0200	[thread overview]
Message-ID: <87eea49jif.fsf@gmail.com> (raw)
In-Reply-To: <87r1e49lvx.fsf@gmail.com> (Matthias Meulien's message of "Sat, 04 Sep 2021 21:33:06 +0200")

[-- Attachment #1: Type: text/plain, Size: 120 bytes --]

Matthias Meulien <orontee@gmail.com> writes:

> (...) I'll work on an updated patch fixing RCS/CVS tests.

Here it is:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Test-vc-version-diff.patch --]
[-- Type: text/x-diff, Size: 3800 bytes --]

From b9f8b097701a78d4e11b1e85699ba8070b98f163 Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee@gmail.com>
Date: Fri, 3 Sep 2021 00:42:29 +0200
Subject: [PATCH] Test vc-version-diff

* test/lisp/vc/vc-tests.el (vc-test--version-diff): Test vc-version-diff
---
 test/lisp/vc/vc-tests.el | 78 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)

diff --git a/test/lisp/vc/vc-tests.el b/test/lisp/vc/vc-tests.el
index dfe89c519b..f8c843ff50 100644
--- a/test/lisp/vc/vc-tests.el
+++ b/test/lisp/vc/vc-tests.el
@@ -547,6 +547,72 @@ vc-test--checkout-model
         (if tempdir (delete-directory tempdir t))
         (run-hooks 'vc-test--cleanup-hook)))))
 
+(defun vc-test--version-diff (backend)
+  "Check the diff version of a repository."
+
+  (let ((vc-handled-backends `(,backend))
+	(default-directory
+	  (file-name-as-directory
+	   (expand-file-name
+	    (make-temp-name "vc-test") temporary-file-directory)))
+	(process-environment process-environment)
+	tempdir
+	vc-test--cleanup-hook)
+    (when (eq backend 'Bzr)
+      (setq tempdir (make-temp-file "vc-test--version-diff" t)
+	    process-environment (cons (format "BZR_HOME=%s" tempdir)
+				      process-environment)))
+
+    (unwind-protect
+	(progn
+	  ;; Cleanup.
+	  (add-hook
+	   'vc-test--cleanup-hook
+	   `(lambda () (delete-directory ,default-directory 'recursive)))
+
+	  ;; Create empty repository.  Check repository checkout model.
+	  (make-directory default-directory)
+	  (vc-test--create-repo-function backend)
+
+	  (let* ((tmp-name (expand-file-name "foo" default-directory))
+                 (files (list (file-name-nondirectory tmp-name))))
+	    ;; Write and register a new file.
+	    (write-region "originaltext" nil tmp-name nil 'nomessage)
+	    (vc-register (list backend files))
+
+            (let ((buff (find-file tmp-name)))
+              (with-current-buffer buff
+                (progn
+                  ;; Optionally checkout file.
+                  (when (or (eq backend 'RCS) (eq backend 'CVS))
+                    (vc-checkout tmp-name))
+
+                  ;; Checkin file.
+                  (vc-checkin files backend)
+                  (insert "Testing vc-version-diff")
+                  (log-edit-done))))
+
+            ;; Modify file content.
+            (when (or (eq backend 'RCS) (eq backend 'CVS))
+              (vc-checkout tmp-name))
+            (write-region "updatedtext" nil tmp-name nil 'nomessage)
+
+	    ;; Check version diff.
+            (vc-version-diff files nil nil)
+            (should (bufferp (get-buffer "*vc-diff*")))
+
+            (with-current-buffer "*vc-diff*"
+              (progn
+                (let ((rawtext (buffer-substring-no-properties (point-min)
+                                                               (point-max))))
+                  (should (string-search "-originaltext" rawtext))
+                  (should (string-search "+updatedtext" rawtext)))))))
+
+      ;; Save exit.
+      (ignore-errors
+        (if tempdir (delete-directory tempdir t))
+        (run-hooks 'vc-test--cleanup-hook)))))
+
 (defun vc-test--rename-file (backend)
   "Check the rename-file action."
 
@@ -715,6 +781,18 @@ vc-test--arch-enabled
           ;; "Really want to delete ...?"
           (skip-unless (not (eq 'CVS ',backend)))
           (vc-test--rename-file ',backend))
+
+        (ert-deftest
+	    ,(intern (format "vc-test-%s06-version-diff" backend-string)) ()
+	  ,(format "Check `vc-version-diff' for the %s backend."
+		   backend-string)
+	  (skip-unless
+	   (ert-test-passed-p
+	    (ert-test-most-recent-result
+	     (ert-get-test
+	      ',(intern
+		 (format "vc-test-%s01-register" backend-string))))))
+	  (vc-test--version-diff ',backend))
         ))))
 
 (provide 'vc-tests)
-- 
2.30.2


[-- Attachment #3: Type: text/plain, Size: 13 bytes --]

-- 
Matthias

  reply	other threads:[~2021-09-04 20:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 20:39 Is vc-diff-mergebase broken on master? Matthias Meulien
2021-08-30 21:48 ` Daniel Martín
2021-08-31  0:00 ` Dmitry Gutov
2021-08-31  5:55   ` Matthias Meulien
2021-09-02 22:54   ` Matthias Meulien
2021-09-02 23:21     ` Dmitry Gutov
2021-09-04 19:33       ` Matthias Meulien
2021-09-04 20:24         ` Matthias Meulien [this message]
2021-09-04 23:50           ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eea49jif.fsf@gmail.com \
    --to=orontee@gmail.com \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.