From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrii Kolomoiets Newsgroups: gmane.emacs.bugs Subject: bug#43464: 28.0.50; vc: Error calling vc-revert for repo root Date: Fri, 18 Sep 2020 18:45:08 +0300 Message-ID: References: <0b1c72d0-f8fb-a256-1563-1c43296c8edb@yandex.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17964"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) Cc: 43464@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 18 17:56:43 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJIkc-0004Wu-2l for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Sep 2020 17:56:42 +0200 Original-Received: from localhost ([::1]:40614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJIkb-0001XZ-2D for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Sep 2020 11:56:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJIaI-0000RS-2P for bug-gnu-emacs@gnu.org; Fri, 18 Sep 2020 11:46:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60902) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJIaH-0007O5-Pm for bug-gnu-emacs@gnu.org; Fri, 18 Sep 2020 11:46:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kJIaH-0004EB-Oo for bug-gnu-emacs@gnu.org; Fri, 18 Sep 2020 11:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrii Kolomoiets Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Sep 2020 15:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43464 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 43464-submit@debbugs.gnu.org id=B43464.160044392013843 (code B ref 43464); Fri, 18 Sep 2020 15:46:01 +0000 Original-Received: (at 43464) by debbugs.gnu.org; 18 Sep 2020 15:45:20 +0000 Original-Received: from localhost ([127.0.0.1]:44215 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJIZb-0003au-EW for submit@debbugs.gnu.org; Fri, 18 Sep 2020 11:45:19 -0400 Original-Received: from mail-lf1-f50.google.com ([209.85.167.50]:36469) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJIZZ-0003TY-Ls for 43464@debbugs.gnu.org; Fri, 18 Sep 2020 11:45:18 -0400 Original-Received: by mail-lf1-f50.google.com with SMTP id x69so6626571lff.3 for <43464@debbugs.gnu.org>; Fri, 18 Sep 2020 08:45:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=6Eq9F2Q7qLsN/LCTkDwDsBzu0AU0WYvkdhVJcy0mr3E=; b=RtF7fuObJ9sGArlt/gwYk1jvmPtAuzRB1RAXeNwkwGIYfbHGFDotRe9oeKBjrqDm0D vPw/ZvQtDR+45cl8s+3TjvSqYPux/uPmGdS935kdy/uRTEqszYrl+Q/XcUnAK0YgsYGD gzEc3K8f4Z0iiH+8oh++W9quJIS/53Dr74+Xze8CglRVkSOs0AnxEyn3zD18VdWE68/G kjH9uBZhOowwAip6JANKRnI2AV7E1qhUhrVbuShcmvU62L/R51p5KWbgq0gMqwFCPlJH 0CFjKgc2Uenbd5Eekr8676urfgB15Lwj1c+t0SX3f17f0aiTT+y02Pw2YADU2/dt+xZB 9wOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=6Eq9F2Q7qLsN/LCTkDwDsBzu0AU0WYvkdhVJcy0mr3E=; b=dPezF06AtuVCdrNS5DYuqTpEYksLM32IFZwL/nQNTb6OYbYgULkn1Qft07C9HvnBrR oRuhqJYBqnv2OGD4Q7LMo1xGkI7sn7WwyEL41bRTQ648jJ1yJopsDtgw/YT9nM2/Lvfq QV1CzAHQzhK8v8/G4w1EaAnDsnEMkG7ct40f480ncBwzRBj9tudBaaDOWioV4hbU74kb dA1qvFIEiGtp3ERNoFYImM9O6BQB2ZDBNs/9LZBpPhLKkf66oQp6h9jUPCzNSSqkMEOw 4pNfau5viHA1RcqBbWjPw/PJ+KDzIkxKNEZistYngjfVME6GNctionUfRSQKCMZ9vU8r fPrw== X-Gm-Message-State: AOAM5303IopKl6e7GubGJ0JzXMtAVWX9jXGHImJNYS6rNYVi3akVEbs+ AFORdWaKRvuR3c9hNjylOhl+fM+HS4o= X-Google-Smtp-Source: ABdhPJxWMfQIMwW4LxQ7SFsKYMo2HGITY4uehI5MvkIUsW9nFOAmrzwncLqpitsEw5cxed3QluiMCg== X-Received: by 2002:ac2:529c:: with SMTP id q28mr9718222lfm.104.1600443911280; Fri, 18 Sep 2020 08:45:11 -0700 (PDT) Original-Received: from muffinmac ([91.206.110.141]) by smtp.gmail.com with ESMTPSA id 16sm680371ljr.3.2020.09.18.08.45.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Sep 2020 08:45:10 -0700 (PDT) In-Reply-To: <0b1c72d0-f8fb-a256-1563-1c43296c8edb@yandex.ru> (Dmitry Gutov's message of "Fri, 18 Sep 2020 16:30:05 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:188334 Archived-At: --=-=-= Content-Type: text/plain Dmitry Gutov 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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-vc-Treat-directory-as-registered.patch >From 47adbf50d6d3719a9fe9e350897b30917bc1220d Mon Sep 17 00:00:00 2001 From: Andrii Kolomoiets 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 --=-=-=--