From: Andrii Kolomoiets <andreyk.mad@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 43464@debbugs.gnu.org
Subject: bug#43464: 28.0.50; vc: Error calling vc-revert for repo root
Date: Fri, 18 Sep 2020 18:45:08 +0300 [thread overview]
Message-ID: <m2r1qzqebf.fsf@gmail.com> (raw)
In-Reply-To: <0b1c72d0-f8fb-a256-1563-1c43296c8edb@yandex.ru> (Dmitry Gutov's message of "Fri, 18 Sep 2020 16:30:05 +0300")
[-- Attachment #1: Type: text/plain, Size: 709 bytes --]
Dmitry Gutov <dgutov@yandex.ru> writes:
> On 18.09.2020 12:30, Andrii Kolomoiets wrote:
>> Calling `vc-git-revert` or `vc-hg-revert` directly with repo root or any
>> directory within repo works fine.
>
> True. That's how Git and Hg work anyway.
>
> I'm not saying the current situation is ideal, but we'd either have to
> give up any attempt to revert a directory (with a more appropriate
> message), or somehow differentiate between different backends where it
> would or wouldn't work.
BTW vc-revert is also works fine in Git repo when point is on
subdirectory. So for the vc-git only reverting repo root is not
working.
Please see attached patch which make it possible for vc-hg to revert
directory.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-vc-Treat-directory-as-registered.patch --]
[-- Type: text/x-patch, Size: 1705 bytes --]
From 47adbf50d6d3719a9fe9e350897b30917bc1220d Mon Sep 17 00:00:00 2001
From: Andrii Kolomoiets <andreyk.mad@gmail.com>
Date: Fri, 18 Sep 2020 18:38:19 +0300
Subject: [PATCH] vc: Treat directory as registered
* lisp/vc/vc-hg.el (vc-hg-registered): Treat directory as registered
* lisp/vc/vc.el (vc-register): Treat directory as unregistered
---
lisp/vc/vc-hg.el | 5 +++--
lisp/vc/vc.el | 3 ++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index cb0657e70a..fec2235446 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -222,8 +222,9 @@ vc-hg-update-on-retrieve-tag
(defun vc-hg-registered (file)
"Return non-nil if FILE is registered with hg."
(when (vc-hg-root file) ; short cut
- (let ((state (vc-hg-state file))) ; expensive
- (and state (not (memq state '(ignored unregistered)))))))
+ (or (file-directory-p file)
+ (let ((state (vc-hg-state file))) ; expensive
+ (and state (not (memq state '(ignored unregistered))))))))
(defun vc-hg-state (file)
"Hg-specific version of `vc-state'."
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 3852a64550..77ba97fb73 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1370,7 +1370,8 @@ vc-register
(let ((bname (get-file-buffer fname)))
(unless fname
(setq fname buffer-file-name))
- (when (vc-call-backend backend 'registered fname)
+ (when (and (not (file-directory-p fname))
+ (vc-call-backend backend 'registered fname))
(error "This file is already registered"))
;; Watch out for new buffers of size 0: the corresponding file
;; does not exist yet, even though buffer-modified-p is nil.
--
2.15.1
next prev parent reply other threads:[~2020-09-18 15:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 7:29 bug#43464: 28.0.50; vc: Error calling vc-revert for repo root Andrii Kolomoiets
2020-09-17 16:10 ` Lars Ingebrigtsen
2020-09-18 9:00 ` Dmitry Gutov
2020-09-18 9:30 ` Andrii Kolomoiets
2020-09-18 13:30 ` Dmitry Gutov
2020-09-18 15:45 ` Andrii Kolomoiets [this message]
2020-09-22 19:48 ` Dmitry Gutov
2020-09-24 7:15 ` Andrii Kolomoiets
2020-09-30 9:13 ` Andrii Kolomoiets
2020-10-04 22:32 ` Dmitry Gutov
2020-10-05 6:02 ` Andrii Kolomoiets
2020-10-05 10:19 ` Dmitry Gutov
2020-10-07 13:16 ` Andrii Kolomoiets
2020-10-07 22:47 ` Dmitry Gutov
2020-10-11 20:28 ` Andrii Kolomoiets
2020-10-13 11:59 ` Dmitry Gutov
2020-09-18 13:18 ` Lars Ingebrigtsen
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=m2r1qzqebf.fsf@gmail.com \
--to=andreyk.mad@gmail.com \
--cc=43464@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
/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).