Thursday Aug 07, 2008
Thursday Aug 07, 2008
Part of the transition of Mercurial in OpenSolaris are changes in the integration processes. Every RTI has to contain output of hg outgoing -v so the CRT advocates can better see the impact of the changes in terms of changed files. However, the default output is not very readable:
$ hg outgoing -v comparing with /local/ws-mirrors/onnv-clone.hg searching for changes changeset: 7248:225922d15fe6 user: Vladimir Kotaldate: 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 --------------------------------------------------------------------
In the above case, the list of modified files spans single line which makes the web form used for RTI go really wild in terms of width (I had to wrap the lines manually in the above example otherwise this page would suffer from the same problem). The following steps can be used to make the output a bit nicer:
from mercurial import templatefilters
def newlines(text):
return text.replace(' ', '\n')
def outgoing_hook(ui, repo, **kwargs):
templatefilters.filters["newlines"] = newlines
[extensions] outproc=~/bin/Mercurial/outproc.py [hooks] pre-outgoing=python:outproc.outgoing_hook
changeset = outgoing.template
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}
------------------------------------------------------------------------
alias outgoing='hg outgoing --style ~/bin/Mercurial/style.outgoing'
After that it works like this:
$ outgoing comparing with /local/ws-mirrors/onnv-clone.hg searching for changes changeset: 7248:225922d15fe6 user: Vladimir Kotaldate: 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 asked Richard Lowe (who has been very helpful with helping getting the transition process done) if next
Mercurial version can have newlines function already included and if there could be
outgoingtemplate which would be similar to logtemplate in hgrc(5).
In the meantime I will be using the above for my RTIs.
tags:
hg
mercurial
outgoing
template
Linkage:
Technorati cosmos