unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20558: 24.4; vc-revert on deleted file (git and svn should be more consistent)
@ 2015-05-12 15:13 Ed Avis
  2015-11-25  2:42 ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Ed Avis @ 2015-05-12 15:13 UTC (permalink / raw)
  To: 20558

Visit a file in a git or svn checkout.  Unknown to emacs, delete that
file.  Then do vc-revert to get back the original contents from version
control.

When vc-mode is used with a Subversion working copy, reverting a file
which has vanished on disk (but where the buffer is not marked as
modified) will just get a fresh copy and put it in the buffer.  That is
perhaps not ideal because it loses local changes.

When vc-mode is used with git, on reverting a file which no longer exists
on disk (where the buffer is not marked as modified), a diff is shown between the
empty file and the current contents in version control.  That is not a
particularly helpful diff to show the user.

If the file no longer exists on disk, then I suggest vc-revert
should act as follows:

- If the buffer is marked as modified, offer to save it, and after
  saving show diffs and prompt to revert as usual.

- If the buffer is not marked as modified, a diff should still be shown
  between the current buffer contents and what would be fetched from the
  version control system to replace it.  If that diff is empty, then
  just go ahead and revert.

Or alternatively, vc-revert should just automatically save-buffer first
if the underlying file no longer exists on disk.




In GNU Emacs 24.4.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.10.9)
 of 2014-11-03 on wcl-linux04.wcl.local
Configured using:
 `configure --build=x86_64-redhat-linux-gnu
 --host=x86_64-redhat-linux-gnu --program-prefix=
 --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
 --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
 --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
 --libexecdir=/usr/libexec --localstatedir=/var
 --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png
 --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3
 --with-gpm=no build_alias=x86_64-redhat-linux-gnu
 host_alias=x86_64-redhat-linux-gnu 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
 -fstack-protector-strong --param=ssp-buffer-size=4
 -grecord-gcc-switches -m64 -mtune=generic' 'LDFLAGS=-Wl,-z,relro ''

Important settings:
  value of $LC_COLLATE: C
  value of $LC_CTYPE: en_GB.UTF-8
  value of $LC_MESSAGES: en_GB.UTF-8
  value of $LC_MONETARY: en_GB.UTF-8
  value of $LC_NUMERIC: en_GB.UTF-8
  value of $LC_TIME: en_GB.UTF-8
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: nXML

Minor modes in effect:
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  tooltip-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
  line-number-mode: t
  transient-mark-mode: t

Recent input:
e e C-n C-n C-p C-x e e C-n C-n C-p C-x e e e C-n C-x 
e C-n C-x e e e C-n C-n C-n C-n C-x e C-x v u y e s 
DEL DEL y e s RET C-f C-f C-f C-f C-f C-f C-f C-f C-f 
C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f C-f 
C-f C-f C-f C-f C-d C-d C-d C-d C-d C-d C-d C-d C-d 
C-d C-a C-x C-s C-x v = C-x v v ESC p DEL DEL DEL DEL 
N Z . C-c C-c C-x o C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-x e e e e C-n C-x e e e C-n C-n C-n C-p C-x e e C-n 
C-n C-x e e C-n C-x e e C-n C-x e e e C-n C-x e C-n 
C-x e e e C-n C-n C-n C-n C-x e C-n C-x e C-n C-x e 
C-n C-x e e e e e e e e C-a C-x C-s ESC ! ESC p RET 
C-x o q ESC < C-s m s c i l o c a l C-a ESC ! m v SPC 
b u TAB . TAB DEL b u TAB DEL . i n _ p r o g r e s 
s SPC v DEL - v i RET C-x v u C-g ESC x e w p DEL DEL 
DEL r e p C-g C-h k C-x v u C-x o C-x o ESC x r e DEL 
DEL e DEL r e p o r t SPC e m SPC a DEL b SPC RET

Recent messages:
(Type e to repeat macro) [26 times]
Saving file /home/eda/git_working/repos/wwwroot/WaniSystems/Configuration/MarketSampler/jobs/build.trend.signals.xml...
Wrote /home/eda/git_working/repos/wwwroot/WaniSystems/Configuration/MarketSampler/jobs/build.trend.signals.xml
(Shell command succeeded with no output)
Mark set
Mark saved where search started
'build.trend.signals.xml' -> 'build.trend.signals.xml.in_progress'
Finding changes in /home/eda/git_working/repos/wwwroot/WaniSystems/Configuration/MarketSampler/jobs/build.trend.signals.xml...
Quit [2 times]
Type C-x 1 to delete the help window.

Load-path shadows:
None found.

Features:
(shadow sort emacsbug sendmail eieio-opt speedbar sb-image ezimage
dframe find-func sgml-mode warnings dired-aux nroff-mode macros etags
pcmpl-gnu sh-script smie executable pcmpl-rpm mule-util ispell conf-mode
rect python json smerge-mode network-stream starttls tls sql view dired
mail-extr edmacro kmacro vc-bzr vc-sccs vc-svn vc-cvs vc-rcs tabify
imenu man pcmpl-x diff-mode log-view vc vc-dispatcher cus-edit wid-edit
cus-start cus-load perl-mode help-mode dabbrev misearch multi-isearch
vc-git nxml-uchnm rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid
rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn
nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc
xmltok ffap thingatpt url-parse auth-source eieio eieio-core gnus-util
password-cache url-vars pcmpl-unix xterm time-date log-edit easy-mmode
message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log server
csharp-mode advice help-fns byte-opt bytecomp byte-compile cconv
cc-langs cc-mode cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs zoom-frm frame-cmds frame-fns cl-macs
avoid cl gv cl-loaddefs cl-lib compile shell pcomplete comint ring
ansi-color tooltip electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer 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 make-network-process dbusbind gfilenotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)

Memory information:
((conses 16 2740808 222760)
 (symbols 48 31871 0)
 (miscs 40 1470 9493)
 (strings 32 94693 49984)
 (string-bytes 1 3524974)
 (vectors 16 44630)
 (vector-slots 8 1843880 104132)
 (floats 8 1680 1157)
 (intervals 56 396602 1450)
 (buffers 960 263)
 (heap 1024 118762 5547))

-- 
Ed Avis <eda@waniasset.com>
Please ignore autogenerated disclaimer below this line.

This email is intended only for the person to whom it is addressed and may contain confidential information. Any retransmission, copying, disclosure or other use of, this information by persons other than the intended recipient is prohibited. If you received this email in error, please contact the sender and delete the material. This email is for information only and is not intended as an offer or solicitation for the purchase or sale of any financial instrument. Wadhwani Asset Management LLP is a Limited Liability Partnership registered in England (OC303168) with registered office at 40 Berkeley Square, 3rd Floor, London, W1J 5AL. It is authorised and regulated by the Financial Conduct Authority.





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

* bug#20558: 24.4; vc-revert on deleted file (git and svn should be more consistent)
  2015-05-12 15:13 bug#20558: 24.4; vc-revert on deleted file (git and svn should be more consistent) Ed Avis
@ 2015-11-25  2:42 ` Dmitry Gutov
  2015-11-25 15:38   ` Ed Avis
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2015-11-25  2:42 UTC (permalink / raw)
  To: Ed Avis; +Cc: 20558

On 05/12/2015 06:13 PM, Ed Avis wrote:

> If the file no longer exists on disk, then I suggest vc-revert
> should act as follows:
>
> - If the buffer is marked as modified, offer to save it, and after
>    saving show diffs and prompt to revert as usual.

I believe we already do that. And if the user says no, the whole 
operation is aborted.

> - If the buffer is not marked as modified, a diff should still be shown
>    between the current buffer contents and what would be fetched from the
>    version control system to replace it.

That sounds a bit inconvenient to implement, and I guess I don't see a 
lot of benefit.

>  If that diff is empty, then
>    just go ahead and revert.

That goes against the main use case of vc-revert, as I see it: 
discarding uncommitted changes if you no longer want them.

> Or alternatively, vc-revert should just automatically save-buffer first
> if the underlying file no longer exists on disk.

That's doable. But then we'll also need to delete it afterwards if the 
user says no.






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

* bug#20558: 24.4; vc-revert on deleted file (git and svn should be more consistent)
  2015-11-25  2:42 ` Dmitry Gutov
