unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git commit --amend)
@ 2019-11-23 10:01 Fredrik Nyqvist
  2019-11-25 11:48 ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Fredrik Nyqvist @ 2019-11-23 10:01 UTC (permalink / raw)
  To: 38343

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

Hi,

I would like to use vc mode to edit an outgoing commit message.

Steps to reproduce:
1. emacs -Q /path/to/git/repo
2. Edit a file and then
3. Run vc-next-action to create a commit: C-x v v
4. Write a commit message and end with C-c C-c
5. Now Open the outgoing log (vc-log-outgoing) : C-x v O
6. Try to edit the commit message (log-view-modify-change-comment): e

This message is printed:

log-view-current-file: Unable to determine the current file


In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
 of 2019-11-23 built on gnu
Repository revision: 6d4d00c63417e3479e978a373f252b9f2709ce39
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)

Recent messages:
Auto-saving...done
Specified image bit depth is not supported by XRender [2 times]

Configured features:
XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY
LIBSELINUX GNUTLS FREETYPE HARFBUZZ XFT ZLIB TOOLKIT_SCROLL_BARS GTK3
X11 XDBE XIM MODULES THREADS PDUMPER GMP

Important settings:
  value of $LANG: sv_SE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Dired by name

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(help-mode pp shadow sort mail-extr emacsbug message rmc puny
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
dired dired-loaddefs tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame minibuffer 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 composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
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 threads 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 49936 10334)
 (symbols 48 6110 0)
 (strings 32 15815 1297)
 (string-bytes 1 516576)
 (vectors 16 10114)
 (vector-slots 8 132119 14836)
 (floats 8 23 70)
 (intervals 56 347 6)
 (buffers 1000 16))

[-- Attachment #2: Type: text/html, Size: 3637 bytes --]

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

* bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git commit --amend)
  2019-11-23 10:01 bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git commit --amend) Fredrik Nyqvist
@ 2019-11-25 11:48 ` Dmitry Gutov
  2019-11-25 20:16   ` Fredrik Nyqvist
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2019-11-25 11:48 UTC (permalink / raw)
  To: Fredrik Nyqvist, 38343

On 23.11.2019 12:01, Fredrik Nyqvist wrote:

> I would like to use vc mode to edit an outgoing commit message.
> 
> Steps to reproduce:
> 1. emacs -Q /path/to/git/repo
> 2. Edit a file and then
> 3. Run vc-next-action to create a commit: C-x v v
> 4. Write a commit message and end with C-c C-c
> 5. Now Open the outgoing log (vc-log-outgoing) : C-x v O
> 6. Try to edit the commit message (log-view-modify-change-comment): e
> 
> This message is printed:
> 
> log-view-current-file: Unable to determine the current file

Yes. This feature seems unfinished, and it was never updated for the 
newer VC systems.

However, we have an option for amending the last commit (press C-x C-e 
in an already open log-edit buffer). It only works with Git and Hg now.

It would be good to unify these two features somehow.





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

* bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git commit --amend)
  2019-11-25 11:48 ` Dmitry Gutov
@ 2019-11-25 20:16   ` Fredrik Nyqvist
  2019-11-25 22:49     ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Fredrik Nyqvist @ 2019-11-25 20:16 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 38343

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

Yes, I have tried the option you mention to edit the last commit with C-x
C-e and it is working fine.
But It seems that it only allows amending the last commit if I have edited
a file.

As I understand it I need to edit a file and then do vc-next-action to get
to the log-edit buffer
where you can do C-x C-e.

I could not find a way to do this if just the commit message is supposed to
be updated.

Den mån 25 nov. 2019 kl 12:48 skrev Dmitry Gutov <dgutov@yandex.ru>:

> On 23.11.2019 12:01, Fredrik Nyqvist wrote:
>
> > I would like to use vc mode to edit an outgoing commit message.
> >
> > Steps to reproduce:
> > 1. emacs -Q /path/to/git/repo
> > 2. Edit a file and then
> > 3. Run vc-next-action to create a commit: C-x v v
> > 4. Write a commit message and end with C-c C-c
> > 5. Now Open the outgoing log (vc-log-outgoing) : C-x v O
> > 6. Try to edit the commit message (log-view-modify-change-comment): e
> >
> > This message is printed:
> >
> > log-view-current-file: Unable to determine the current file
>
> Yes. This feature seems unfinished, and it was never updated for the
> newer VC systems.
>
> However, we have an option for amending the last commit (press C-x C-e
> in an already open log-edit buffer). It only works with Git and Hg now.
>

