From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: 21383-done@debbugs.gnu.org, Jonathan H <pythonnut@gmail.com>
Subject: bug#21383: Static revisions in vc-working-revision
Date: Fri, 4 Sep 2015 01:32:14 +0300 [thread overview]
Message-ID: <55E8CA6E.6070002@yandex.ru> (raw)
In-Reply-To: <jwv4mjbl15h.fsf-monnier+emacsbugs@gnu.org>
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
next prev parent reply other threads:[~2015-09-03 22:32 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-31 0:45 bug#21383: Static revisions in vc-working-revision Jonathan H
2015-08-31 4:45 ` Stefan Monnier
2015-08-31 8:47 ` Dmitry Gutov
2015-08-31 17:44 ` Stefan Monnier
2015-09-01 2:11 ` Dmitry Gutov
2015-09-01 3:55 ` Stefan Monnier
2015-09-01 12:05 ` Dmitry Gutov
2015-09-01 15:45 ` Stefan Monnier
2015-09-01 15:54 ` Dmitry Gutov
2015-09-01 16:52 ` Stefan Monnier
2015-09-01 17:23 ` Dmitry Gutov
2015-09-02 3:50 ` Stefan Monnier
2015-09-02 10:49 ` Dmitry Gutov
2015-09-02 22:44 ` Jonathan H
2015-09-03 12:56 ` Dmitry Gutov
2015-09-03 16:17 ` Stefan Monnier
2015-09-03 17:34 ` Jonathan H
2015-09-03 18:40 ` Dmitry Gutov
2015-09-03 20:07 ` Stefan Monnier
2015-09-03 22:32 ` Dmitry Gutov [this message]
2015-09-04 14:36 ` Stefan Monnier
2015-09-05 2:30 ` Dmitry Gutov
2015-09-03 16:04 ` Stefan Monnier
2015-09-03 19:24 ` Dmitry Gutov
2015-09-04 2:20 ` Stefan Monnier
2015-09-05 3:08 ` Dmitry Gutov
2015-09-05 15:12 ` Stefan Monnier
2015-09-05 20:30 ` Dmitry Gutov
2015-09-06 22:29 ` Stefan Monnier
2015-09-07 20:55 ` Using different default-directory and relative paths in VC, Was: Re: bug#21383 Dmitry Gutov
2015-09-07 22:33 ` Stefan Monnier
2015-09-07 23:29 ` Dmitry Gutov
2015-09-07 23:34 ` Dmitry Gutov
2015-09-08 1:31 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55E8CA6E.6070002@yandex.ru \
--to=dgutov@yandex.ru \
--cc=21383-done@debbugs.gnu.org \
--cc=monnier@IRO.UMontreal.CA \
--cc=pythonnut@gmail.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.