Skip to content

Bug Fix for Merging "reenhanced:master" instead of "master"#171

Merged
codenamev merged 1 commit intoreenhanced:masterfrom
simonzhu24:sz/bug_fix_for_branch_name
May 13, 2016
Merged

Bug Fix for Merging "reenhanced:master" instead of "master"#171
codenamev merged 1 commit intoreenhanced:masterfrom
simonzhu24:sz/bug_fix_for_branch_name

Conversation

@simonzhu24
Copy link
Copy Markdown
Contributor

No description provided.

@simonzhu24 simonzhu24 force-pushed the sz/bug_fix_for_branch_name branch from 88bfa1b to 773b689 Compare May 13, 2016 02:26
@simonzhu24
Copy link
Copy Markdown
Contributor Author

simonzhu24 commented May 13, 2016

@codenamev Apologies for sending another diff, but I found a bug last minute when trying to deliver using branch_name reenhanced:master instead of master. It wasn't a blocking issue on deliver, but it was using the wrong base_branch_name (reenhanced:master instead of master) to update and cleanup.

I am also adding self back into the code as a Ruby insurance that the correct scope of the variable is called so we don't have any confusion in the future. Please accept this asap so the bug can be fixed.

@simonzhu24 simonzhu24 force-pushed the sz/bug_fix_for_branch_name branch 2 times, most recently from 9606856 to 6f39718 Compare May 13, 2016 04:25
@codenamev
Copy link
Copy Markdown
Collaborator

Can you update the tests please? I have another branch (vs-cleanup-new-gh-merge) I've been working on to clean up some other issues I've found as well before we release.

@simonzhu24
Copy link
Copy Markdown
Contributor Author

The tests are passing as I didn't add any additional methods or complex
logic that would cause them to fail.

There was no added functionality so I don't believe new tests need to be
added?

On Friday, May 13, 2016, Valentino notifications@github.com wrote:

Can you update the tests please? I have another branch (
vs-cleanup-new-gh-merge) I've been working on to clean up some other
issues I've found as well before we release.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#171 (comment)

@simonzhu24
Copy link
Copy Markdown
Contributor Author

@codenamev do you mind patching in my changes and seeing if the issues that you saw still exist? I believe this patch will solve the clean up and deliver issues that were present.

@codenamev
Copy link
Copy Markdown
Collaborator

The tests are there for quality assurance that the methods do what they say. Since we have restructured so much here, it's possible that the old tests didn't cover the new way of doing things. We'll want to first add failing tests to catch the issue you found so that we can ensure any new changes going forward don't affect it as well.

Also, we have a running PR open doing some cleanup before we can release. It turns out that the squash feature in the API is only in preview and requires special headers to access. While we can simple add those headers in, the github_api gem does not currently support the extra parameters (it filters unwanted options out). There is a PR we have open to get that resolved and will need it released in the github_api gem before we can release this as well.

@simonzhu24 simonzhu24 force-pushed the sz/bug_fix_for_branch_name branch from 6f39718 to 65ab40b Compare May 13, 2016 14:28
@simonzhu24
Copy link
Copy Markdown
Contributor Author

@codenamev I updated the tests.

@codenamev
Copy link
Copy Markdown
Collaborator

It looks like the bug in question is using a new syntax for the branch name owner:base_branch_name? Can you please update/add tests for that scenario?

@simonzhu24
Copy link
Copy Markdown
Contributor Author

simonzhu24 commented May 13, 2016

@codenamev Perhaps I misunderstood you? The checkout and some cleanup commands that were ran after delivery were git checkout owner:base_branch_name which was incorrect as it should have been git checkout base_branch_name. Because some of those commands were left out of the test, I added them in and added some additional tests. Now the code works and the tests pass.

I just checked locally both with force delivering and normally, each with and without cleanup. All 4 test cases work locally and the test coverage reflects this as well.

Please let me know if we can merge this. This solves an immediate problem with cleanup / deploy.

@simonzhu24 simonzhu24 force-pushed the sz/bug_fix_for_branch_name branch from 65ab40b to 65d8c8d Compare May 13, 2016 15:12
unless feature_branch_name.index(':').nil?
feature = feature_branch_name[(feature_branch_name.index(':') + 1)..-1]
end
self.base_branch_name = self.base_branch_name[/[^:]+$/]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why do we need to check for :?

Copy link
Copy Markdown
Contributor Author

@simonzhu24 simonzhu24 May 13, 2016

Choose a reason for hiding this comment

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

@codenamev Line 180 is the same logic as what I am trying to do previously in line 180 - 186. This is just a bit more elegant Ruby Regex Syntax to match the expression in the string after the ":" to the end and if ":" does not exist, simply match the whole string.

There are 2 cases:
"master" => "master"
"codenamev:master" => "master"

Regex supports both (And it is a single line of Ruby code). ^_^

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ah, I wasn't aware that Github or Bitbucket formatted the head/base labels like that. Let's move this into the GitHub::PullRequest#initialize and BitBucket::PullRequest#initialize methods. We should be able to trust a consistent format wherever else we need to reference these.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@simonzhu24 simonzhu24 force-pushed the sz/bug_fix_for_branch_name branch from 65d8c8d to 84cb534 Compare May 13, 2016 15:19
@simonzhu24
Copy link
Copy Markdown
Contributor Author

The additional tests make sure that each command that was supposed to run executed on the correct branch_name. It should be master instead of codenamev:master since github does not recognize the latter syntax.

@simonzhu24 simonzhu24 force-pushed the sz/bug_fix_for_branch_name branch from 84cb534 to 2a746a8 Compare May 13, 2016 15:43
@codenamev
Copy link
Copy Markdown
Collaborator

lgtm, thank you 😄

@simonzhu24 simonzhu24 force-pushed the sz/bug_fix_for_branch_name branch from 2a746a8 to 3646ef2 Compare May 13, 2016 15:55
@simonzhu24
Copy link
Copy Markdown
Contributor Author

@codenamev np, lets merge this!

@codenamev codenamev merged commit 2dab9f7 into reenhanced:master May 13, 2016
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.

2 participants