From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#24082: 25.1; vc-dir for CVS repositories list all files as if from toplevel directory Date: Sun, 16 Oct 2016 00:36:41 +0300 Message-ID: <94d0e69e-a39f-fec6-3ebf-3863bb8f0fcd@yandex.ru> References: <87instda01.fsf@xi.bootis> <87zim5u2oy.fsf@ritchie.wxcvbn.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------F83DCCF7E7E26CB861383EB3" X-Trace: blaine.gmane.org 1476567522 11719 195.159.176.226 (15 Oct 2016 21:38:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 15 Oct 2016 21:38:42 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Thunderbird/50.0 Cc: 24082@debbugs.gnu.org To: =?UTF-8?Q?J=C3=A9r=C3=A9mie_?= =?UTF-8?Q?Courr=C3=A8ges-Anglas?= , =?UTF-8?Q?G=C3=B6ktu=C4=9F?= Kayaalp Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 15 23:38:36 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bvWet-0000lH-Br for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Oct 2016 23:38:23 +0200 Original-Received: from localhost ([::1]:53350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bvWev-0001VC-CO for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Oct 2016 17:38:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bvWdd-0000s1-9J for bug-gnu-emacs@gnu.org; Sat, 15 Oct 2016 17:37:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bvWda-0004U2-5G for bug-gnu-emacs@gnu.org; Sat, 15 Oct 2016 17:37:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54768) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bvWda-0004Tu-0f for bug-gnu-emacs@gnu.org; Sat, 15 Oct 2016 17:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bvWdZ-0003Jw-LX for bug-gnu-emacs@gnu.org; Sat, 15 Oct 2016 17:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Oct 2016 21:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24082 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 24082-submit@debbugs.gnu.org id=B24082.147656741212743 (code B ref 24082); Sat, 15 Oct 2016 21:37:01 +0000 Original-Received: (at 24082) by debbugs.gnu.org; 15 Oct 2016 21:36:52 +0000 Original-Received: from localhost ([127.0.0.1]:60958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bvWdQ-0003JS-50 for submit@debbugs.gnu.org; Sat, 15 Oct 2016 17:36:52 -0400 Original-Received: from mail-wm0-f44.google.com ([74.125.82.44]:35836) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bvWdO-0003JF-B2 for 24082@debbugs.gnu.org; Sat, 15 Oct 2016 17:36:50 -0400 Original-Received: by mail-wm0-f44.google.com with SMTP id c78so43632488wme.0 for <24082@debbugs.gnu.org>; Sat, 15 Oct 2016 14:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=Tn7Ugiz75o7P1XBISWt0+8ZMx/FMG12MyiL30cNJumg=; b=JHj7PAuLBSFvkgutyMl0kUD25NEH4Abjwy3qlpOZrvHj0JtJHpAyqMFP/zrX83XP/N 3wj3gSj9HwuvzGXtNblYLp8uzKuNRXWRv1OwpyddSB31Hma5g9NcZiXwMg4DHq04hUSw RuPp9CgP7k6wr4pMYIbTb9hxS4Ny1arGeJn2BaJVC0HwfBh9x2bGxmHmqE61czgv5D0L SmYgtg53Gk0FXXc2RnxI5Ku/2UJRjCcrWTQ7euuohGzG8GEd192rf/zh7vpHyfHS5Wq/ lNXEksw4Xnl0DyW3h+x1lj2rmyFLYSw9mh7bg6Uu/8e4UelPZX8iyeL2oAMEl+OvITGs oi4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-language; bh=Tn7Ugiz75o7P1XBISWt0+8ZMx/FMG12MyiL30cNJumg=; b=AsyXTH55sw0IJ7h0y5j+sfRKZic9TvCIF4912LVzG+omXGnZQ5X5tXjmONBqTB+aBJ hlSmFgYc0+mRyLqTLcs2QlDL3dyIbxgf8k2P+UxhBhcredazij4GjxAqbQR54p9fHUhz MAuYlzzlCZLhwTZVto6lvcfEsy3nMofbRySkdXKYQV/YblkV1V57WHFiTEcvf5nEShpg Du5aZGEtaVuaUtDthD9ClzaqlezRm722KGinPHJMpVUyrodFdTovdbyf7vQlgph6KsLA wmlzf5CEe7xAR1oXNWqRO3rjxiGA3J5TnZozF7SWhsmDld1weLlXPwFWzZmUcguHiNb/ iZUw== X-Gm-Message-State: AA6/9Rl5R87K34qkprxVlaRiTECdcH91tP8C6dpahgLpFOj0jOniIm2vngeJdJtShxeObg== X-Received: by 10.28.148.200 with SMTP id w191mr2849677wmd.43.1476567404479; Sat, 15 Oct 2016 14:36:44 -0700 (PDT) Original-Received: from [192.168.1.3] ([185.105.173.41]) by smtp.googlemail.com with ESMTPSA id w124sm5210798wme.24.2016.10.15.14.36.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Oct 2016 14:36:43 -0700 (PDT) In-Reply-To: <87zim5u2oy.fsf@ritchie.wxcvbn.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:124529 Archived-At: This is a multi-part message in MIME format. --------------F83DCCF7E7E26CB861383EB3 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 15.10.2016 17:06, Jérémie Courrèges-Anglas wrote: > You asked for the output of `cvs -fnq update', but in my tests the > actual command that is run seems to be `cvs -fnq update ./'. Could you both please try the attached modified patch. It removes the vc-expand-dirs call from vc-cvs-dir-status-files (its return value was unused anyway), and passes FILES unmodified to vc-cvs-command. We can be fairly sure that DIR is default-directory, so passing it in explicitly is unnecessary. Whenever that ceases to be the case, we'll have to update other backends as well. --------------F83DCCF7E7E26CB861383EB3 Content-Type: text/x-diff; name="bug-24082-2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="bug-24082-2.patch" diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index a2499a2..2134793 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -938,103 +938,32 @@ vc-cvs-parse-status (t 'edited)))))))) (defun vc-cvs-after-dir-status (update-function) - ;; Heavily inspired by vc-cvs-parse-status. AKA a quick hack. - ;; This needs a lot of testing. - (let ((status nil) - (status-str nil) - (file nil) - (result nil) - (missing nil) - (ignore-next nil) - (subdir default-directory)) + (let ((result nil) + (translation '((?? . unregistered) + (?A . added) + (?C . conflict) + (?M . edited) + (?P . needs-merge) + (?R . removed) + (?U . needs-update)))) (goto-char (point-min)) - (while - ;; Look for either a file entry, an unregistered file, or a - ;; directory change. - (re-search-forward - "\\(^=+\n\\([^=c?\n].*\n\\|\n\\)+\\)\\|\\(\\(^?? .*\n\\)+\\)\\|\\(^cvs status: \\(Examining\\|nothing\\) .*\n\\)" - nil t) - ;; FIXME: get rid of narrowing here. - (narrow-to-region (match-beginning 0) (match-end 0)) - (goto-char (point-min)) - ;; The subdir - (when (looking-at "cvs status: Examining \\(.+\\)") - (setq subdir (expand-file-name (match-string 1)))) - ;; Unregistered files - (while (looking-at "? \\(.*\\)") - (setq file (file-relative-name - (expand-file-name (match-string 1) subdir))) - (push (list file 'unregistered) result) - (forward-line 1)) - (when (looking-at "cvs status: nothing known about") - ;; We asked about a non existent file. The output looks like this: - - ;; cvs status: nothing known about `lisp/v.diff' - ;; =================================================================== - ;; File: no file v.diff Status: Unknown - ;; - ;; Working revision: No entry for v.diff - ;; Repository revision: No revision control file - ;; - - ;; Due to narrowing in this iteration we only see the "cvs - ;; status:" line, so just set a flag so that we can ignore the - ;; file in the next iteration. - (setq ignore-next t)) - ;; A file entry. - (when (re-search-forward "^File: \\(no file \\)?\\(.*[^ \t]\\)[ \t]+Status: \\(.*\\)" nil t) - (setq missing (match-string 1)) - (setq file (file-relative-name - (expand-file-name (match-string 2) subdir))) - (setq status-str (match-string 3)) - (setq status - (cond - ((string-match "Up-to-date" status-str) 'up-to-date) - ((string-match "Locally Modified" status-str) 'edited) - ((string-match "Needs Merge" status-str) 'needs-merge) - ((string-match "Needs \\(Checkout\\|Patch\\)" status-str) - (if missing 'missing 'needs-update)) - ((string-match "Locally Added" status-str) 'added) - ((string-match "Locally Removed" status-str) 'removed) - ((string-match "File had conflicts " status-str) 'conflict) - ((string-match "Unknown" status-str) 'unregistered) - (t 'edited))) - (if ignore-next - (setq ignore-next nil) - (unless (eq status 'up-to-date) - (push (list file status) result)))) - (goto-char (point-max)) - (widen)) - (funcall update-function result)) - ;; Alternative implementation: use the "update" command instead of - ;; the "status" command. - ;; (let ((result nil) - ;; (translation '((?? . unregistered) - ;; (?A . added) - ;; (?C . conflict) - ;; (?M . edited) - ;; (?P . needs-merge) - ;; (?R . removed) - ;; (?U . needs-update)))) - ;; (goto-char (point-min)) - ;; (while (not (eobp)) - ;; (if (looking-at "^[ACMPRU?] \\(.*\\)$") - ;; (push (list (match-string 1) - ;; (cdr (assoc (char-after) translation))) - ;; result) - ;; (cond - ;; ((looking-at "cvs update: warning: \\(.*\\) was lost") - ;; ;; Format is: - ;; ;; cvs update: warning: FILENAME was lost - ;; ;; U FILENAME - ;; (push (list (match-string 1) 'missing) result) - ;; ;; Skip the "U" line - ;; (forward-line 1)) - ;; ((looking-at "cvs update: New directory `\\(.*\\)' -- ignored") - ;; (push (list (match-string 1) 'unregistered) result)))) - ;; (forward-line 1)) - ;; (funcall update-function result))) - ) + (while (not (eobp)) + (if (looking-at "^[ACMPRU?] \\(.*\\)$") + (push (list (match-string 1) + (cdr (assoc (char-after) translation))) + result) + (cond + ((looking-at "cvs update: warning: \\(.*\\) was lost") + ;; Format is: + ;; cvs update: warning: FILENAME was lost + ;; U FILENAME + (push (list (match-string 1) 'missing) result) + ;; Skip the "U" line + (forward-line 1)) + ((looking-at "cvs update: New directory `\\(.*\\)' -- ignored") + (push (list (match-string 1) 'unregistered) result)))) + (forward-line 1)) + (funcall update-function result))) ;; Based on vc-cvs-dir-state-heuristic from Emacs 22. ;; FIXME does not mention unregistered files. @@ -1071,16 +1000,12 @@ vc-cvs-dir-status-files Query all files in DIR if files is nil." (let ((local (vc-cvs-stay-local-p dir))) (if (and (not files) local (not (eq local 'only-file))) - (vc-cvs-dir-status-heuristic dir update-function) - (if (not files) (setq files (vc-expand-dirs (list dir) 'CVS))) - (vc-cvs-command (current-buffer) 'async files "-f" "status") - ;; Alternative implementation: use the "update" command instead of - ;; the "status" command. - ;; (vc-cvs-command (current-buffer) 'async - ;; (file-relative-name dir) - ;; "-f" "-n" "update" "-d" "-P") - (vc-run-delayed - (vc-cvs-after-dir-status update-function))))) + (vc-cvs-dir-status-heuristic dir update-function)) + (vc-cvs-command (current-buffer) 'async + files + "-f" "-n" "-q" "update") + (vc-run-delayed + (vc-cvs-after-dir-status update-function)))) (defun vc-cvs-file-to-string (file) "Read the content of FILE and return it as a string." --------------F83DCCF7E7E26CB861383EB3--