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

Add new field in PullRequest Object #50

Merged
merged 6 commits into from
Mar 9, 2017

Conversation

j0nathan33
Copy link
Contributor

No description provided.

@cdancy cdancy self-assigned this Mar 8, 2017
@cdancy cdancy added this to the v0.0.14 milestone Mar 8, 2017
*/
@AutoValue
public abstract class Properties {
public abstract Long openTaskCount();
Copy link
Owner

Choose a reason for hiding this comment

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

If not nullable we can use long instead of boxed version. Same for resolvedTaskCount.

public static Reference create(String id, MinimalRepository repository) {
return new AutoValue_Reference(id != null ? id : "refs/heads/master", repository);
@SerializedNames({"id", "repository", "displayId"})
public static Reference create(String id, MinimalRepository repository, String displayId) {
Copy link
Owner

Choose a reason for hiding this comment

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

Can we create overloaded constructor here. Previous can default to setting this property to say the id.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand what you mean.

Copy link
Owner

Choose a reason for hiding this comment

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

Constructor was the wrong word, my apologies. Overloaded versions of create:

public static Reference create(String id, MinimalRepository repository) {

public static Reference create(String id, MinimalRepository repository, String displayId) {
  

The first can delegate to the second passing in whatever value id is to displayId.

Copy link
Contributor Author

@j0nathan33 j0nathan33 Mar 9, 2017

Choose a reason for hiding this comment

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

Ha ok, but Id and displayId isn't same value from api. Exemple for master branch :
id: "refs/heads/master",
displayId : "master"

Copy link
Owner

@cdancy cdancy Mar 9, 2017

Choose a reason for hiding this comment

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

Ok. Then maybe check for non-null and if so split on / and use last index? Something like this might work.

public static Reference create(String id, MinimalRepository repository) { 
    String displayId = null;
    if (id != null) {
        String parts [] = id.split("/");
        displayId = parts[parts.length];
    }
    return create(id, repository, displayId);
}

And add a @deprecated annotation to the create(String id, MinimalRepository repository) method.

CreatePullRequest cpr = CreatePullRequest.create(randomChars, "Fix for issue " + randomChars, fromRef, toRef, null, null);

System.out.println("---------> CREATED PR: " + cpr);
Copy link
Owner

Choose a reason for hiding this comment

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

Mind taking out this line while you're here poking around? :)

@cdancy
Copy link
Owner

cdancy commented Mar 8, 2017

@j0nathan33 thanks splitting up the PR. Added some comments to address. Looks good. Thanks.

*/
@AutoValue
public abstract class Properties {
public abstract long openTaskCount();
Copy link
Owner

Choose a reason for hiding this comment

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

Can we put a newline between class definition and openTaskCount?


/**
* Created by jdoire on 07/03/2017.
*/
Copy link
Owner

Choose a reason for hiding this comment

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

Lets remove these Created by comments.

@cdancy
Copy link
Owner

cdancy commented Mar 9, 2017

@j0nathan33 minor issue with the "overloaded" change but I'll fix that on this end. Thanks for the PR!

@cdancy cdancy merged commit 586eeb3 into cdancy:master Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants