From: Dmitry Gutov <dgutov@yandex.ru>
To: "Jérémie Courrèges-Anglas" <jca@wxcvbn.org>,
"Göktuğ Kayaalp" <self@gkayaalp.com>
Cc: 24082@debbugs.gnu.org
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 [thread overview]
Message-ID: <94d0e69e-a39f-fec6-3ebf-3863bb8f0fcd@yandex.ru> (raw)
In-Reply-To: <87zim5u2oy.fsf@ritchie.wxcvbn.org>
[-- Attachment #1: Type: text/plain, Size: 579 bytes --]
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.
[-- Attachment #2: bug-24082-2.patch --]
[-- Type: text/x-diff, Size: 6018 bytes --]
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."
next prev parent reply other threads:[~2016-10-15 21:36 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-26 20:02 bug#24082: 25.1; vc-dir for CVS repositories list all files as if from toplevel directory Göktuğ Kayaalp
2016-07-30 0:35 ` bug#24082: vc-dir changes working directory (git backend) Steve Revilak
2016-10-06 23:32 ` Dmitry Gutov
2016-08-28 20:17 ` bug#24082: [PATCH] Use ‘cvs update’ instead ‘cvs status’ for CVS *vc-dir* buffers Göktuğ Kayaalp
2016-10-06 23:25 ` Dmitry Gutov
2016-10-07 19:29 ` Göktuğ Kayaalp
2016-10-08 1:01 ` Dmitry Gutov
2016-10-08 1:04 ` Dmitry Gutov
2016-10-12 0:59 ` Dan Nicolaescu
2016-10-13 18:10 ` Göktuğ Kayaalp
2016-10-22 1:34 ` Dan Nicolaescu
2016-10-05 18:31 ` bug#24082: Update Göktuğ Kayaalp
2016-10-05 18:33 ` Eli Zaretskii
2016-10-07 14:45 ` bug#24082: 25.1; vc-dir for CVS repositories list all files as if from toplevel directory Jérémie Courrèges-Anglas
2016-10-08 0:38 ` Dmitry Gutov
2016-10-08 15:13 ` Jérémie Courrèges-Anglas
2016-10-08 20:06 ` Dmitry Gutov
2016-10-09 12:18 ` Göktuğ Kayaalp
2016-10-10 23:55 ` Dmitry Gutov
2016-10-11 2:09 ` Göktuğ Kayaalp
2016-10-11 7:51 ` Andreas Schwab
2016-10-11 8:51 ` Dmitry Gutov
2016-10-11 15:48 ` Göktuğ Kayaalp
2016-10-10 16:41 ` Jérémie Courrèges-Anglas
2016-10-13 18:47 ` Göktuğ Kayaalp
2016-10-14 20:33 ` Jérémie Courrèges-Anglas
2016-10-15 12:36 ` Dmitry Gutov
2016-10-15 13:20 ` Göktuğ Kayaalp
2016-10-15 14:06 ` Jérémie Courrèges-Anglas
2016-10-15 17:26 ` Göktuğ Kayaalp
2016-10-15 21:36 ` Dmitry Gutov [this message]
2016-10-16 0:03 ` Göktuğ Kayaalp
2016-10-16 12:38 ` Jérémie Courrèges-Anglas
2016-10-16 14:07 ` Dmitry Gutov
2016-10-16 14:23 ` Eli Zaretskii
2016-10-16 15:58 ` Dmitry Gutov
2016-10-16 17:58 ` Eli Zaretskii
2016-10-18 0:04 ` Dmitry Gutov
2016-10-18 17:35 ` Göktuğ Kayaalp
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=94d0e69e-a39f-fec6-3ebf-3863bb8f0fcd@yandex.ru \
--to=dgutov@yandex.ru \
--cc=24082@debbugs.gnu.org \
--cc=jca@wxcvbn.org \
--cc=self@gkayaalp.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).