Writing the patch description from an editor

Hi everybody.

One of the latest “key feature” pijul still lacks from my point of view is the hability to write the patch description (that is the patch name and as much as text as you want then to give some context) within a text editor. I remember @pmeunier saying once on IRC the feature was not implemented yet because it was difficult to implement it in a portable way. That is very true indeed, but I think it could be a very cool acheivement (along with the @laumann pijul status enhancement discussed here) for pijul-0.8.0.

What do you think?

1 Like

What library do you think to use?

Could we start with a hack and see how it works?

What if pijul record looks for a specific file in .pijul, like .pijul/PATCH_DESC and uses its contents as the patch description and subsequently deletes the file?

That way adding description could be done interactively, as maybe

$ pijul record
# Add changes...
What is the name of this patch? The best patch ever!

Add a patch description? [yn] y
# Open editor if .pijul/PATCH_DESC doesn't exist (if possible); or
# ask to use .pijul/PATCH_DESC as the patch description

I like that feature, but remember that not everyone can use a text editor. I’m pretty sure atom/sublime/eclipse users don’t want to fire up their favourite editor just to write one line. This should be configurable, both globally and per repository.

As an emacs user who cannot use emacs-daemon, starting an emacs (that moreover, in the case of git and darcs, is not my usual emacs-x11) to write just a single line is also painful for me.

Hmm, how about as a command-line argument as well: pijul record --description <file>

Eclipse integration with Git is actually quite good, the implementation handles adding files to the index and writing the commit message in a dedicated editor window before hitting “Commit”. Like so:


Pijul integration in Eclipse could just provide two buffers: The patch name (as a single line) and the description (as a larger textarea).

1 Like

This looks like a good idea. One first quick and dirty hack could be to check is PATCH_DESC exists and use it when it does. Then we could move forward and ask to spawn an editor.

I will try to work with that this week and see how it goes.

That sounds simple, though I think the user should be prompted on whether or not to use the file (if found).

I wrote a patch that deals with using an external editor to write a patch name/description. You can find it on the Nest and your feedback is really welcome!

As the description said:

With this patch, pijul now supports writing a patch name and
description from an editor. To do so, the user needs to configure his
or her repository. If the editor variable is not set, then the
behaviour does not change. However, if it is, then pijul spawns the
editor. The user can then write the patch name and description. If he
or she leaves the file empty, then pijul aborts. If the file contains
some text after the headline, this text is used as the patch

@lthms was it implemented? I cannot see the patch on The nest and the documentation doesn’t mention it at all

It was implemented indeed. You can use the --editor command-line argument to choose which editor you want to use. Or you can configure it in the local (to your repo) or global (to your user) meta file (using the editor field.

It should work. (:

Sorry to bother again with this. Could you give some more details? I’m using 0.12, when I run pijul record --editor nvim it says:

error: Found argument ‘–editor’ which wasn’t expected, or isn’t valid in this context
Did you mean --no-editor?

Also I added editor = nvim to my ~/.local/share/pijul/config/config.toml and it doesn’t work (it asks for the patch name interactively). What am I doing wrong?

I don’t remember if pijul looks at this file for config. Mine is located at ${HOME}/.pijulconfig/config.toml. I recall there were some discussions to use xdg config directory standard, but I am not sure it was ever applied.