It would be good to unify these two features somehow.
>

[-- Attachment #2: Type: text/html, Size: 1938 bytes --]

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

* bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git commit --amend)
  2019-11-25 20:16   ` Fredrik Nyqvist
@ 2019-11-25 22:49     ` Dmitry Gutov
  2019-11-26 20:43       ` Fredrik Nyqvist
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2019-11-25 22:49 UTC (permalink / raw)
  To: Fredrik Nyqvist; +Cc: 38343

On 25.11.2019 22:16, Fredrik Nyqvist wrote:
> Yes, I have tried the option you mention to edit the last commit with 
> C-x C-e and it is working fine.
> But It seems that it only allows amending the last commit if I have 
> edited a file.

Yes. Not sure how to change an arbitrary commit in Git anyway (without 
interactive rebase). The best approximation looks like this:

https://stackoverflow.com/a/48999882/615245

> As I understand it I need to edit a file and then do vc-next-action to 
> get to the log-edit buffer
> where you can do C-x C-e.

Yes.

> I could not find a way to do this if just the commit message is supposed 
> to be updated.

And that is indeed the main downside of our current solution.

(The way to do it is to edit, call vc-next-action, then undo the edit in 
the file, but commit the amended message anyway. Which could be more 
efficient).





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

* bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git commit --amend)
  2019-11-25 22:49     ` Dmitry Gutov
@ 2019-11-26 20:43       ` Fredrik Nyqvist
  2019-11-27  0:10         ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Fredrik Nyqvist @ 2019-11-26 20:43 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 38343

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

Den mån 25 nov. 2019 kl 23:49 skrev Dmitry Gutov <dgutov@yandex.ru>:

> On 25.11.2019 22:16, Fredrik Nyqvist wrote:
> > Yes, I have tried the option you mention to edit the last commit with
> > C-x C-e and it is working fine.
> > But It seems that it only allows amending the last commit if I have
> > edited a file.
>
> Yes. Not sure how to change an arbitrary commit in Git anyway (without
> interactive rebase). The best approximation looks like this:
>
> https://stackoverflow.com/a/48999882/615245


I am not sure how to do it in a good way either. Maybe the option to edit
an
older commit message could be skipped for vc-git. And then just allow amend
on the latest one.

[-- Attachment #2: Type: text/html, Size: 1198 bytes --]

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

* bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git commit --amend)
  2019-11-26 20:43       ` Fredrik Nyqvist
@ 2019-11-27  0:10         ` Dmitry Gutov
  2019-11-27 20:11           ` Fredrik Nyqvist
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2019-11-27  0:10 UTC (permalink / raw)
  To: Fredrik Nyqvist; +Cc: 38343

On 26.11.2019 22:43, Fredrik Nyqvist wrote:
> Den mån 25 nov. 2019 kl 23:49 skrev Dmitry Gutov <dgutov@yandex.ru 
> <mailto:dgutov@yandex.ru>>:
> 
>     On 25.11.2019 22:16, Fredrik Nyqvist wrote:
>      > Yes, I have tried the option you mention to edit the last commit
>     with
>      > C-x C-e and it is working fine.
>      > But It seems that it only allows amending the last commit if I have
>      > edited a file.
> 
>     Yes. Not sure how to change an arbitrary commit in Git anyway (without
>     interactive rebase). The best approximation looks like this:
> 
>     https://stackoverflow.com/a/48999882/615245
> 
> 
> I am not sure how to do it in a good way either. Maybe the option to 
> edit an
> older commit message could be skipped for vc-git. And then just allow amend
> on the latest one.

The question is how to skip. Error in the end, after the user has 
already written the new commit message?

Or add a backend predicate action, like "can edit revision ##". That's 
one more action, though.





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

* bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git commit --amend)
  2019-11-27  0:10         ` Dmitry Gutov
@ 2019-11-27 20:11           ` Fredrik Nyqvist
  2019-11-27 22:08             ` Dmitry Gutov
  0 siblings, 1 reply; 9+ messages in thread
From: Fredrik Nyqvist @ 2019-11-27 20:11 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 38343

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

Den ons 27 nov. 2019 kl 01:10 skrev Dmitry Gutov <dgutov@yandex.ru>:

> On 26.11.2019 22:43, Fredrik Nyqvist wrote:
> > Den mån 25 nov. 2019 kl 23:49 skrev Dmitry Gutov <dgutov@yandex.ru
> > <mailto:dgutov@yandex.ru>>:
> >
> >     On 25.11.2019 22:16, Fredrik Nyqvist wrote:
> >      > Yes, I have tried the option you mention to edit the last commit
> >     with
> >      > C-x C-e and it is working fine.
> >      > But It seems that it only allows amending the last commit if I
> have
> >      > edited a file.
> >
> >     Yes. Not sure how to change an arbitrary commit in Git anyway
> (without
> >     interactive rebase). The best approximation looks like this:
> >
> >     https://stackoverflow.com/a/48999882/615245
> >
> >
> > I am not sure how to do it in a good way either. Maybe the option to
> > edit an
> > older commit message could be skipped for vc-git. And then just allow
> amend
> > on the latest one.
>
> The question is how to skip. Error in the end, after the user has
> already written the new commit message?
>
> Or add a backend predicate action, like "can edit revision ##". That's
> one more action, though.
>

If the user is trying to edit an older commit message from the log-buffer
(with log-view-modify-change-comment) I think an error message is good,
before writing the commit message ("can't edit revision ##"). I feel that
it will be more clear at least.

Also we should think about how to handle a commit that has already been
pushed. In this case I guess a force push is needed, but maybe that is not
good to hide. Maybe it is better to just allow edit on local commits then.

[-- Attachment #2: Type: text/html, Size: 2390 bytes --]

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

* bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git commit --amend)
  2019-11-27 20:11           ` Fredrik Nyqvist
@ 2019-11-27 22:08             ` Dmitry Gutov
  2019-11-28 20:48               ` Fredrik Nyqvist
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Gutov @ 2019-11-27 22:08 UTC (permalink / raw)
  To: Fredrik Nyqvist; +Cc: 38343

On 27.11.2019 22:11, Fredrik Nyqvist wrote:
> 
> 
> Den ons 27 nov. 2019 kl 01:10 skrev Dmitry Gutov <dgutov@yandex.ru 
> <mailto:dgutov@yandex.ru>>:
> 
>     On 26.11.2019 22:43, Fredrik Nyqvist wrote:
>      > Den mån 25 nov. 2019 kl 23:49 skrev Dmitry Gutov
>     <dgutov@yandex.ru <mailto:dgutov@yandex.ru>
>      > <mailto:dgutov@yandex.ru <mailto:dgutov@yandex.ru>>>:
>      >
>      >     On 25.11.2019 22:16, Fredrik Nyqvist wrote:
>      >      > Yes, I have tried the option you mention to edit the last
>     commit
>      >     with
>      >      > C-x C-e and it is working fine.
>      >      > But It seems that it only allows amending the last commit
>     if I have
>      >      > edited a file.
>      >
>      >     Yes. Not sure how to change an arbitrary commit in Git anyway
>     (without
>      >     interactive rebase). The best approximation looks like this:
>      >
>      > https://stackoverflow.com/a/48999882/615245
>      >
>      >
>      > I am not sure how to do it in a good way either. Maybe the option to
>      > edit an
>      > older commit message could be skipped for vc-git. And then just
>     allow amend
>      > on the latest one.
> 
>     The question is how to skip. Error in the end, after the user has
>     already written the new commit message?
> 
>     Or add a backend predicate action, like "can edit revision ##". That's
>     one more action, though.
> 
> 
> If the user is trying to edit an older commit message from the 
> log-buffer (with log-view-modify-change-comment) I think an error 
> message is good, before writing the commit message ("can't edit revision 
> ##"). I feel that it will be more clear at least.

Then it seems like we'd also have to introduce a new predicate backend 
action (like "can I edit this revision"). Given a recent discussion with 
our maintainer, I'm not confident we're allowed to do that.

> Also we should think about how to handle a commit that has already been 
> pushed. In this case I guess a force push is needed, but maybe that is 
> not good to hide. Maybe it is better to just allow edit on local commits 
> then.

Yeah, it's going to be a choice. Sometimes editing even a commit that's 
been pushed is okay (if it's on a personal branch). We already allow 
doing that with 'C-x C-e', so I'd rather we only gave out a warning 
(with yes-no prompt). The aforementioned predicate could do that job, too.





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

* bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git commit --amend)
  2019-11-27 22:08             ` Dmitry Gutov
@ 2019-11-28 20:48               ` Fredrik Nyqvist
  0 siblings, 0 replies; 9+ messages in thread
From: Fredrik Nyqvist @ 2019-11-28 20:48 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 38343

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

Den ons 27 nov. 2019 kl 23:08 skrev Dmitry Gutov <dgutov@yandex.ru>:

> On 27.11.2019 22:11, Fredrik Nyqvist wrote:
> >
> >
> > Den ons 27 nov. 2019 kl 01:10 skrev Dmitry Gutov <dgutov@yandex.ru
> > <mailto:dgutov@yandex.ru>>:
> >
> >     On 26.11.2019 22:43, Fredrik Nyqvist wrote:
> >      > Den mån 25 nov. 2019 kl 23:49 skrev Dmitry Gutov
> >     <dgutov@yandex.ru <mailto:dgutov@yandex.ru>
> >      > <mailto:dgutov@yandex.ru <mailto:dgutov@yandex.ru>>>:
> >      >
> >      >     On 25.11.2019 22:16, Fredrik Nyqvist wrote:
> >      >      > Yes, I have tried the option you mention to edit the last
> >     commit
> >      >     with
> >      >      > C-x C-e and it is working fine.
> >      >      > But It seems that it only allows amending the last commit
> >     if I have
> >      >      > edited a file.
> >      >
> >      >     Yes. Not sure how to change an arbitrary commit in Git anyway
> >     (without
> >      >     interactive rebase). The best approximation looks like this:
> >      >
> >      > https://stackoverflow.com/a/48999882/615245
> >      >
> >      >
> >      > I am not sure how to do it in a good way either. Maybe the option
> to
> >      > edit an
> >      > older commit message could be skipped for vc-git. And then just
> >     allow amend
> >      > on the latest one.
> >
> >     The question is how to skip. Error in the end, after the user has
> >     already written the new commit message?
> >
> >     Or add a backend predicate action, like "can edit revision ##".
> That's
> >     one more action, though.
> >
> >
> > If the user is trying to edit an older commit message from the
> > log-buffer (with log-view-modify-change-comment) I think an error
> > message is good, before writing the commit message ("can't edit revision
> > ##"). I feel that it will be more clear at least.
>
> Then it seems like we'd also have to introduce a new predicate backend
> action (like "can I edit this revision"). Given a recent discussion with
> our maintainer, I'm not confident we're allowed to do that.
>
> OK I understand.


> > Also we should think about how to handle a commit that has already been
> > pushed. In this case I guess a force push is needed, but maybe that is
> > not good to hide. Maybe it is better to just allow edit on local commits
> > then.
>
> Yeah, it's going to be a choice. Sometimes editing even a commit that's
> been pushed is okay (if it's on a personal branch). We already allow
> doing that with 'C-x C-e', so I'd rather we only gave out a warning
> (with yes-no prompt). The aforementioned predicate could do that job, too.
>

That sounds good to me. At least so that log-view-modify-change-comment
works the same way as 'C-x C-e'.

[-- Attachment #2: Type: text/html, Size: 4218 bytes --]

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

end of thread, other threads:[~2019-11-28 20:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-23 10:01 bug#38343: 27.0.50; vc git: Cannot edit outgoing log (like git commit --amend) Fredrik Nyqvist
2019-11-25 11:48 ` Dmitry Gutov
2019-11-25 20:16   ` Fredrik Nyqvist
2019-11-25 22:49     ` Dmitry Gutov
2019-11-26 20:43       ` Fredrik Nyqvist
2019-11-27  0:10         ` Dmitry Gutov
2019-11-27 20:11           ` Fredrik Nyqvist
2019-11-27 22:08             ` Dmitry Gutov
2019-11-28 20:48               ` Fredrik Nyqvist

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