This is an archive of the discontinued LLVM Phabricator instance.

Update git-llvm script to push to GitHub
ClosedPublic

Authored by tstellar on Sep 19 2019, 12:21 PM.

Details

Summary

Note: This patch should not be pushed until SVN has become read-only.
It should be the first patch committed directly to GitHub.

This patch updates git-llvm to check for merge commits and then push
changes to GitHub if none are found. All logic related to SVN has been
removed.

I need help testing this to make sure it is robust and that the merge
commit checks can cover every case. To test only the merge checks,
just run git-llvm push --dry-run.

If you want to also test pushing chagnes, change the GIT_ORG and
GIT_REPO variables to one of your personal github repositories.
You will also need to enable the branch protections and the 'rebased'
status check for the branches you are trying to push to.

You need to run the script at least once with an unpushed commits
in order for the 'rebased' status check to appear as an option
to enable in your github projects configuration.

Diff Detail

Event Timeline

tstellar created this revision.Sep 19 2019, 12:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2019, 12:21 PM
lenary added a subscriber: lenary.Oct 14 2019, 12:05 PM

One request:

llvm/utils/git-svn/git-llvm
96

Please may you ensure that this works for the non-monorepo LLVM repositories when it initially goes live?

This revision was not accepted when it landed; it landed in state Needs Review.Oct 22 2019, 9:27 AM
This revision was automatically updated to reflect the committed changes.
thakis added a subscriber: thakis.Oct 22 2019, 9:58 AM

I'm getting

$ llvm/utils/git-svn/git-llvm push -n
Traceback (most recent call last):
  File "llvm/utils/git-svn/git-llvm", line 39, in <module>
    import github
ImportError: No module named github

now. Are there docs on what I need to do to be able to commit using this script now?

Alternatively I tried pushing via git directly but couldn't get that to work either:

$ git push origin mylocalbranch:master
Enumerating objects: 13, done.
Counting objects: 100% (13/13), done.
Delta compression using up to 24 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 657 bytes | 657.00 KiB/s, done.
Total 7 (delta 6), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (6/6), completed with 6 local objects.
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: You're not authorized to push to this branch. Visit https://help.github.com/articles/about-protected-branches/ for more information.
To https://github.com/llvm/llvm-project.git
 ! [remote rejected]         gnmergerev -> master (protected branch hook declined)
error: failed to push some refs to 'https://github.com/llvm/llvm-project.git'