bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25714: 25.1.91; make "update" flag work with vc-retrieve-tag in git


From: Tom Tromey
Subject: bug#25714: 25.1.91; make "update" flag work with vc-retrieve-tag in git and hg
Date: Mon, 13 Feb 2017 17:29:49 -0700

I noticed that both vc-git and vc-hg's implementation of vc-retrieve-tag
ignore the "update" field.  That is, switching branches asks me if I
want to update affected buffers, but my answer doesn't matter -- nothing
happens.

This patch fixes the bug by arranging for the two functions to call
vc-resynch-buffers-in-directory.

I tried this with a git repository and it seems to work fine.
I didn't try hg but the fix is identical, so I left it in.

commit 71fd3f800f88676ff3393852464197a86a28ed22
Author: Tom Tromey <address@hidden>
Date:   Mon Feb 13 17:24:04 2017 -0700

    Make vc-git and vc-hg revert buffers on branch switch
    
    * lisp/vc/vc-git.el (vc-git-retrieve-tag): Respect "update".
    * lisp/vc/vc-hg.el (vc-hg-retrieve-tag): Respect "update".

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index de07ea2..586394b 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1238,11 +1238,14 @@ vc-git-create-tag
              (vc-git-command nil 0 nil "checkout" "-b" name)
            (vc-git-command nil 0 nil "tag" name)))))
 
-(defun vc-git-retrieve-tag (dir name _update)
+(declare-function vc-resynch-buffers-in-directory "vc-dispatcher"
+                  (directory &optional keep noquery reset-vc-info))
+
+(defun vc-git-retrieve-tag (dir name update)
   (let ((default-directory dir))
     (vc-git-command nil 0 nil "checkout" name)
-    ;; FIXME: update buffers if `update' is true
-    ))
+    (when update
+      (vc-resynch-buffers-in-directory dir t t))))
 
 
 ;;; MISCELLANEOUS
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 2f9487c..ea61494 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -558,11 +558,15 @@ vc-hg-create-tag
     (and (vc-hg-command nil 0 nil "status")
          (vc-hg-command nil 0 nil (if branchp "bookmark" "tag") name))))
 
-(defun vc-hg-retrieve-tag (dir name _update)
+(declare-function vc-resynch-buffers-in-directory "vc-dispatcher"
+                  (directory &optional keep noquery reset-vc-info))
+
+(defun vc-hg-retrieve-tag (dir name update)
   "Retrieve the version tagged by NAME of all registered files at or below 
DIR."
   (let ((default-directory dir))
     (vc-hg-command nil 0 nil "update" name)
-    ;; FIXME: update buffers if `update' is true
+    (when update
+      (vc-resynch-buffers-in-directory dir t t))
     ;; TODO: update *vc-change-log* buffer so can see @ if --graph
     ))
 
Tom



In GNU Emacs 25.1.91.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.7)
 of 2017-02-02 built on bapiya
Repository revision: 7e02a477bbcabb4e65aeecade79b67357c0b9dae
Windowing system distributor 'Fedora Project', version 11.0.11901000
System Description:     Fedora release 25 (Twenty Five)

Configured using:
 'configure --prefix=/home/tromey/Emacs/install/ --with-modules'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES

Important settings:
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: VC dir

Minor modes in effect:
  vc-parent-buffer: *vc-dir*<trunk>
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  which-function-mode: t
  erc-services-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-netsplit-mode: t
  erc-hl-nicks-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  savehist-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Mark set
Press C-c C-c when you are done editing.
Enter a change comment.  Type C-c C-c when done
Mark set
Scanning for dabbrevs...done
Expansion found in ‘vc-git.el’
Mark set [2 times]
funcall-interactively: End of buffer
Checking in /home/tromey/Emacs/trunk/lisp/vc/vc-git.el 
/home/tromey/Emacs/trunk/lisp/vc/vc-hg.el...done
Hiding up-to-date and ignored items

Load-path shadows:
/home/tromey/.emacs.d/elpa/bubbles-0.5/bubbles hides 
/home/tromey/Emacs/install/share/emacs/25.1.91/lisp/play/bubbles

