Example #1
0
    def validate(self):
        if not isdir('.bzr'):
            raise BumprError('Current directory is not a bazaar repopsitory')

        for line in execute('bzr status --short', verbose=False).splitlines():
            if not line.startswith('?'):
                raise BumprError(
                    'The current repository contains modified files')
Example #2
0
    def validate(self):
        if not isdir('.hg'):
            raise BumprError(
                'Current directory is not a mercurial repopsitory')

        for line in execute('hg status -mard', verbose=False).splitlines():
            if not line.startswith('??'):
                raise BumprError(
                    'The current repository contains modified files')
Example #3
0
    def validate(self):
        if not isdir('.git'):
            raise BumprError('Current directory is not a git repopsitory')

        for line in execute('git status --porcelain',
                            verbose=False).splitlines():
            if not line.startswith('??'):
                raise BumprError(
                    'The current repository contains modified files')
Example #4
0
    def validate(self, dryrun=False):
        if not isdir('.bzr'):
            raise BumprError('Current directory is not a bazaar repopsitory')

        for line in execute('bzr status --short', verbose=False).splitlines():
            if not line.startswith('?'):
                if dryrun:
                    log.warning(MSG)
                    break
                else:
                    raise BumprError(MSG)
Example #5
0
    def validate(self, dryrun=False):
        if not isdir('.hg'):
            raise BumprError('Current directory is not a mercurial repopsitory')

        for line in execute('hg status -mard', verbose=False).splitlines():
            if not line.startswith('??'):
                if dryrun:
                    log.warning(MSG)
                    break
                else:
                    raise BumprError(MSG)
Example #6
0
    def validate(self, dryrun=False):
        if not isdir('.git'):
            raise BumprError('Current directory is not a git repopsitory')

        for line in execute('git status --porcelain', verbose=False).splitlines():
            if not line.startswith('??'):
                if dryrun:
                    log.warning(MSG)
                    break
                else:
                    raise BumprError(MSG)
Example #7
0
    def __init__(self, config):
        self.config = config

        with open(config.file) as f:
            match = re.search(config.regex, f.read())
            try:
                version_string = match.group('version')
                self.prev_version = Version.parse(version_string)
            except:
                raise BumprError('Version not found in {}'.format(config.file))

        logger.debug('Previous version: {0}'.format(self.prev_version))

        self.version = self.prev_version.copy()
        self.version.bump(config.bump.part, config.bump.unsuffix, config.bump.suffix)
        logger.debug('Bumped version: {0}'.format(self.version))

        self.next_version = self.version.copy()
        self.next_version.bump(config.prepare.part, config.prepare.unsuffix, config.prepare.suffix)
        logger.debug('Prepared version: {0}'.format(self.next_version))

        self.timestamp = None

        if config.vcs:
            self.vcs = VCS[config.vcs](verbose=config.verbose)
            self.vcs.validate()

        if config.dryrun:
            self.diffs = {}

        self.hooks = [hook(self) for hook in HOOKS if self.config[hook.key]]
Example #8
0
    def __init__(self, config):
        self.config = config

        with open(config.file) as f:
            match = re.search(config.regex, f.read())
            try:
                version_string = match.group('version')
                self.prev_version = Version.parse(version_string)
            except Exception:
                raise BumprError('Unable to extract version from {0}'.format(
                    config.file))

        logger.debug('Previous version: {0}'.format(self.prev_version))

        self.version = self.prev_version.copy()
        self.version.bump(config.bump.part, config.bump.unsuffix,
                          config.bump.suffix)
        logger.debug('Bumped version: {0}'.format(self.version))

        self.next_version = self.version.copy()
        self.next_version.bump(config.prepare.part, config.prepare.unsuffix,
                               config.prepare.suffix)
        logger.debug('Prepared version: {0}'.format(self.next_version))

        self.tag_label = self.config.tag_format.format(version=self.version)
        logger.debug('Tag: {0}'.format(self.tag_label))
        if self.config.tag_annotation:
            self.tag_annotation = self.config.tag_annotation.format(
                version=self.version)
            logger.debug('Tag annotation: {0}'.format(self.tag_annotation))

        self.timestamp = None

        if config.vcs:
            self.vcs = VCS[config.vcs](verbose=config.verbose)
            self.vcs.validate(dryrun=config.dryrun)

        if config.dryrun:
            self.modified = {}
            self.diffs = {}

        self.hooks = [hook(self) for hook in HOOKS if self.config[hook.key]]
Example #9
0
 def validate(self):
     if not self.config.get('file'):
         raise BumprError('Changelog file has not been specified')
     elif not exists(self.config.file):
         raise BumprError('Changelog file does not exists')