diff options
| author | Soren Hansen <soren.hansen@rackspace.com> | 2010-09-01 18:13:24 +0000 |
|---|---|---|
| committer | Tarmac <> | 2010-09-01 18:13:24 +0000 |
| commit | 91d88bbad095976bf3bccb98a30d2af9aafdbd53 (patch) | |
| tree | fa0ef2f37c2fbe55e30468f14faded898561fd06 | |
| parent | 937e8fae0237aed835ab2a55b4d4f0885a04f1d5 (diff) | |
| parent | 921d9d01d731f2fda05c73775606f87b3be9aba6 (diff) | |
| download | nova-91d88bbad095976bf3bccb98a30d2af9aafdbd53.tar.gz nova-91d88bbad095976bf3bccb98a30d2af9aafdbd53.tar.xz nova-91d88bbad095976bf3bccb98a30d2af9aafdbd53.zip | |
This improves the changelog generated as part of "setup.py sdist". If you look at it now, it says that Tarmac has done everything and every little commit is listed. With this patch, it only logs the "top-most" commit and credits the author rather than the committer.
Example from the current output format (from current trunk):
##########################################
2010-08-31 Tarmac
Adjust setup.py to match nova-rsapi -> nova-api-new rename.
2010-08-31 Soren Hansen <soren.hansen@rackspace.com>
Fix up setup.py to match nova-rsapi -> nova-api-new rename.
2010-08-30 Tarmac
Reconnect to libvirt on broken connection.
2010-08-30 Soren Hansen <soren.hansen@rackspace.com>
Detect if libvirt connection has been broken and reestablish it.
2010-08-30 Tarmac
pylint fixes for /nova/virt/connection.py
2010-08-30 jaypipes@gmail.com
Merge trunk and resolve conflicts
##########################################
With this patch, this is reduced to:
##########################################
2010-08-31 Soren Hansen <soren.hansen@rackspace.com>
Adjust setup.py to match nova-rsapi -> nova-api-new rename.
2010-08-30 Soren Hansen <soren.hansen@rackspace.com>
Reconnect to libvirt on broken connection.
2010-08-30 jaypipes@gmail.com
pylint fixes for /nova/virt/connection.py
##########################################
| -rw-r--r-- | bzrplugins/novalog/__init__.py | 59 | ||||
| -rw-r--r-- | setup.py | 6 |
2 files changed, 63 insertions, 2 deletions
diff --git a/bzrplugins/novalog/__init__.py b/bzrplugins/novalog/__init__.py new file mode 100644 index 000000000..e16b2e00f --- /dev/null +++ b/bzrplugins/novalog/__init__.py @@ -0,0 +1,59 @@ +# Copyright 2010 OpenStack LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +"""Log format for Nova's changelog.""" + +import bzrlib.log +from bzrlib.osutils import format_date + +# +# This is mostly stolen from bzrlib.log.GnuChangelogLogFormatter +# The difference is that it logs the author rather than the committer +# which for Nova always is Tarmac. +# +class NovaLogFormat(bzrlib.log.GnuChangelogLogFormatter): + preferred_levels = 1 + def log_revision(self, revision): + """Log a revision, either merged or not.""" + to_file = self.to_file + + date_str = format_date(revision.rev.timestamp, + revision.rev.timezone or 0, + self.show_timezone, + date_fmt='%Y-%m-%d', + show_offset=False) + + authors = revision.rev.get_apparent_authors() + to_file.write('%s %s\n\n' % (date_str, ", ".join(authors))) + + if revision.delta is not None and revision.delta.has_changed(): + for c in revision.delta.added + revision.delta.removed + revision.delta.modified: + path, = c[:1] + to_file.write('\t* %s:\n' % (path,)) + for c in revision.delta.renamed: + oldpath,newpath = c[:2] + # For renamed files, show both the old and the new path + to_file.write('\t* %s:\n\t* %s:\n' % (oldpath,newpath)) + to_file.write('\n') + + if not revision.rev.message: + to_file.write('\tNo commit message\n') + else: + message = revision.rev.message.rstrip('\r\n') + for l in message.split('\n'): + to_file.write('\t%s\n' % (l.lstrip(),)) + to_file.write('\n') + +bzrlib.log.register_formatter('novalog', NovaLogFormat) + @@ -29,8 +29,10 @@ class local_sdist(sdist): def run(self): if os.path.isdir('.bzr'): # We're in a bzr branch - log_cmd = subprocess.Popen(["bzr", "log", "--gnu"], - stdout=subprocess.PIPE) + env = os.environ.copy() + env['BZR_PLUGIN_PATH'] = os.path.abspath('./bzrplugins') + log_cmd = subprocess.Popen(["bzr", "log", "--novalog"], + stdout=subprocess.PIPE, env=env) changelog = log_cmd.communicate()[0] with open("ChangeLog", "w") as changelog_file: changelog_file.write(changelog) |