Features:
(highlight-refontification tabify man shadow emacsbug conf-mode
two-column iso-transl perl-mode sh-script executable cal-move nnregistry
python tramp-sh tramp tramp-compat tramp-loaddefs trampver ucs-normalize
make-mode etags cursor-sensor mhtml-mode org-bullets org-element
org-rmail org-mhe org-irc org-info org-gnus org-docview doc-view
image-mode org-bibtex bibtex org-bbdb org-w3m org org-macro org-footnote
org-pcomplete org-list org-faces org-entities org-version ob-emacs-lisp
ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys ob-comint
ob-core ob-eval org-compat org-macs org-loaddefs gnus-fun gnus-draft
noutline outline ido skeleton css-mode smie eww url-queue trace
find-dired descr-text gdb-shell lisp-mnt url-handlers url-http url-gw
url-auth lex edebug debug m4-mode bbdb-sc supercite regi xref project
log-edit js json map sgml-mode flow-fill gnus-html xml url-cache mm-url
url url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf eieio-opt speedbar sb-image ezimage dframe find-func
whitespace tcl log-view pcvs-util vc-annotate term/xterm xterm
smerge-mode goto-addr shell find-file idutils derived bug-reference
cc-mode cc-fonts cc-guess cc-menus cc-cmds jka-compr mailalias mail-hist
nnir sort gnus-cite smiley shr-color url-util url-parse url-vars shr dom
subr-x browse-url mm-archive gnus-async gnus-bcklg qp gnus-ml disp-table
gnus-topic nndraft nnmh nnfolder utf-7 bbdb-gnus bbdb-mua bbdb-com crm
network-stream nsm starttls gnus-agent gnus-srvr gnus-score score-mode
nnvirtual gnus-msg nntp gnus-cache gnus-registry registry eieio-compat
eieio-base gnus-art mm-uu mml2015 mm-view mml-smime smime dig mailcap
gnus-sum gnus-group gnus-undo smtpmail gnus-start gnus-cloud nnimap
nnmail mail-source tls gnutls utf7 netrc nnoo parse-time gnus-spec
gnus-int gnus-range gnus-win gnus gnus-ems nnheader bbdb-message
sendmail mail-extr message idna dired rfc822 mml mml-sec epg mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
mailabbrev mail-utils gmm-utils mailheader gud dwarf-mode copyright
dabbrev misearch multi-isearch vc-mtn vc-hg vc-bzr vc-src vc-sccs vc-svn
vc-cvs vc-rcs add-log rx vc-git diff-mode easy-mmode rust-mode flyspell
ispell diminish edmacro kmacro projectile grep compile ibuf-ext ibuffer
dash appt diary-lib diary-loaddefs cal-menu calendar cal-loaddefs
which-func imenu minimap autorevert filenotify cus-start cus-load status
erc-services erc-list erc-menu erc-join erc-ring erc-networks
erc-pcomplete pcomplete erc-track erc-match erc-netsplit erc-hl-nicks
color erc-button erc-fill erc-stamp wid-edit erc-goodies erc erc-backend
erc-compat format-spec auth-source eieio gnus-util mm-util help-fns
mail-prsvr password-cache thingatpt pp warnings advice vc-dir ewoc vc
vc-dispatcher cc-styles cc-align cc-engine cc-vars cc-defs bbdb
bbdb-site timezone ange-ftp comint ansi-color ring server savehist
finder-inf dwarf-mode-autoloads gdb-shell-autoloads eieio-core
lisppaste-autoloads pydoc-info-autoloads info-look cl-seq cl-macs cl
weblogger-autoloads info package epg-config seq byte-opt gv bytecomp
byte-compile cl-extra help-mode easymenu cconv cl-loaddefs pcase cl-lib
bbdb-loaddefs time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 2672282 559824)
 (symbols 48 139805 570)
 (miscs 40 33896 10129)
 (strings 32 580990 184586)
 (string-bytes 1 17139401)
 (vectors 16 139173)
 (vector-slots 8 2882591 119459)
 (floats 8 936 1079)
 (intervals 56 326060 17233)
 (buffers 976 359))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]