How to create my first pull request


(Pavol Vaskovic) #1

Hi!

I’d like to create my first full request (as requested by Jordan Rose in
SR-4373 <https://bugs.swift.org/browse/SR-4373>), but I didn’t find enough
information about how to proceed on the Swift’s Contributing page, nor
during my googling.

I am not very familiar with git/github outside of browsing and checking out
code.

So far I have completed the "Getting Started” steps:
* checked out the swift-source
* got it to compile on my machine (debug and release)
* manually ran benchmark suite (filed SR-4357
<https://bugs.swift.org/browse/SR-4357>, BTW what does SR for?)

Now the Contributing to Swift guide
<https://swift.org/contributing/#contributing-code> left me hanging dry. I
don’t understand what should I do now.

I think I should fork the apple/swift project on GitHub.It looks like the
update-checkout script can be configured using update-checkout-config.json…
is this where I point it to my fork?

I guess I should create a branch where I’ll develop my changes and then
create a pull request from there? (I’ve skimmed
https://help.github.com/articles/creating-a-pull-request-from-a-fork/)

Can somebody point me to more detailed documentation or tell me how should
I proceed? Thanks!

Best regards
Pavol Vaskovic


(David Sweeris) #2

(I don’t know what SR stands for… maybe “Service Request”? Anyway…)

What I did was fork apple/swift so I have a copy of the project in my github account, and create branches off of that for whatever SR I’m working on. Then when the issue is resolved and I’ve committed all the changes to the branch hosted on my github, I go to Apple’s repository and submit a pull request to their master branch from whatever branch I was working on in my fork.

I’m not sure this is the best way (in particular, I haven’t figured out how to automatically sync my fork’s master with Apple’s master), but it’s worked so far.

I hope that helps! I’m pretty new to git/github as well, so I know where you’re coming from in terms of being confused by everything.

- Dave Sweeris

···

On Mar 27, 2017, at 1:10 PM, Pavol Vaskovic via swift-dev <swift-dev@swift.org> wrote:

Hi!

I’d like to create my first full request (as requested by Jordan Rose in SR-4373 <https://bugs.swift.org/browse/SR-4373>), but I didn’t find enough information about how to proceed on the Swift’s Contributing page, nor during my googling.

I am not very familiar with git/github outside of browsing and checking out code.

So far I have completed the "Getting Started” steps:
* checked out the swift-source
* got it to compile on my machine (debug and release)
* manually ran benchmark suite (filed SR-4357 <https://bugs.swift.org/browse/SR-4357>, BTW what does SR for?)

Now the Contributing to Swift guide <https://swift.org/contributing/#contributing-code> left me hanging dry. I don’t understand what should I do now.

I think I should fork the apple/swift project on GitHub.It looks like the update-checkout script can be configured using update-checkout-config.json… is this where I point it to my fork?

I guess I should create a branch where I’ll develop my changes and then create a pull request from there? (I’ve skimmed https://help.github.com/articles/creating-a-pull-request-from-a-fork/)

Can somebody point me to more detailed documentation or tell me how should I proceed? Thanks!


(Max Moiseev) #3

This tutorial looks very detailed and should answer most of your questions: https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github

If you’re not very comfortable with, or don’t want to use command line, there are standalone GUI applications that support working with github as well as IDE and editor integrations that might help.

Max

···

On Mar 27, 2017, at 1:10 PM, Pavol Vaskovic via swift-dev <swift-dev@swift.org> wrote:

Hi!

I’d like to create my first full request (as requested by Jordan Rose in SR-4373 <https://bugs.swift.org/browse/SR-4373>), but I didn’t find enough information about how to proceed on the Swift’s Contributing page, nor during my googling.

I am not very familiar with git/github outside of browsing and checking out code.

So far I have completed the "Getting Started” steps:
* checked out the swift-source
* got it to compile on my machine (debug and release)
* manually ran benchmark suite (filed SR-4357 <https://bugs.swift.org/browse/SR-4357>, BTW what does SR for?)

Now the Contributing to Swift guide <https://swift.org/contributing/#contributing-code> left me hanging dry. I don’t understand what should I do now.

I think I should fork the apple/swift project on GitHub.It looks like the update-checkout script can be configured using update-checkout-config.json… is this where I point it to my fork?

I guess I should create a branch where I’ll develop my changes and then create a pull request from there? (I’ve skimmed https://help.github.com/articles/creating-a-pull-request-from-a-fork/)

Can somebody point me to more detailed documentation or tell me how should I proceed? Thanks!

Best regards
Pavol Vaskovic
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev


(Alex Martini) #4

Here's the entry for SR in the Lexicon file:

An issue reported on bugs.swift.org. A backronym for "Swift Report"; really the name is derived from LLVM's idiomatic use of "PR" ("Problem Report") for its bugs. We didn't go with "PR" for Swift because we wanted to be able to unambiguously reference LLVM bugs.

https://github.com/apple/swift/blob/master/docs/Lexicon.rst

···

On Mar 27, 2017, at 1:10 PM, Pavol Vaskovic via swift-dev <swift-dev@swift.org> wrote:

So far I have completed the "Getting Started” steps:
* checked out the swift-source
* got it to compile on my machine (debug and release)
* manually ran benchmark suite (filed SR-4357, BTW what does SR for?)


(Pavol Vaskovic) #5

Hi Max!

···

On 28 Mar 2017, at 01:19, Max Moiseev <moiseev@apple.com> wrote:

This tutorial looks very detailed and should answer most of your questions: https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github

Thank you for that link! But I'd like to hear how does that general process integrate with the `update-checkout` script provided in the swift project. That's what is described in the Getting Started part of the Readme.md and I'd love to see more thorough description on the Contributing Code section.

I'm confused about where/how do I switch my local copy created by the `update-checkout` script to use my own fork from https://github.com/palimondo/swift
Will that script get confused when I manually mess with the directory structure it created? What is the update-checkout-config.json for?

Best regards
Pavol Vaskovic


(Max Moiseev) #6

Hi Pavol,

update-checkout, as far as I know, is only there to help you work with *all* the Swift repositories at the same time. This way you won’t have to separately go to every folder and invoke `git pull origin master`. The config file for update-checkout simply lists the ‘schemes’ which are the combinations of branches from different repos that are compatible with each other. For example, master branch in apple/swift repository supposed to be compiled with ‘stable’ branches of llvm and clang, which is not true for the ‘swift-3.0-branch’ branch, for example, it should be compiled with ‘swift-3.0-branch’ of llvm etc.

Long story short, it is possible to update the update-checkout and its config to simplify your workflow, but you don’t have to do so.

I personally use this script only before starting a new branch, to make sure that my changes go on top of current master and simplify merging them later.

cd swift
git checkout master
utils/update-checkout --scheme=master
git checkout -b my-new-branch
... some work gets done …
git add .
git commit -m “Adding an absolutely awesome new feature”
git push mine my-new-branch # please note that I prefer to call my personal fork ‘mine’ whereas usually people call their fork remotes ‘origin’ and the upstream ‘upstream’.
open https://github.com/apple/swift

Within a few seconds at the top of the github page you will see something like this:

Pressing this green button will initiate the creation of your Pull Request with the changes you’ve just pushed to your fork.

Hope this helps,
Max

···

On Mar 29, 2017, at 10:35 AM, Pavol Vaskovic <pali@pali.sk> wrote:

Hi Max!

On 28 Mar 2017, at 01:19, Max Moiseev <moiseev@apple.com <mailto:moiseev@apple.com>> wrote:

This tutorial looks very detailed and should answer most of your questions: https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github

Thank you for that link! But I'd like to hear how does that general process integrate with the `update-checkout` script provided in the swift project. That's what is described in the Getting Started part of the Readme.md and I'd love to see more thorough description on the Contributing Code section.

I'm confused about where/how do I switch my local copy created by the `update-checkout` script to use my own fork from https://github.com/palimondo/swift
Will that script get confused when I manually mess with the directory structure it created? What is the update-checkout-config.json for?

Best regards
Pavol Vaskovic


(Pavol Vaskovic) #7

Thanks Max! That was very enlightening. One more question…

···

On 29 Mar 2017, at 19:57, Max Moiseev <moiseev@apple.com> wrote:

[...]
cd swift
git checkout master
utils/update-checkout --scheme=master
git checkout -b my-new-branch
... some work gets done …
git add .
git commit -m “Adding an absolutely awesome new feature”
git push mine my-new-branch # please note that I prefer to call my personal fork ‘mine’ whereas usually people call their fork remotes ‘origin’ and the upstream ‘upstream’.
open https://github.com/apple/swift

When/where/how did you switch from upstream to your own fork (after the initial update-checkout)? Or am I misunderstanding how that works?

Best regards
Pavol Vaskovic


(Max Moiseev) #8

Thanks Max! That was very enlightening. One more question…

[...]
cd swift
git checkout master
utils/update-checkout --scheme=master
git checkout -b my-new-branch
... some work gets done …
git add .
git commit -m “Adding an absolutely awesome new feature”
git push mine my-new-branch # please note that I prefer to call my personal fork ‘mine’ whereas usually people call their fork remotes ‘origin’ and the upstream ‘upstream’.
open https://github.com/apple/swift

When/where/how did you switch from upstream to your own fork (after the initial update-checkout)? Or am I misunderstanding how that works?

You don’t need to switch from one remote to the other. It is only a matter of where you get the updates from and push your changes to. Typically you would pull from the upstream (apple/swift) and push changes to origin (yourown/swift).

update-checkout script will call `git pull origin BRANCH_NAME` so, I guess my unusual approach to naming remotes works well in this case.

···

On Mar 29, 2017, at 11:06 AM, Pavol Vaskovic <pali@pali.sk> wrote:
On 29 Mar 2017, at 19:57, Max Moiseev <moiseev@apple.com <mailto:moiseev@apple.com>> wrote:

Best regards
Pavol Vaskovic