New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when parsing tag containing "-" #51

Closed
peritus opened this Issue Jul 24, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@peritus
Owner

peritus commented Jul 24, 2014

Originally reported by @thomasf in #43:


Ive started to try it out now, I copied the bumpversion.cfg config from this project and it does not work..
I did leave autocommit there so there was an 2.0.0-dev release tag created and thats where things started to go wrong.

The hypen in the -dev tag messes up a string split you have in the latest_tag_info function.

A slightly modified snippet with logging:

  def latest_tag_info(cls):
        try:
            # git-describe doesn't update the git-index, so we do that
            subprocess.check_output(["git", "update-index", "--refresh"])

            # get info about the latest tag in git
            describe_out = subprocess.check_output([
                "git",
                "describe",
                "--dirty",
                "--tags",
                "--long",
                "--abbrev=40",
                "--match=v*",
            ], stderr=subprocess.STDOUT
            ).decode().split("-")
        except subprocess.CalledProcessError:
            # logger.warn("Error when running git describe")
            return {}

        info = {}

        print describe_out
        if describe_out[-1].strip() == "dirty":
            info["dirty"] = True
            describe_out.pop()

        print describe_out
        info["commit_sha"] = describe_out.pop().lstrip("g")
        print describe_out
        info["distance_to_latest_tag"] = int(describe_out.pop())
        print describe_out
        info["current_version"] = describe_out.pop().lstrip("v")

        print describe_out
        # assert type(info["current_version"]) == str
        assert 0 == len(describe_out)

and output

 a01@whale¤%&! bumpversion 
[u'v2.0.0', u'dev', u'2', u'gf176a005e91bfb3addee4cdf096a90fd34f4287a\n']
[u'v2.0.0', u'dev', u'2', u'gf176a005e91bfb3addee4cdf096a90fd34f4287a\n']
[u'v2.0.0', u'dev', u'2']
[u'v2.0.0', u'dev']
[u'v2.0.0']
Traceback (most recent call last):
  File "/home/a00001/.virtualenvs/default/bin/bumpversion", line 9, in <module>
    load_entry_point('bumpversion==0.5.0', 'console_scripts', 'bumpversion')()
  File "/home/a00001/.virtualenvs/default/local/lib/python2.7/site-packages/bumpversion/__init__.py", line 652, in main
    vcs_info.update(vcs.latest_tag_info())
  File "/home/a00001/.virtualenvs/default/local/lib/python2.7/site-packages/bumpversion/__init__.py", line 148, in latest_tag_info
    assert 0 == len(describe_out)
AssertionError

@peritus peritus added the v0.5.1 label Jul 24, 2014

@peritus peritus self-assigned this Jul 24, 2014

@thomasf thomasf referenced this issue Oct 11, 2014

Closed

AssertionError #52

@peritus peritus closed this in f0baac8 Oct 22, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment