Patch for commit messages with an editor

Torsten Marek shlomme at gmx.net
Mon May 23 15:21:40 BST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Johan Rydberg schrieb:
> Torsten Marek <shlomme at gmx.net> writes:
> 
> 
>>Hello bzr-ng devs,
>>
>>I made a little patch which enables bzr to start an editor if no
>>commit message is specified by --file or --msg. Surely not all
>>quirks are worked out yet (I just "ported" it from 0.0.4 to the
>>development branch), but I find it much more convenient like that.
> 
> 
> I think it looks good.  I have one comment though.  It should not be
> possible to generalize it a bit further.  There is a possible chance
> that we would need to spawn an editor for other things than just "bzr
> commit".

Ok, the function name should then be something else than
_get_commit_message(...). Maybe the ignoreline text can be specified, or whether
there is additional information to be displayed at all. I'll try to revise the
patch in the next days.
> 
> 
>>+    def names():
>>+        for i in itertools.count():
>>+            yield ".bzr-commit.%i" % (i,)
>>+
>>+    try:
>>+
>>+        # get name which is unused
>>+        for n in names():
>>+            if not os.path.exists(n):
>>+                msgfilename = n
>>+                break
>>+
> 
> 
> Why not use a temporary name instead?

I was "inspired" by subversion, which uses svn-commit{.x}. A temporary filename
is fine as well, except for one thing: if you happen to use an editor that
creates backups of edited files, you are left with .bzr-commit.0~ in the one
case and sth like. 0txc5423~ in the other. Or should the commit file be put into
/tmp?

greetings

Torsten

- --
Torsten Marek <shlomme at gmx.net>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146  894C 7CC5 451E A244 C858
Keyserver: subkeys.pgp.net

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCkeb0fMVFHqJEyFgRAo0AAJ90V4/OMsM8wDgWTXzsCDvjCPDJ8gCfb5v4
pURlkGB8FcoK+SstSbPiliM=
=6+8V
-----END PGP SIGNATURE-----




More information about the bazaar mailing list