unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25714: 25.1.91; make "update" flag work with vc-retrieve-tag in git and hg
@ 2017-02-14  0:29 Tom Tromey
  2017-02-14  1:07 ` Dmitry Gutov
  2017-02-25  4:02 ` bug#25714: done Tom Tromey
  0 siblings, 2 replies; 6+ messages in thread
From: Tom Tromey @ 2017-02-14  0:29 UTC (permalink / raw)
  To: 25714

[-- Attachment #1: Type: text/plain, Size: 450 bytes --]


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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: the patch --]
[-- Type: text/x-patch, Size: 1940 bytes --]

commit 71fd3f800f88676ff3393852464197a86a28ed22
Author: Tom Tromey <tom@tromey.com>
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
     ))
 

[-- Attachment #3: Type: text/plain, Size: 6689 bytes --]


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))

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#25714: 25.1.91; make "update" flag work with vc-retrieve-tag in git and hg
  2017-02-14  0:29 bug#25714: 25.1.91; make "update" flag work with vc-retrieve-tag in git and hg Tom Tromey
@ 2017-02-14  1:07 ` Dmitry Gutov
  2017-02-14  1:32   ` Tom Tromey
  2017-02-25  4:02 ` bug#25714: done Tom Tromey
  1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2017-02-14  1:07 UTC (permalink / raw)
  To: Tom Tromey, 25714

Hey Tom,

On 14.02.2017 02:29, Tom Tromey wrote:

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

Any idea why the (vc-resynch-buffer dir t t t) call at the end of 
vc-retrieve-tag doesn't do the job?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#25714: 25.1.91; make "update" flag work with vc-retrieve-tag in git and hg
  2017-02-14  1:07 ` Dmitry Gutov
@ 2017-02-14  1:32   ` Tom Tromey
  2017-02-14  1:47     ` Dmitry Gutov
  2017-02-17  1:03     ` Dmitry Gutov
  0 siblings, 2 replies; 6+ messages in thread
From: Tom Tromey @ 2017-02-14  1:32 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 25714, Tom Tromey

>>>>> "Dmitry" == Dmitry Gutov <dgutov@yandex.ru> writes:

Dmitry> Any idea why the (vc-resynch-buffer dir t t t) call at the end of
Dmitry> vc-retrieve-tag doesn't do the job?

I must have tested incorrectly, because when I revert my patch, it still
seems to work now :(
Sorry about that.  Maybe you should try it to be sure.

How about this patch, that just removes the comments?

Tom

commit 7f2bcbf75eca6e00a8a428d6c838945e01556c1b
Author: Tom Tromey <tom@tromey.com>
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): Remove comment.
    * lisp/vc/vc-hg.el (vc-hg-retrieve-tag): Remove comment.

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 0f58892..8a22d74 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1240,9 +1240,7 @@ vc-git-create-tag
 
 (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
-    ))
+    (vc-git-command nil 0 nil "checkout" name)))
 
 
 ;;; MISCELLANEOUS
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 2f9487c..8a2b077 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -76,7 +76,7 @@
 ;; - annotate-extract-revision-at-line ()      OK
 ;; TAG SYSTEM
 ;; - create-tag (dir name branchp)             OK
-;; - retrieve-tag (dir name update)            OK FIXME UPDATE BUFFERS
+;; - retrieve-tag (dir name update)            OK
 ;; MISCELLANEOUS
 ;; - make-version-backups-p (file)             ??
 ;; - previous-revision (file rev)              OK
@@ -562,7 +562,6 @@ vc-hg-retrieve-tag
   "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
     ;; TODO: update *vc-change-log* buffer so can see @ if --graph
     ))
 





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#25714: 25.1.91; make "update" flag work with vc-retrieve-tag in git and hg
  2017-02-14  1:32   ` Tom Tromey
@ 2017-02-14  1:47     ` Dmitry Gutov
  2017-02-17  1:03     ` Dmitry Gutov
  1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Gutov @ 2017-02-14  1:47 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 25714

On 14.02.2017 03:32, Tom Tromey wrote:
>>>>>> "Dmitry" == Dmitry Gutov <dgutov@yandex.ru> writes:
> 
> Dmitry> Any idea why the (vc-resynch-buffer dir t t t) call at the end of
> Dmitry> vc-retrieve-tag doesn't do the job?
> 
> I must have tested incorrectly, because when I revert my patch, it still
> seems to work now :(
> Sorry about that.  Maybe you should try it to be sure.

It works on the current buffer, but not on all files in the repository 
if you are not at the top level. Aside from comments, maybe the patch 
should look like this:

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index c66a092..085d781 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2170,7 +2170,9 @@ vc-retrieve-tag
        (if (eq granularity 'repository)
  	  ;; For VC's that do not work at file level, it's pointless
  	  ;; to ask for a directory, branches are created at repository level.
-	  default-directory
+          ;; XXX: Either we call expand-file-name here, or use
+          ;; file-in-directory-p inside vc-resynch-buffers-in-directory.
+	  (expand-file-name (vc-root-dir))
  	(read-directory-name "Directory: " default-directory 
default-directory t))
        (read-string "Tag name to retrieve (default latest revisions): "))))
    (let ((update (yes-or-no-p "Update any affected buffers? "))






^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#25714: 25.1.91; make "update" flag work with vc-retrieve-tag in git and hg
  2017-02-14  1:32   ` Tom Tromey
  2017-02-14  1:47     ` Dmitry Gutov
@ 2017-02-17  1:03     ` Dmitry Gutov
  1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Gutov @ 2017-02-17  1:03 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 25714

On 14.02.2017 03:32, Tom Tromey wrote:

> How about this patch, that just removes the comments?

Please go ahead and push it. I've just pushed mine.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#25714: done
  2017-02-14  0:29 bug#25714: 25.1.91; make "update" flag work with vc-retrieve-tag in git and hg Tom Tromey
  2017-02-14  1:07 ` Dmitry Gutov
@ 2017-02-25  4:02 ` Tom Tromey
  1 sibling, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2017-02-25  4:02 UTC (permalink / raw)
  To: 25714-done

This is fixed.

Tom





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-25  4:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-14  0:29 bug#25714: 25.1.91; make "update" flag work with vc-retrieve-tag in git and hg Tom Tromey
2017-02-14  1:07 ` Dmitry Gutov
2017-02-14  1:32   ` Tom Tromey
2017-02-14  1:47     ` Dmitry Gutov
2017-02-17  1:03     ` Dmitry Gutov
2017-02-25  4:02 ` bug#25714: done Tom Tromey

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).