Skip to content
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

Version bump of 1.2.0 #2931

Merged
merged 5 commits into from
Jul 6, 2020
Merged

Version bump of 1.2.0 #2931

merged 5 commits into from
Jul 6, 2020

Conversation

chefsale
Copy link
Contributor

@chefsale chefsale commented Jul 1, 2020

This is using the automatic toml update of the version and it unwrapped the dependencies as well. In the future only versions should be updated.

Copy link
Collaborator

@bowenwang1996 bowenwang1996 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not fix the automated tool?

neard/Cargo.toml Outdated Show resolved Hide resolved
@chefsale
Copy link
Contributor Author

chefsale commented Jul 1, 2020

why not fix the automated tool?

The automated tool is actually doing the right thing:

This is the code:

        cargo_toml = toml.loads(base64.b64decode(cargo.content).decode("utf-8"))
        previous_version = cargo_toml['package']['version']
        if cargo_toml['package']['version'] == version:
            logging.info("Versions are the same. Skipping bumping")
            return

        cargo_toml['package']['version'] = version
        response = self.repo.update_file(
            "neard/Cargo.toml",
            f"Automatic version bump from {previous_version} to {version}",
            toml.dumps(cargo_toml), cargo.sha, branch_name

dumps just spits out a string which is minimized, couldn't find a way to specify not to do that. we could create some custom parser, but this way I thought we would be more consistent and precise.

@frol
Copy link
Collaborator

frol commented Jul 2, 2020

Can the tool keep the existing formatting of the file and only touch the relevant piece? (I know it might be challenging, but still worth asking as it is common to have package section on the top while it seems that it rewrote the whole file to its liking.)

As a hack, I can suggest we use simple regex replacement with toml parsing before and after to ensure that we changed the right line (parse the original version, modify the version, apply the change to the toml file using regex replacement [do NOT dump the parsed toml], parse the new version again and compare the result with the originally patched version of the toml, they should be equal)

@chefsale
Copy link
Contributor Author

chefsale commented Jul 2, 2020

Yep, will do that.

@gitpod-io
Copy link

gitpod-io bot commented Jul 2, 2020

@chefsale
Copy link
Contributor Author

chefsale commented Jul 2, 2020

@frol @bowenwang1996 Here you go, its a dirty hack, but it works:
https://github.com/nearprotocol/near-ops/pull/74/commits/ba047d3377915a322a256f06d51ab535db047fc3

I tried with regexes first, but this seemed like a better simple way of not messing up.

Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much cleaner now 😄

@chefsale chefsale merged commit d2f44e4 into master Jul 6, 2020
@bowenwang1996 bowenwang1996 deleted the 1.2.0 branch July 6, 2020 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants