def prereleaser_after(self, data): """ Before preforming the release, get the previously released version from the latest tag in version control. """ self.previous_version = get_last_tag(self.vcs) self.history_lines = data['history_lines']
def main(): vcs = choose.version_control() changelogs = Changelogs(vcs) last_tag = utils.get_last_tag(vcs) git_command = vcs.cmd_log_since_tag(last_tag) changes = GitChanges(utils.system(git_command)) print 'There are {0} commit(s) for {1} line(s) in changelog'.format( len(changes.commits), len(changelogs.last_version.logs), )
def prereleaser_after(self, data): """ Before preforming the release, get the previously released version from the latest tag in version control. """ if data["name"] != "pyfits": return self.previous_version = get_last_tag(self.vcs) self.history_lines = data["history_lines"]
def _grab_version(self, initial=False): """Grab the version. When initial is False, ask the user for a non-development version. When initial is True, grab the current suggestion. """ original_version = self.vcs.version logger.debug("Extracted version: %s", original_version) if not original_version: logger.critical('No version found.') sys.exit(1) suggestion = new_version = self.data.get('new_version') if not new_version: # Get a suggestion. breaking = self.data['breaking'] feature = self.data['feature'] # Compare the suggestion for the last tag with the current version. # The wanted version bump may already have been done. last_tag_version = utils.get_last_tag(self.vcs, allow_missing=True) if last_tag_version is None: print("No tag found. No version bump needed.") sys.exit(0) else: print("Last tag: {}".format(last_tag_version)) print("Current version: {}".format(original_version)) params = dict( feature=feature, breaking=breaking, less_zeroes=self.pypiconfig.less_zeroes(), levels=self.pypiconfig.version_levels(), dev_marker=self.pypiconfig.development_marker(), ) minimum_version = utils.suggest_version( last_tag_version, **params) if parse_version(minimum_version) <= parse_version( utils.cleanup_version(original_version)): print("No version bump needed.") sys.exit(0) # A bump is needed. Get suggestion for next version. suggestion = utils.suggest_version( original_version, **params) if not initial: new_version = utils.ask_version( "Enter version", default=suggestion) if not new_version: new_version = suggestion self.data['original_version'] = original_version self.data['new_version'] = new_version self.data['clean_new_version'] = utils.cleanup_version(new_version)
def main(): utils.configure_logging() vcs = zest.releaser.choose.version_control() if len(sys.argv) > 1: found = sys.argv[-1] else: found = utils.get_last_tag(vcs) name = vcs.name full_tag = vcs.tag_url(found) logger.debug("Picked tag %r for %s (currently at %r).", full_tag, name, vcs.version) logger.info("Showing log since tag %s and the last commit.", full_tag) log_command = vcs.cmd_log_since_tag(found) print(utils.format_command(log_command)) print(execute_command(log_command))
def main(): utils.configure_logging() vcs = zest.releaser.choose.version_control() if len(sys.argv) > 1: found = sys.argv[-1] else: found = utils.get_last_tag(vcs) name = vcs.name full_tag = vcs.tag_url(found) logger.debug("Picked tag '%s' for %s (currently at '%s').", full_tag, name, vcs.version) logger.info("Showing differences from the last commit against tag %s", full_tag) diff_command = vcs.cmd_diff_last_commit_against_tag(found) print(diff_command) print(execute_command(diff_command))
def main(): utils.configure_logging() vcs = zest.releaser.choose.version_control() if len(sys.argv) > 1: found = sys.argv[-1] else: found = utils.get_last_tag(vcs) name = vcs.name full_tag = vcs.tag_url(found) logger.debug("Picked tag %r for %s (currently at %r).", full_tag, name, vcs.version) logger.info("Showing log since tag %s and the last commit.", full_tag) log_command = vcs.cmd_log_since_tag(found) print(log_command) print(execute_command(log_command))
def main(): logging.basicConfig(level=utils.loglevel(), format="%(levelname)s: %(message)s") vcs = zest.releaser.choose.version_control() if len(sys.argv) > 1: found = sys.argv[-1] else: found = utils.get_last_tag(vcs) name = vcs.name full_tag = vcs.tag_url(found) logger.debug("Picked tag %r for %s (currently at %r).", full_tag, name, vcs.version) logger.info("Showing log since tag %s and the last commit.", full_tag) log_command = vcs.cmd_log_since_tag(found) print log_command print system(log_command)
def get_default(self, key): """Someone asked why this is done with a list of IFs. The obvious alternative is to make this a dictionary, but that doesn't quite work: many values are not constant. Recreating the whole dictionary each time to only return a single one of its values isn't the solution. It could be replaced by a dictionary of which the values are functions (either lambdas or normal functions) but that leads to more code. Anyway, the function belong is long but perfectly readable. """ if key == 'deployment_type': return self.deployment_type if key == 'basedir': return '/srv/%s' % self.get('domainname') if key == 'buildout-file': return '%s.cfg' % self.deployment_type if key == 'databases': return self.get_from_django('DATABASES') if key == 'djangosettings': return "%s.%s" % (self.get('project'), self.get('djangosettingsfile')) if key == 'djangosettingsfile': return self.get_from_buildout('django', 'settings') if key == 'domainname': return self.get_from_buildout('serverconfig', 'sitename') if key == 'git': return self.get('vcs').internal_filename == '.git' if key == 'tag': return get_last_tag(self.get('vcs')) if key == 'project': return self.get_from_buildout('django', 'project') if key == 'svn': return not self.get('git') if key == 'vcs': return choose.version_control() if key == 'var_dirs': return ('media',) if key == 'checkout': return 'tag' if key == 'web_host': if self.deployment_type == 'development': return 'localhost' return None