Pull Request HowTo

Post here if you have re-based and finalised code to integrate into master, which was discussed, agreed to and tested in other forums. You can also submit your PR directly on github.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Pull Request HowTo

Post by bernd »

blacey wrote:
Kunda1 wrote:It would be whimsical and fun but for sure not essential, to have a way to know when someone has sent a PR to the FC repo.
Not sure how. :mrgreen:
1) You can already - just ensure the activity feed is visible in Gitter
How does this works? I have been clicking around in Gitter but do not really understand what it is for how it should be used?
User avatar
kkremitzki
Veteran
Posts: 2511
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: Pull Request HowTo

Post by kkremitzki »

blacey wrote:
Kunda1 wrote:It would be whimsical and fun but for sure not essential, to have a way to know when someone has sent a PR to the FC repo.
Not sure how. :mrgreen:
1) You can already - just ensure the activity feed is visible in Gitter
2) I thought Kurt was developing an auto-poster that would generate the Pull-request post in the forum.

But, I definitely agree with @yorik that the additional overhead does not provide any real value - if a process step doesn't provide value, it should be eliminated ;)
Yeah, I was/am, but ultimately it's really up to Yorik/Werner as to whether it has any use to continue to make PRs on the forums.

Anyway, here's the status of what I have:
  • A webhook server set up at api.kwkengineering.com
  • Which will make a new topic here with the subject and contents of a new PR if a repo is set to send webhooks to it
  • After the topic is created the link can be added in a comment on the PR
  • It does NOT have locking the PR from further comments is not supported by PyGithub currently but can be implemented fairly easily with requests since it's a length 0 HTTP PUT to an address that can be constructed from the info in the PR
Features like automatically moving closed/merged PR topics could be added pretty easily.

The code is a bit too messy to publish just yet because I have was having some issues with paths, etc, and they're hardcoded in plus debug statements and so forth. Regardless it was still a worthwhile learning experience and there may be some use for a webhook server in the future, even if it's for me and not the FreeCAD project.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
User avatar
kkremitzki
Veteran
Posts: 2511
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: Pull Request HowTo

Post by kkremitzki »

bernd wrote:
blacey wrote:
Kunda1 wrote:It would be whimsical and fun but for sure not essential, to have a way to know when someone has sent a PR to the FC repo.
Not sure how. :mrgreen:
1) You can already - just ensure the activity feed is visible in Gitter
How does this works? I have been clicking around in Gitter but do not really understand what it is for how it should be used?
Do you see the activity feed? It's shown by clicking a little hamburger menu (three horizontal lines) in the bottom right. Then it shows new PRs, comments, issues, merges, build statuses, etc, in a pane on the right.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Pull Request HowTo

Post by bernd »

kkremitzki wrote:
bernd wrote:
blacey wrote:
Kunda1 wrote:It would be whimsical and fun but for sure not essential, to have a way to know when someone has sent a PR to the FC repo.
Not sure how. :mrgreen:
1) You can already - just ensure the activity feed is visible in Gitter
How does this works? I have been clicking around in Gitter but do not really understand what it is for how it should be used?
Do you see the activity feed? It's shown by clicking a little hamburger menu (three horizontal lines) in the bottom right. Then it shows new PRs, comments, issues, merges, build statuses, etc, in a pane on the right.
Mhh for me the three horizontal lines are on the bottom left and if I click on them a search opens. My idea was to add me too FreeCAD first because gitter do not know I would like to join FreeCAD community on gitter or does it?
User avatar
kkremitzki
Veteran
Posts: 2511
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: Pull Request HowTo

Post by kkremitzki »

bernd wrote:
kkremitzki wrote:
bernd wrote:
blacey wrote:
Kunda1 wrote:It would be whimsical and fun but for sure not essential, to have a way to know when someone has sent a PR to the FC repo.
Not sure how. :mrgreen:
1) You can already - just ensure the activity feed is visible in Gitter
How does this works? I have been clicking around in Gitter but do not really understand what it is for how it should be used?
Do you see the activity feed? It's shown by clicking a little hamburger menu (three horizontal lines) in the bottom right. Then it shows new PRs, comments, issues, merges, build statuses, etc, in a pane on the right.
Mhh for me the three horizontal lines are on the bottom left and if I click on them a search opens. My idea was to add me too FreeCAD first because gitter do not know I would like to join FreeCAD community on gitter or does it?
Yeah, it sounds like you might need to join the FreeCAD/FreeCAD room first.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Pull Request HowTo

Post by bernd »

kkremitzki wrote:Yeah, it sounds like you might need to join the FreeCAD/FreeCAD room first.
I could not find the room in gui. What I did was typing the following in the browser address: https://gitter.im/FreeCAD/FreeCAD Than on the bottom there is an orange button "join room" Thanks
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Pull Request HowTo

Post by yorik »

Of course there would always be the possibility to do some webhook stuff to automatically post here when a PR is done on github, like kkremitzki did, but then it should be in a place or in a manner that doesn't need handling here. Maybe directly in the "archived pull requests" section...
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: Pull Request HowTo

Post by keithsloan52 »

My copy repository for FreeCAD is out of sync with the main repository and I don't know how to proceed when I try and update it to the latest version of the officail repo I get the following

Code: Select all

family@Desktop:~/FreeCAD/git-src/FreeCAD_sf_master$ git pull official master
remote: Counting objects: 204, done.
remote: Total 204 (delta 161), reused 161 (delta 161), pack-reused 43
Receiving objects: 100% (204/204), 53.10 KiB | 0 bytes/s, done.
Resolving deltas: 100% (179/179), completed with 111 local objects.
From https://github.com/FreeCAD/FreeCAD
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> official/master
Auto-merging src/Mod/OpenSCAD/importCSG.py
CONFLICT (content): Merge conflict in src/Mod/OpenSCAD/importCSG.py
Automatic merge failed; fix conflicts and then commit the result.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Pull Request HowTo

Post by wmayer »

Following the suggestions here you can use git reset with the option --hard.
But before using it make sure that you don't have any local changes you want to contribute because otherwise they are lost.

So, when you are sure you want to sync to FreeCAD master check with git log which <sha1> hash is the last one from official master in your local repository and then you can do:
git reset --hard <sha1>
Afterwards run git pull to get the latest changes from the FreeCAD master.

In future when creating a PR make sure that you create a local branch which you can push to your github account
git checkout -b my_local_branch
  1. before pushing your branch make sure it's rebased on the latest FreeCAD master
  2. after you pushed the branch and FreeCAD master has been changed in the meantime just leave it. Do not merge changes of FreeCAD master back to your branch
  3. after the PR has been merged you can delete your local branch
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: Pull Request HowTo

Post by keithsloan52 »

When I try and rebase on to master I just get the following messages

Code: Select all

family@Desktop:~/FreeCAD/git-src/FreeCAD_sf_master/src/Mod/OpenSCAD$ git commit -a
[offset2 b4f540e] Add support for OpenSCAD offset
 1 file changed, 39 insertions(+), 24 deletions(-)
family@Desktop:~/FreeCAD/git-src/FreeCAD_sf_master/src/Mod/OpenSCAD$ git status
On branch offset2
nothing to commit, working directory clean
family@Desktop:~/FreeCAD/git-src/FreeCAD_sf_master/src/Mod/OpenSCAD$ git rebase master offset2
Already on 'offset2'
Current branch offset2 is up to date.
Looks like rebase did nothing, what did I do wrong?
Post Reply