ajoberstar / reckon

Infer a project's version from your Git repository.
Apache License 2.0
187 stars 28 forks source link

rebuilding claimed version snapshot from historic commit #78

Closed esz closed 6 years ago

esz commented 6 years ago

Currently, reckon doesn't allow me to rebuild historic snapshots from old commits (with clean repo) if the subsequent normal version has already been released. Let's assume the following project setup:

Plugin settings:

reckon {
    normal = scopeFromProp()
    preRelease = snapshotFromProp()
}

Repo:

                      0.2.0
                        |
0-------X-------0-------0----...
                |\
                | \-----0----...
                |       |
              0.1.0     |
                      0.1.1

Now I want to rebuild X from a clean repo state, but reckon complains, saying:

* What went wrong:
Could not determine the dependencies of task ':compileJava'.
> Could not resolve all dependencies for configuration ':compileClasspath'.
   > Reckoned target normal version 0.1.0 has already been released.

In my opinion it should be possible to rebuild 0.1.0-SNAPSHOT from X when there are no local changes present and the 0.0.1 Tag is the lowest normal version within the successor commits reachable from X.

Of course I can still use -Preckon.scope=major or -Preckon.scope=patch to build 1.0.0-SNAPSHOT or 0.0.1-SNAPSHOT in this example, if the subsequent normals have not been claimed yet.

But the behavior above can be particularly painful, since I am not able to import old revisions (e.g. when im git bisecting) of my project into Eclipse using buildship with the build failing.

I wrote a small (failing) test, illustrating the expected behavior: esz/reckon@dbe10e34ac53a514cb6b6b750e9209c6673c4d01

What do you think about that? Am I just overlooking some valid reason for this restrictive behavior? If you think this would be a useful addition, I'd contribute happily!

ajoberstar commented 6 years ago

I've defaulted to being restrictive where I wasn't sure if the behavior should be allowed.

I agree with you that this should be allowed, though I don't know if it's a simple change.

My initial thoughts are that the behavior should be:

ajoberstar commented 6 years ago

If you want to check out 0.7.0-rc.1 this should work now. Thanks for opening and providing a test!

esz commented 6 years ago

Hi, just tried 0.7.0 Works like a charm! Thank you!