Example #1
0
def make_git_commit(changelog_file, message):
    """
    :param message: string message for the commit.
  """
    info('making git commit: "{}"', message)
    return shell("git add {} && git commit -am {}".format(
        changelog_file, message))
Example #2
0
def make_git_commit(changelog_file, message):
  """
    :param message: string message for the commit.
  """
  info('making git commit: "{}"', message)
  return shell(
    "git add {} && git commit -am {}".format(changelog_file, message))
Example #3
0
    def setup_initial_release(self):
        """
    """
        if not choice("""
  do you want keybump to setup the initial release?"""):
            fail('aborting, initial release not created.')

        info("""
  ok, you asked for it..
    """)
        release = self.create_initial_release()
        self.changelog.write(release.format_changelog_summary())
        self.releases.append(release)
Example #4
0
    def parse_releases(self):
        """
    sets the releases property, parsed from the changelog summaries.
    """
        self.releases = self.parse_changelog_to_releases()
        if len(self.releases) < 1:
            msg = "could not parse release from changelog history in {}.".format(
                self.changelog.path)

            # fail and exit..
            if self.config.skip_interactive:
                fail(msg)
            else:
                # don't fail, set to initial version..
                info(msg)

            self.setup_initial_release()
Example #5
0
def ensure_clean_index(skip_interactive=False, callback=None):
    """
  ensures the current git staging index has no uncommitted or stashed changes.

    :param skip_interactive: boolean flag to skip getting input from a cli.
    :param callback: recursive callback function.
  """
    if not has_unstaged_changes() and not has_uncommitted_changes():
        if callback:
            return callback(skip_interactive, callback)
        return True

    if callback is None:
        callback = ensure_clean_index

    files = git_diff_files()
    msg = """
  aborting.. un[stashed/committed] changes. fix uncommitted files by
  stashing, committing, or resetting the following files:

  {}
  """.format("\n  ".join(files))
    if skip_interactive:
        fail(msg)

    # clean the index..
    info(msg)
    if not choice("want keybump to snort ..achem stash.. your changes?"):
        fail("aborting.. un[stashed/committed] changes..")

    info("""
  ok, you asked for it..
  """)

    git_stash()

    if callback:
        return callback(skip_interactive, callback)
Example #6
0
def ensure_clean_index(skip_interactive=False, callback=None):
  """
  ensures the current git staging index has no uncommitted or stashed changes.

    :param skip_interactive: boolean flag to skip getting input from a cli.
    :param callback: recursive callback function.
  """
  if not has_unstaged_changes() and not has_uncommitted_changes():
    if callback:
      return callback(skip_interactive, callback)
    return True

  if callback is None:
    callback = ensure_clean_index

  files = git_diff_files()
  msg = """
  aborting.. un[stashed/committed] changes. fix uncommitted files by
  stashing, committing, or resetting the following files:

  {}
  """.format("\n  ".join(files))
  if skip_interactive:
    fail(msg)

  # clean the index..
  info(msg)
  if not choice("want keybump to snort ..achem stash.. your changes?"):
    fail("aborting.. un[stashed/committed] changes..")

  info("""
  ok, you asked for it..
  """)

  git_stash()

  if callback:
    return callback(skip_interactive, callback)
Example #7
0
def make_git_tag(msg, tag_name):
    """
    :param tag_name: string name for the tag.
  """
    info('making git tag: "{}"', tag_name)
    return shell("git tag {} -m {}".format(tag_name, msg))
Example #8
0
def git_checkout(id):
    """
    :param id: string identifier of the commit'ish to checkout.
  """
    info('checking out: "{}"', id)
    return shell("git checkout {}".format(id))
Example #9
0
def set_setup_py_version(version):
    """
    :param version:
  """
    info("setting setup.py version to {}", version)
    set_version_in_file("setup.py", version, "version")
Example #10
0
def set_init_py_version(version):
    """
    :param version:
  """
    info("setting __init__.py version to: {}", version)
    set_version_in_file("__init__.py", version, "__version__")
Example #11
0
def set_setup_py_version(version):
  """
    :param version:
  """
  info("setting setup.py version to {}", version)
  set_version_in_file("setup.py", version, "version")
Example #12
0
def set_init_py_version(version):
  """
    :param version:
  """
  info("setting __init__.py version to: {}", version)
  set_version_in_file("__init__.py", version, "__version__")
Example #13
0
def make_git_tag(msg, tag_name):
  """
    :param tag_name: string name for the tag.
  """
  info('making git tag: "{}"', tag_name)
  return shell("git tag {} -m {}".format(tag_name, msg))
Example #14
0
def git_checkout(id):
  """
    :param id: string identifier of the commit'ish to checkout.
  """
  info('checking out: "{}"', id)
  return shell("git checkout {}".format(id))