Writing the patch description from an editor


#1

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?


#2

What library do you think to use?


#3

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

#4

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.


#5

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:

(source)

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


#6

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.


#7

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


#8

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