[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch: first impression]
From: |
Uwe Brauer |
Subject: |
Re: [patch: first impression] |
Date: |
Tue, 11 Oct 2022 08:25:57 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
> On 10.10.2022 18:41, Uwe Brauer wrote:
> Another option is to use shelving.
Do you mean: the not committed hunks are shelved? My first reaction is:
that is counter intuitive (and commit-patch does not do this neither,
but commit patch is not very VC orientated anyhow).
But now that you mention it, mercurial also supports interactive
shelving (so to speak the inverse operation to interactive commit. I am
not sure that git has that feature).
So couldn't that also be included? That would be really great, since
commit-patch does not support it.
The binding could be either C-u vc-next-action or
something like this (just to explain the idea)
(defun toggle-commit-or-shelve-interactively ()
(interactive)
(with-output-to-temp-buffer "vc-list-buffer"
(princ "List of functions\n")
(princ "1: commit interactively\n")
(princ "2: shelv interactively \n"))
(let ((ch (string-to-char (read-string "Which choice: 1: 2: "))))
(call-interactively (cond ((eql ch ?1) #'vc-commit-interactively)
((eql ch ?2) #'vc-shelve-interactively)
(t (error 'args-out-of-range '(1 2 ch))))))
(kill-buffer "vc-list-buffer"))
> See the attached slightly different patch.
I will try to test this later (I presume I don't need to recompile the
whole emacs 😉; just kidding)
> It's probably the same as "detached HEAD" in Git.
Right the difference is, that, in my understanding, this HEAD will be
delete in the next garbage collection, while in mercurial it will stay..
> diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
> index f4a44df3c2..30c1453e42 100644
> --- a/lisp/vc/vc-hg.el
> +++ b/lisp/vc/vc-hg.el
> @@ -1185,19 +1185,38 @@ vc-hg-log-edit-mode
> "Major mode for editing Hg log messages.
> It is based on `log-edit-mode', and has Hg-specific extensions.")
> +(defvar vc-hg-patch-string nil)
> +
> (defun vc-hg-checkin (files comment &optional _rev)
> "Hg-specific version of `vc-backend-checkin'.
> REV is ignored."
> - (let ((amend-extract-fn
> - (lambda (value)
> - (when (equal value "yes")
> - (list "--amend")))))
> - (apply #'vc-hg-command nil 0 files
> - (nconc (list "commit" "-m")
> - (log-edit-extract-headers `(("Author" . "--user")
> - ("Date" . "--date")
> - ("Amend" . ,amend-extract-fn))
> - comment)))))
> + (apply #'vc-hg-command nil 0 files
> + (nconc (list "commit"
> + "-m")
> + (vc-hg--extract-headers comment))))
> +
> +(defun vc-hg-checkin-patch (patch-string comment)
> + (let ((patch-file (make-temp-file "hg-patch"))
> + (shelf-name (make-temp-name "vc-checkin-patch")))
> + (with-temp-file patch-file
> + (insert patch-string))
> + (vc-hg-command nil t nil "shelve" "-d" shelf-name)
> + (vc-hg-command nil 0 nil "shelve" "-n" shelf-name)
> + (unwind-protect
> + (apply #'vc-hg-command nil 0 nil
> + (nconc (list "import" patch-file "-m")
> + (vc-hg--extract-headers comment)))
> + (progn
> + (vc-hg-command nil 0 nil "unshelve" "-n" shelf-name)
> + (delete-file patch-file)))))
> +
> +(defun vc-hg--extract-headers (comment)
> + (log-edit-extract-headers `(("Author" . "--user")
> + ("Date" . "--date")
> + ("Amend" . (lambda (value)
> + (when (equal value "yes")
> + (list "--amend")))))
> + comment))
> (defun vc-hg-find-revision (file rev buffer)
> (let ((coding-system-for-read 'binary)
--
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military.
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine.
smime.p7s
Description: S/MIME cryptographic signature
- Re: log-edit-insert-changelog even when run git/hg from the, (continued)
- Re: log-edit-insert-changelog even when run git/hg from the, Dmitry Gutov, 2022/10/09
- Re: log-edit-insert-changelog even when run git/hg from the, Uwe Brauer, 2022/10/10
- Re: log-edit-insert-changelog even when run git/hg from the, Dmitry Gutov, 2022/10/10
- [Serious BUG in master 93136169cba] (was: log-edit-insert-changelog even when run git/hg from the), Uwe Brauer, 2022/10/10
- Re: [Serious BUG in master 93136169cba], Uwe Brauer, 2022/10/10
- [Confirmed] (was: [Serious BUG in master 93136169cba]), Uwe Brauer, 2022/10/10
- [patch: first impression] (was: log-edit-insert-changelog even when run git/hg from the), Uwe Brauer, 2022/10/10
- Re: [patch: first impression] (was: log-edit-insert-changelog even when run git/hg from the), Dmitry Gutov, 2022/10/10
- Re: [patch: first impression], Uwe Brauer, 2022/10/10
- Re: [patch: first impression], Dmitry Gutov, 2022/10/10
- Re: [patch: first impression],
Uwe Brauer <=
- Re: [patch: first impression], Dmitry Gutov, 2022/10/11
- Re: [patch: first impression], Uwe Brauer, 2022/10/11
- Re: [patch: first impression], Dmitry Gutov, 2022/10/11
- Re: [patch: first impression], Uwe Brauer, 2022/10/11
- Re: [patch: first impression], Dmitry Gutov, 2022/10/16
- Re: [patch: first impression], Dr. Arne Babenhauserheide, 2022/10/17
- Re: [patch: first impression], Dmitry Gutov, 2022/10/17
- Re: [patch: first impression], Uwe Brauer, 2022/10/17
- Re: [patch: first impression], Dmitry Gutov, 2022/10/17
- Re: [patch: first impression], Uwe Brauer, 2022/10/17