Vladimir Kotal wrote:
<snip>
>> It is, jmcp asked me about this last night too. You can adjust the
>> style to insert \n's after each file.
>
> Any example on how to achieve that ?
It's possible to hack Mercurial and Cadmium to do that but it is not nice:
0. enable cadmium in ~/.hgrc
1. insert the following into cdm.py:
from mercurial import templatefilters
def newlines(text):
return text.replace(' ', '\n')
def outgoing_hook(ui, repo, **kwargs):
templatefilters.filters["newlines"] = newlines
2. hook into outgoing command in ~/.hgrc:
pre-outgoing=python:cdm.outgoing_hook
3. create style and template:
echo 'changeset = /tmp/test.tmpl' > /tmp/style
cat << EOF > /tmp/test.tmpl
changeset: {rev}:{node|short}
user: {author}
date: {date|isodate}
modified:
{files|stringify|newlines}
added:
{file_adds|stringify|newlines}
deleted:
{file_dels|stringify|newlines}
log:
{desc}
------------------------------------------------------------------------
EOF
4. run outgoing in a new way:
hg outgoing --style /tmp/style
The difference is obvious:
- old way:
comparing with /local/ws-mirrors/onnv-clone.hg
searching for changes
changeset: 7248:225922d15fe6
user: Vladimir Kotal <Vladimir.Kotal at Sun.COM>
date: 2008-08-06 23:39 +0200
modified: usr/src/cmd/ldap/ns_ldap/ldapaddent.c
usr/src/cmd/sendmail/db/config.h usr/src/cmd/ssh/include/config.h
usr/src/cmd/ssh/include/openbsd-compat.h
usr/src/cmd/ssh/include/strsep.h
usr/src/cmd/ssh/libopenbsd-compat/Makefile.com
usr/src/cmd/ssh/libopenbsd-compat/common/llib-lopenbsd-compat
usr/src/cmd/ssh/libopenbsd-compat/common/strsep.c
usr/src/cmd/ssh/libssh/common/llib-lssh usr/src/common/util/string.c
usr/src/head/string.h usr/src/lib/libc/amd64/Makefile
usr/src/lib/libc/i386/Makefile.com usr/src/lib/libc/port/gen/strsep.c
usr/src/lib/libc/port/llib-lc usr/src/lib/libc/port/mapfile-vers
usr/src/lib/libc/sparc/Makefile usr/src/lib/libc/sparcv9/Makefile
usr/src/lib/passwdutil/Makefile.com usr/src/lib/passwdutil/bsd-strsep.c
usr/src/lib/passwdutil/passwdutil.h
usr/src/lib/smbsrv/libsmb/common/mapfile-vers
usr/src/lib/smbsrv/libsmb/common/smb_util.c
added: usr/src/lib/libc/port/gen/strsep.c
deleted: usr/src/cmd/ssh/include/strsep.h
usr/src/cmd/ssh/libopenbsd-compat/common/strsep.c
usr/src/lib/passwdutil/bsd-strsep.c
log:PSARC 2008/305 strsep() in libc
4383867 need strsep() in libc
--------------------------------------------------------------------
- new way:
comparing with /local/ws-mirrors/onnv-clone.hg
searching for changes
changeset: 7248:225922d15fe6
user: Vladimir Kotal <Vladimir.Kotal at Sun.COM>
date: 2008-08-06 23:39 +0200
modified:
usr/src/cmd/ldap/ns_ldap/ldapaddent.c
usr/src/cmd/sendmail/db/config.h
usr/src/cmd/ssh/include/config.h
usr/src/cmd/ssh/include/openbsd-compat.h
usr/src/cmd/ssh/include/strsep.h
usr/src/cmd/ssh/libopenbsd-compat/Makefile.com
usr/src/cmd/ssh/libopenbsd-compat/common/llib-lopenbsd-compat
usr/src/cmd/ssh/libopenbsd-compat/common/strsep.c
usr/src/cmd/ssh/libssh/common/llib-lssh
usr/src/common/util/string.c
usr/src/head/string.h
usr/src/lib/libc/amd64/Makefile
usr/src/lib/libc/i386/Makefile.com
usr/src/lib/libc/port/gen/strsep.c
usr/src/lib/libc/port/llib-lc
usr/src/lib/libc/port/mapfile-vers
usr/src/lib/libc/sparc/Makefile
usr/src/lib/libc/sparcv9/Makefile
usr/src/lib/passwdutil/Makefile.com
usr/src/lib/passwdutil/bsd-strsep.c
usr/src/lib/passwdutil/passwdutil.h
usr/src/lib/smbsrv/libsmb/common/mapfile-vers
usr/src/lib/smbsrv/libsmb/common/smb_util.c
added:
usr/src/lib/libc/port/gen/strsep.c
deleted:
usr/src/cmd/ssh/include/strsep.h
usr/src/cmd/ssh/libopenbsd-compat/common/strsep.c
usr/src/lib/passwdutil/bsd-strsep.c
log:
PSARC 2008/305 strsep() in libc
4383867 need strsep() in libc
------------------------------------------------------------------------
I hope the CRT advocates won't mind using this style in RTI forms.
So, could we have the following in next Mercurial version, please:
- 'outgoingtemplate' in hgrc(5) file (analogy to 'logtemplate')
- 'newlines' function in 'common_filters' array in templater.py
v.