@ 2015-11-25 15:38   ` Ed Avis
  2015-11-26 15:16     ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Ed Avis @ 2015-11-25 15:38 UTC (permalink / raw)
  To: 'Dmitry Gutov'; +Cc: 20558@debbugs.gnu.org

Thanks for looking into this bug.  I don't have a strong view on what the best behaviour would be, as long as it is *something* reasonable, and not just printing a diff of the contents against the empty file.
Having vc-revert save the buffer first if the file doesn't exist looks like a simple fix.

-- 
Ed Avis <eda@waniasset.com>
Please ignore autogenerated disclaimer below this point.

This email is intended only for the person to whom it is addressed and may contain confidential information. Any retransmission, copying, disclosure or other use of, this information by persons other than the intended recipient is prohibited. If you received this email in error, please contact the sender and delete the material. This email is for information only and is not intended as an offer or solicitation for the purchase or sale of any financial instrument. Wadhwani Asset Management LLP is a Limited Liability Partnership registered in England (OC303168) with registered office at 40 Berkeley Square, 3rd Floor, London, W1J 5AL. It is authorised and regulated by the Financial Conduct Authority.





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

* bug#20558: 24.4; vc-revert on deleted file (git and svn should be more consistent)
  2015-11-25 15:38   ` Ed Avis
@ 2015-11-26 15:16     ` Dmitry Gutov
  2016-04-08 18:06       ` Marcin Borkowski
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2015-11-26 15:16 UTC (permalink / raw)
  To: Ed Avis; +Cc: 20558-done@debbugs.gnu.org

Version: 25.1

On 11/25/2015 05:38 PM, Ed Avis wrote:

> Having vc-revert save the buffer first if the file doesn't exist looks like a simple fix.

All right, we now do something like that. Thanks for the suggestion.





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

* bug#20558: 24.4; vc-revert on deleted file (git and svn should be more consistent)
  2015-11-26 15:16     ` Dmitry Gutov
@ 2016-04-08 18:06       ` Marcin Borkowski
  0 siblings, 0 replies; 5+ messages in thread
From: Marcin Borkowski @ 2016-04-08 18:06 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Ed Avis, 20558

On 2015-11-26, at 16:16, Dmitry Gutov <dgutov@yandex.ru> wrote:

> Version: 25.1
>
> On 11/25/2015 05:38 PM, Ed Avis wrote:
>
>> Having vc-revert save the buffer first if the file doesn't exist looks like a simple fix.
>
> All right, we now do something like that. Thanks for the suggestion.

Hi,

does that mean that this bug can be closed?

-- 
Marcin





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

end of thread, other threads:[~2016-04-08 18:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-12 15:13 bug#20558: 24.4; vc-revert on deleted file (git and svn should be more consistent) Ed Avis
2015-11-25  2:42 ` Dmitry Gutov
2015-11-25 15:38   ` Ed Avis
2015-11-26 15:16     ` Dmitry Gutov
2016-04-08 18:06       ` Marcin Borkowski

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