emacs-devel
[Top][All Lists]
Advanced

[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: Mon, 24 Oct 2022 17:34:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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

> On 18.10.2022 22:29, Dr. Arne Babenhauserheide wrote:
>> "Dr. Arne Babenhauserheide"<arne_bab@web.de>  writes:
>> 
>>> hg import --bypass <patch> && hg update --merge --tool internal:merge-local
>> cleaner with tip (in case there are multiple heads):
>> 
>> hg import --bypass <patch> && hg update --merge --tool internal:merge-local 
>> tip

> Thanks!.

> For best compatibility with existing behavior (default and vc-git's), it 
> seems I was looking for the merge tool 'internal:local'.

> Could either of you test the attached patch?

Sure, the attached diff is against the actual master I presume?


> It should be both faster and a little safer than using the default impl.

> diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
> index 2eebe2d543..30b4e55818 100644
> --- a/lisp/vc/vc-hg.el
> +++ b/lisp/vc/vc-hg.el
> @@ -1189,16 +1189,32 @@ vc-hg-log-edit-mode
>  (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")))
> +    (write-region patch-string nil patch-file)
> +    (unwind-protect
> +        (progn
> +          (apply #'vc-hg-command nil 0 nil
> +                 (nconc (list "import" "--bypass" patch-file "-m")
> +                        (vc-hg--extract-headers comment)))
> +          (vc-hg-command nil 0 nil
> +                         "update"
> +                         "--merge" "--tool" "internal:local"
> +                         "tip"))
> +      (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)


-- 
Warning: Content may be disturbing to some audiences
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. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

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