From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#21383: Static revisions in vc-working-revision Date: Fri, 4 Sep 2015 01:32:14 +0300 Message-ID: <55E8CA6E.6070002@yandex.ru> References: <55E41499.5030501@yandex.ru> <55E5094A.3010108@yandex.ru> <55E59487.1050804@yandex.ru> <55E5CA42.1080005@yandex.ru> <55E5DF1A.9010902@yandex.ru> <55E6D426.10105@yandex.ru> <55E84382.3030209@yandex.ru> <55E89436.7050603@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1441319602 18539 80.91.229.3 (3 Sep 2015 22:33:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Sep 2015 22:33:22 +0000 (UTC) Cc: 21383-done@debbugs.gnu.org, Jonathan H To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 04 00:33:10 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZXd49-0004F0-CI for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Sep 2015 00:33:09 +0200 Original-Received: from localhost ([::1]:52339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXd49-0000Ls-55 for geb-bug-gnu-emacs@m.gmane.org; Thu, 03 Sep 2015 18:33:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXd46-0000Ld-0D for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2015 18:33:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXd42-00081C-Q8 for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2015 18:33:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXd42-000817-Ml for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2015 18:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZXd42-0001fF-Fi for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2015 18:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Sep 2015 22:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21383 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21383-done@debbugs.gnu.org id=D21383.14413195456260 (code D ref 21383); Thu, 03 Sep 2015 22:33:02 +0000 Original-Received: (at 21383-done) by debbugs.gnu.org; 3 Sep 2015 22:32:25 +0000 Original-Received: from localhost ([127.0.0.1]:48004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZXd3Q-0001ct-B1 for submit@debbugs.gnu.org; Thu, 03 Sep 2015 18:32:24 -0400 Original-Received: from mail-wi0-f171.google.com ([209.85.212.171]:37013) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZXd3N-0001ce-SJ for 21383-done@debbugs.gnu.org; Thu, 03 Sep 2015 18:32:22 -0400 Original-Received: by wicfx3 with SMTP id fx3so114985wic.0 for <21383-done@debbugs.gnu.org>; Thu, 03 Sep 2015 15:32:21 -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-type:content-transfer-encoding; bh=SwAkBamTouePvkr+E4VTriKzREnV2ddA6s28zdHlZC0=; b=sygLGAUaE4cdYmmfTF79T+lHmTnyeF150sILDVi2g5AtUd08L9AK7uKLkiXlcScYYc mWdr/YcKk9lfMPNinxoinefn7Ws9Tt1XXjOWtptqxoY6QYQkaL8a+5ptVrqoFR1Yh+V6 sODcYYBoOIEj6rcuTXQHyYl0ABbIwoaYGYFR4kX/JporXPrj1ozCstPlQbz1nDrYWFqD YR8/fiGO8zFRnpRUBiAbJVkKMrsoMZeY54j9SiSX7v/IsZNzuLqxBAKzHTc6IZZZj3Je avPRm++SiuuKgJ73fBAaw1dS+Iu7XTj6iz6UBlM+aBXNE47Yt2RvdH5e4DEaIAs5fkMp s8tQ== X-Received: by 10.181.25.234 with SMTP id it10mr982942wid.41.1441319541274; Thu, 03 Sep 2015 15:32:21 -0700 (PDT) Original-Received: from [10.9.0.103] (nat.webazilla.com. [78.140.128.228]) by smtp.googlemail.com with ESMTPSA id i7sm510775wib.15.2015.09.03.15.32.20 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 03 Sep 2015 15:32:20 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 Thunderbird/40.0 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:106134 Archived-At: On 09/03/2015 11:07 PM, Stefan Monnier wrote: > Also VC was designed when revisions were per-file, and the way we > extended it is to say that it's OK to have an out-of-date revision > number for a given file, if that file's content is the same in the > current revision. This might be one of the more annoying discrepancies, and one that's not too hard to improve. I wonder if I've missed any other good places to reset the root's properties. diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el index ec55867..a27c873 100644 --- a/lisp/vc/vc-dispatcher.el +++ b/lisp/vc/vc-dispatcher.el @@ -567,7 +567,10 @@ editing!" (if (string= buffer-file-name file) (vc-resynch-window file keep noquery reset-vc-info) (if (file-directory-p file) - (vc-resynch-buffers-in-directory file keep noquery reset-vc-info) + (progn + (when reset-vc-info + (vc-file-clearprops file)) + (vc-resynch-buffers-in-directory file keep noquery reset-vc-info)) (let ((buffer (get-file-buffer file))) (when buffer (with-current-buffer buffer diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 8a0f554..33d742c 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -254,15 +254,16 @@ matching the resulting Git log output, and KEYWORDS is a list of (vc-git--rev-parse "HEAD"))) (defun vc-git--symbolic-ref (file) - (or - (vc-file-getprop file 'vc-git-symbolic-ref) - (let* (process-file-side-effects - (str (vc-git--run-command-string nil "symbolic-ref" "HEAD"))) - (vc-file-setprop file 'vc-git-symbolic-ref - (if str - (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str) - (match-string 2 str) - str)))))) + (let ((root (vc-git-root file))) + (or + (vc-file-getprop root 'vc-git-symbolic-ref) + (let* (process-file-side-effects + (str (vc-git--run-command-string nil "symbolic-ref" "HEAD"))) + (vc-file-setprop root 'vc-git-symbolic-ref + (if str + (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str) + (match-string 2 str) + str))))))) (defun vc-git-mode-line-string (file) "Return a string for `vc-mode-line' to put in the mode line for FILE." diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index e674f0e..4bee8ad 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -493,12 +493,15 @@ status of this file. Otherwise, the value returned is one of: (defun vc-working-revision (file &optional backend) "Return the repository version from which FILE was checked out. If FILE is not registered, this function always returns nil." - (or (vc-file-getprop file 'vc-working-revision) - (progn - (setq backend (or backend (vc-responsible-backend file))) - (when backend - (vc-file-setprop file 'vc-working-revision - (vc-call-backend backend 'working-revision file)))))) + (unless backend (setq backend (vc-responsible-backend file))) + (when backend + (let* ((granularity (vc-call-backend backend 'revision-granularity)) + (prop-target (if (eq granularity 'repository) + (vc-call-backend backend 'root file) + file))) + (or (vc-file-getprop prop-target 'vc-working-revision) + (vc-file-setprop prop-target 'vc-working-revision + (vc-call-backend backend 'working-revision file)))))) ;; Backward compatibility. (define-obsolete-function-alias