Example #1
0
def delete_old_branches(days, dry=False, locally=False, remote=None, y=False,
                        ignore=IGNORE):
    if not locally and not remote:
        print('You must specify -l or -r or both.')
        import sys
        sys.exit(4242)

    for branch in merged_branches(remote=remote, ignore=ignore):
        if not remote and branch.remote:
            continue
        if not locally and not branch.remote:
            continue
        if days and not branch.is_older_than_days(days):
            continue

        if y:
            print('    ' + str(branch))
        else:
            if not bool_input('Delete the branch "{}"?'.format(branch),
                              default=False):
                continue

        if dry:
            continue
        branch.delete()
Example #2
0
 def __call__(self):
     self._execute_or_complain(self.COMMAND)  # sets self.success
     # TODO: Optionally xdg-open the wheel for convenience
     print("A temporary wheel has been generated. Since it is just a\n"
           "zip file, you should now open it (from the 'dist' directory)"
           "\nand check that all files are in there.")
     if not bool_input("Do you approve the wheel contents?"):
         raise StopRelease('Wheel content not approved.')
Example #3
0
 def __call__(self):
     self._execute_or_complain('python setup.py sdist')
     # TODO: Optionally xdg-open the archive for convenience
     # Create the sdist with "-d <output_dir>"  on a temp dir.
     # Delete it at the end.
     print("A temporary source distribution has been generated. This is")
     print("your chance to open the new archive (in the 'dist' directory)")
     print("and check that all files are in there.")
     if not bool_input("Do you approve the archive contents?"):
         raise StopRelease('Source distribution content not approved.\n'
             'If the distribution is missing some files,\n'
             "try correcting your MANIFEST.in file according to\n"
             "http://docs.python.org/3/distutils/sourcedist.html"
             "#specifying-the-files-to-distribute")
Example #4
0
def delete_old_branches(dry, locally, remote, y, days):
    for branch in merged_branches(remote):
        if days and not branch.is_older_than_days(days):
            continue

        if y:
            print(branch)
        else:
            if not bool_input('Delete the branch "{}"?'.format(branch),
                              default=False):
                continue

        if dry:
            continue
        if remote:
            branch.delete_remotely(remote)
        if locally:
            branch.delete_locally()
Example #5
0
 def rewind(self):
     say = self.log.critical
     say('\n' + screen_header('ROLLBACK', decor='*'))
     # Some steps offer a warning because they cannot be rolled back.
     say('\n'.join(self.non_rewindable))              # Display them.
     if not self.rewindable:
         say('No steps to roll back, but the release process FAILED.')
         return
     steps = list(reversed(self.rewindable))
     print('I am about to roll back the following steps:\n{0}'.format(
         ', '.join([str(step) for step in steps])))
     if not bool_input('Continue?', default=True):
         return
     for step in steps:
         self.log.critical(screen_header('ROLLBACK {0}'.format(step)))
         try:
             step.rollback()
         except Exception as e:
             self.log.error('Could not roll back step {0}:\n{1}'
                 .format(step, str(e)))
Example #6
0
 def __call__(self):
     if bool_input('Did you remember to update the CHANGES file?'):
         self.log.debug('User says CHANGES file is up to date.')
     else:
         raise StopRelease('One more joshlabotniked release is avoided.')