Skip to content

Update API inside documentation.#561

Closed
dmitshur wants to merge 3 commits intomasterfrom
context-doc-updates
Closed

Update API inside documentation.#561
dmitshur wants to merge 3 commits intomasterfrom
context-doc-updates

Conversation

@dmitshur
Copy link
Copy Markdown
Member

  • Update documentation with new context parameter.
  • Update remaining uses of oauth2.NoContext.

This is a followup to #529.

oauth2.NoContext is deprecated. Replace it with context.Background() in
a few more places that were missed in 23d6cb9.

Related to #560.
ctx is a common and well understood variable name that represents the
current context.Context value.

This is a followup to #529.
Copy link
Copy Markdown
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

LGTM - just a couple minor comments that you can ignore if you wish.

Comment thread README.md Outdated
&oauth2.Token{AccessToken: "... your access token ..."},
)
tc := oauth2.NewClient(oauth2.NoContext, ts)
tc := oauth2.NewClient(context.Background(), ts)
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.

What about adding a line before this:
ctx := context.Background()
and then changing this line to use ctx ?

Copy link
Copy Markdown
Member Author

@dmitshur dmitshur Feb 22, 2017

Choose a reason for hiding this comment

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

That seems reasonable. Edit: Done.

Comment thread github/doc.go Outdated
&oauth2.Token{AccessToken: "... your access token ..."},
)
tc := oauth2.NewClient(oauth2.NoContext, ts)
tc := oauth2.NewClient(context.Background(), ts)
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.

Same comment here:
What about adding a line before this:
ctx := context.Background()
and then changing this line to use ctx ?

Copy link
Copy Markdown
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks, @shurcooL!

@gmlewis
Copy link
Copy Markdown
Collaborator

gmlewis commented Feb 22, 2017

Merging.

@gmlewis gmlewis closed this in 2806581 Feb 22, 2017
@gmlewis
Copy link
Copy Markdown
Collaborator

gmlewis commented Feb 22, 2017

@shurcooL - did I mess something up here? I see Closed with unmerged commits which I don't remember seeing before.

It looks like maybe I didn't get a129861 but I'm not sure how I messed that up.

Yikes. I don't like what I'm seeing:

$ git branch -v
  gen-accessors 388cd37 [ahead 5, behind 3] Move gen-accessors.go into github directory
  i-531         8fa3a78 [ahead 2, behind 2] Address review feedback - require non-nil pull argument
* master        a129861 [ahead 3, behind 2] Declare ctx on top, reuse it for 2 calls.
  pr/561        a129861 Declare ctx on top, reuse it for 2 calls.

My master branch should never be behind.

Here is my master branch log:

$ glog | head
* a129861 2017-02-22 | Declare ctx on top, reuse it for 2 calls. (HEAD -> master, google/context-doc-updates, pr/561) [Dmitri Shuralyov]
* 4a23999 2017-02-21 | Update documentation with new context parameter. [Dmitri Shuralyov]
* 654d25d 2017-02-21 | Update remaining uses of oauth2.NoContext. [Dmitri Shuralyov]
* 23d6cb9 2017-02-20 | Add support for context package to all endpoints. (#529) [Dmitri Shuralyov]
* 2ec691a 2017-02-18 | examples/basicauth: Simplify comma-ok type assertion in if statement. (#558) [Dmitri Shuralyov]
* de9eb29 2017-02-18 | Remove unused Client.mostRecent. (#559) [Dmitri Shuralyov]
* 2a4b920 2017-02-18 | Remove deprecated identifiers. (#555) [Dmitri Shuralyov]
* 796decd 2017-02-18 | Require Go 1.7 and newer. (#554) [Dmitri Shuralyov]
* 82629e0 2017-02-17 | Use HTTPS for all developer.github.com links. (#551) [Kevin Burke]
* dfd20fd 2017-02-15 | Return nil error explicitly when there is no error. (#550) [Nick Spragg]

I think that I didn't properly handle different branches in the PR.

I'm going to stop and see if @shurcooL can verify the integrity of the current master before I make any more changes.

@gmlewis gmlewis reopened this Feb 22, 2017
@dmitshur
Copy link
Copy Markdown
Member Author

dmitshur commented Feb 22, 2017

I see Closed with unmerged commits which I don't remember seeing before.

Where did you see that?

It definitely looks like your local repository is in a weird state. You should probably make a backup of your current local master branch, then reset your local master to match the upstream master (so that it's not both behind and ahead).

I can see that the remote master has 2 new commits since last night. They are 93f95bf and 2806581.

  1. 93f95bf is you merging Added listing outside collaborators for an organization #538.

    I've compared the difference between https://patch-diff.githubusercontent.com/raw/google/go-github/pull/538.diff (the PR) and https://github.com/google/go-github/commit/93f95bf99fdd49bad208a6a555090ce882d2653e.diff, and it looks fine, you just added context.

  2. 2806581 is you merging this PR Update API inside documentation. #561.

    As far as I can see, the commit 2806581 contains all of the changes from the 3 commits in this PR, squashed into one commit. However, its commit message only contains text from the first commit and drops everything from 2nd (which was meaningful, not just code review edits). It would've been nice to include that, but it's not very critical. The main thing is that all changes are in.

    You can confirm that by checking that https://patch-diff.githubusercontent.com/raw/google/go-github/pull/561.diff and https://github.com/google/go-github/commit/28065814ab889552aebe99cd41b35bc5e31063fe.diff are identical. They are.

    $ diff <(curl -sS 'https://patch-diff.githubusercontent.com/raw/google/go-github/pull/561.diff') <(curl -sS 'https://github.com/google/go-github/commit/28065814ab889552aebe99cd41b35bc5e31063fe.diff')
    $ 
    

So this PR is fully merged in 2806581, and we can close it. You should resolve your local master branch issues, however.

Also, thanks for showing me that -v option for git branch command displays behind/ahead counts. I made git-branches partially because I didn't know that.

@dmitshur dmitshur closed this Feb 22, 2017
@dmitshur
Copy link
Copy Markdown
Member Author

dmitshur commented Feb 22, 2017

Oh, I see what you were talking about regarding "Closed with unmerged commits". It only shows up when the PR is closed:

image

I think it's fine. I think it's because you merged the PR by squashing these 3 commits into one and closed it via commit message (the Closes #561. string). That is not one of the few ways that GitHub can detect that a PR was actually merged instead of just closed.

@dmitshur dmitshur deleted the context-doc-updates branch February 22, 2017 22:33
@gmlewis
Copy link
Copy Markdown
Collaborator

gmlewis commented Feb 23, 2017

Thank you, @shurcooL! I appreciate the analysis and confirmation.
I was able to get my master branch back to normal (by a reset --hard to an older commit and then syncing to the latest), fortunately.

bubg-dev pushed a commit to bubg-dev/go-github that referenced this pull request Jun 16, 2017
oauth2.NoContext is deprecated. Replace it with context.Background() in
a few more places that were missed in 23d6cb9.

Related to google#560.
Closes google#561.

Change-Id: I17275ef6f5d2bc4ff0e59d58a66b54acea4233f7
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