bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57400: 29.0.50; Support sending patches from VC directly


From: Antoine Kalmbach
Subject: bug#57400: 29.0.50; Support sending patches from VC directly
Date: Fri, 26 Aug 2022 13:45:51 +0300

Philip Kaludercic <philipk@posteo.net> writes:

> Yes, and I began implementing a different approach (as mentioned on the
> emacs-devel thread), which I have since abandoned.  If you haven't
> written anything yet, and don't insist on it, I could propose to start
> sketching out your suggestions.

Sure!  I was thinking we could start from a very basic command, call it
`vc-prepare-patch` as per your suggestion. Since VC uses generics, we
can dispatch to backend-specific implementations, something like this,
with Git:

  1. `M-x vc-prepare-patch`
  2. Dispatch to `vc-git-prepare-patch`
  3. Git wants a revision range, so interactively prompt for that
     (e.g. `HEAD^`, `abcd1234..ghjk5678`, or `-1`)
  4. `call-process` to `git format-patch $REV`, and so forth, get the
     list of files.
  5. Loop each file in `message-mode`. `C-c C-c` sends and goes to the
     next patch, `C-c C-k` cancels the whole thing.

Once the file opens in message-mode, most likely we need to strip the
magic From <sha> <date> header from the beginning of the mail. Then we ensure
don't do any nasty whitespace removal or wrapping.

Most likely, depending on the backend, we should not require any
parameters besides the "set of changes". For instance, in Git you can
configure `git-format-patch` in the git configuration for several
attributes, like --to=, --annotate, --prefix, etc.

I don't remember how Mercurial works with this. Probably similar. It
should generate mbox entries as well, I think. 

-- 
Antoine Kalmbach





reply via email to

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