|
| 1 | +branchsync 🪄 |
| 2 | +============= |
| 3 | + |
| 4 | +Synces (and creates) backport branches of your src.fp.o Python Pull Requests. |
| 5 | + |
| 6 | +Given the src.fp.o's fork username and branch, |
| 7 | +this tool creates new branches when needed and gives you links to open new |
| 8 | +src.fp.o pull requests. |
| 9 | + |
| 10 | +Can be used repeatedly when the branch was updated. |
| 11 | + |
| 12 | +Needs recent [ferrypick](https://github.com/fedora-python/ferrypick). |
| 13 | + |
| 14 | +Example (only the first command is actually run by the user): |
| 15 | + |
| 16 | +``` |
| 17 | +$ ./branchsync.py python3.6 update-to-3-6-12 thrnciar |
| 18 | +$ whoami |
| 19 | +churchyard |
| 20 | +$ git clone ssh://pkgs.fedoraproject.org/rpms/python3.6.git python3.6 |
| 21 | +Cloning into 'python3.6'... |
| 22 | +remote: Enumerating objects: 1922, done. |
| 23 | +remote: Counting objects: 100% (1922/1922), done. |
| 24 | +remote: Compressing objects: 100% (791/791), done. |
| 25 | +remote: Total 1922 (delta 1188), reused 1855 (delta 1123) |
| 26 | +Receiving objects: 100% (1922/1922), 1.18 MiB | 1.87 MiB/s, done. |
| 27 | +Resolving deltas: 100% (1188/1188), done. |
| 28 | +$ git remote add new ssh://pkgs.fedoraproject.org/forks/thrnciar/rpms/python3.6.git --fetch |
| 29 | +From ssh://pkgs.fedoraproject.org/forks/thrnciar/rpms/python3.6 |
| 30 | + * [new branch] f33 -> new/f33 |
| 31 | + * [new branch] master -> new/master |
| 32 | + * [new branch] update-to-3-6-12 -> new/update-to-3-6-12 |
| 33 | +Updating new |
| 34 | +$ git remote add backport ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python3.6.git |
| 35 | +$ git remote -v |
| 36 | +backport ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python3.6.git (fetch) |
| 37 | +backport ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python3.6.git (push) |
| 38 | +new ssh://pkgs.fedoraproject.org/forks/thrnciar/rpms/python3.6.git (fetch) |
| 39 | +new ssh://pkgs.fedoraproject.org/forks/thrnciar/rpms/python3.6.git (push) |
| 40 | +origin ssh://pkgs.fedoraproject.org/rpms/python3.6.git (fetch) |
| 41 | +origin ssh://pkgs.fedoraproject.org/rpms/python3.6.git (push) |
| 42 | +$ git switch --track new/update-to-3-6-12 |
| 43 | +Switched to a new branch 'update-to-3-6-12' |
| 44 | +Branch 'update-to-3-6-12' set up to track remote branch 'update-to-3-6-12' from 'new'. |
| 45 | +$ git merge-base --is-ancestor origin/f33 update-to-3-6-12 |
| 46 | +https://src.fedoraproject.org/fork/thrnciar/rpms/python3.6/diff/f33..update-to-3-6-12 |
| 47 | +$ git remote add origin-f32 ssh://pkgs.fedoraproject.org/rpms/python36.git --fetch |
| 48 | +remote: Enumerating objects: 420, done. |
| 49 | +remote: Counting objects: 100% (381/381), done. |
| 50 | +remote: Compressing objects: 100% (195/195), done. |
| 51 | +remote: Total 339 (delta 208), reused 257 (delta 139) |
| 52 | +Receiving objects: 100% (339/339), 125.11 KiB | 585.00 KiB/s, done. |
| 53 | +Resolving deltas: 100% (208/208), completed with 23 local objects. |
| 54 | +From ssh://pkgs.fedoraproject.org/rpms/python36 |
| 55 | + * [new branch] el6 -> origin-f32/el6 |
| 56 | + * [new branch] epel7 -> origin-f32/epel7 |
| 57 | + * [new branch] f24 -> origin-f32/f24 |
| 58 | + * [new branch] f25 -> origin-f32/f25 |
| 59 | + * [new branch] f27 -> origin-f32/f27 |
| 60 | + * [new branch] f29 -> origin-f32/f29 |
| 61 | + * [new branch] f30 -> origin-f32/f30 |
| 62 | + * [new branch] f31 -> origin-f32/f31 |
| 63 | + * [new branch] f32 -> origin-f32/f32 |
| 64 | + * [new branch] master -> origin-f32/master |
| 65 | +Updating origin-f32 |
| 66 | +$ git remote add backport-f32 ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python36.git |
| 67 | +$ git remote -v |
| 68 | +backport ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python3.6.git (fetch) |
| 69 | +backport ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python3.6.git (push) |
| 70 | +backport-f32 ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python36.git (fetch) |
| 71 | +backport-f32 ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python36.git (push) |
| 72 | +new ssh://pkgs.fedoraproject.org/forks/thrnciar/rpms/python3.6.git (fetch) |
| 73 | +new ssh://pkgs.fedoraproject.org/forks/thrnciar/rpms/python3.6.git (push) |
| 74 | +origin ssh://pkgs.fedoraproject.org/rpms/python3.6.git (fetch) |
| 75 | +origin ssh://pkgs.fedoraproject.org/rpms/python3.6.git (push) |
| 76 | +origin-f32 ssh://pkgs.fedoraproject.org/rpms/python36.git (fetch) |
| 77 | +origin-f32 ssh://pkgs.fedoraproject.org/rpms/python36.git (push) |
| 78 | +$ git merge-base --is-ancestor origin-f32/f32 update-to-3-6-12 |
| 79 | +$ git format-patch origin/master |
| 80 | +$ fedpkg --name python3.6 sources |
| 81 | +Downloading Python-3.6.12.tar.xz |
| 82 | +
|
| 83 | +Downloading Python-3.6.12.tar.xz.asc |
| 84 | +$ fedpkg --name python36 new-sources Python-3.6.12.tar.xz Python-3.6.12.tar.xz.asc |
| 85 | +File already uploaded: Python-3.6.12.tar.xz |
| 86 | +File already uploaded: Python-3.6.12.tar.xz.asc |
| 87 | +Source upload succeeded. Don't forget to commit the sources file |
| 88 | +$ git switch --track origin-f32/f32 |
| 89 | +Switched to a new branch 'f32' |
| 90 | +Branch 'f32' set up to track remote branch 'f32' from 'origin-f32'. |
| 91 | +$ git switch -c f32-auto-thrnciar-update-to-3-6-12 |
| 92 | +Switched to a new branch 'f32-auto-thrnciar-update-to-3-6-12' |
| 93 | +$ git push --force -u backport-f32 f32-auto-thrnciar-update-to-3-6-12 |
| 94 | +Enumerating objects: 9, done. |
| 95 | +Counting objects: 100% (9/9), done. |
| 96 | +Delta compression using up to 8 threads |
| 97 | +Compressing objects: 100% (3/3), done. |
| 98 | +Writing objects: 100% (5/5), 824 bytes | 824.00 KiB/s, done. |
| 99 | +Total 5 (delta 3), reused 4 (delta 2), pack-reused 0 |
| 100 | +remote: Sending to redis to log activity and send commit notification emails |
| 101 | +remote: * Publishing information for 1 commits |
| 102 | +remote: - to fedora-message |
| 103 | +remote: |
| 104 | +remote: Create a pull-request for f32-auto-thrnciar-update-to-3-6-12 |
| 105 | +remote: https://src.fedoraproject.org/fork/churchyard/rpms/python36/diff/master..f32-auto-thrnciar-update-to-3-6-12 |
| 106 | +remote: |
| 107 | +To ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python36.git |
| 108 | + + 519ea4d...79109b1 f32-auto-thrnciar-update-to-3-6-12 -> f32-auto-thrnciar-update-to-3-6-12 (forced update) |
| 109 | +Branch 'f32-auto-thrnciar-update-to-3-6-12' set up to track remote branch 'f32-auto-thrnciar-update-to-3-6-12' from 'backport-f32'. |
| 110 | +$ git switch update-to-3-6-12 |
| 111 | +Switched to branch 'update-to-3-6-12' |
| 112 | +Your branch is up to date with 'new/update-to-3-6-12'. |
| 113 | +https://src.fedoraproject.org/fork/churchyard/rpms/python36/diff/f32..f32-auto-thrnciar-update-to-3-6-12 |
| 114 | +$ git remote add origin-f31 ssh://pkgs.fedoraproject.org/rpms/python36.git --fetch |
| 115 | +From ssh://pkgs.fedoraproject.org/rpms/python36 |
| 116 | + * [new branch] el6 -> origin-f31/el6 |
| 117 | + * [new branch] epel7 -> origin-f31/epel7 |
| 118 | + * [new branch] f24 -> origin-f31/f24 |
| 119 | + * [new branch] f25 -> origin-f31/f25 |
| 120 | + * [new branch] f27 -> origin-f31/f27 |
| 121 | + * [new branch] f29 -> origin-f31/f29 |
| 122 | + * [new branch] f30 -> origin-f31/f30 |
| 123 | + * [new branch] f31 -> origin-f31/f31 |
| 124 | + * [new branch] f32 -> origin-f31/f32 |
| 125 | + * [new branch] master -> origin-f31/master |
| 126 | +Updating origin-f31 |
| 127 | +$ git remote add backport-f31 ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python36.git |
| 128 | +$ git remote -v |
| 129 | +backport ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python3.6.git (fetch) |
| 130 | +backport ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python3.6.git (push) |
| 131 | +backport-f31 ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python36.git (fetch) |
| 132 | +backport-f31 ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python36.git (push) |
| 133 | +backport-f32 ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python36.git (fetch) |
| 134 | +backport-f32 ssh://pkgs.fedoraproject.org/forks/churchyard/rpms/python36.git (push) |
| 135 | +new ssh://pkgs.fedoraproject.org/forks/thrnciar/rpms/python3.6.git (fetch) |
| 136 | +new ssh://pkgs.fedoraproject.org/forks/thrnciar/rpms/python3.6.git (push) |
| 137 | +origin ssh://pkgs.fedoraproject.org/rpms/python3.6.git (fetch) |
| 138 | +origin ssh://pkgs.fedoraproject.org/rpms/python3.6.git (push) |
| 139 | +origin-f31 ssh://pkgs.fedoraproject.org/rpms/python36.git (fetch) |
| 140 | +origin-f31 ssh://pkgs.fedoraproject.org/rpms/python36.git (push) |
| 141 | +origin-f32 ssh://pkgs.fedoraproject.org/rpms/python36.git (fetch) |
| 142 | +origin-f32 ssh://pkgs.fedoraproject.org/rpms/python36.git (push) |
| 143 | +$ git merge-base --is-ancestor origin-f31/f31 f32-auto-thrnciar-update-to-3-6-12 |
| 144 | +https://src.fedoraproject.org/fork/thrnciar/rpms/python36/diff/f31..f32-auto-thrnciar-update-to-3-6-12 |
| 145 | +``` |
| 146 | + |
| 147 | +The output looks very verbose, but there are colors to guide you. |
| 148 | + |
| 149 | +TODO |
| 150 | +---- |
| 151 | + |
| 152 | +- fork the repo if needed |
| 153 | +- read the initial branch info from src.fp.o |
| 154 | +- create the new PRs on src.fp.o |
| 155 | + |
| 156 | +Caution |
| 157 | +------- |
| 158 | + |
| 159 | +This force pushes to `<fedora_branch>-auto-<original_username>-<original_branch>` |
| 160 | +(e.g. `f32-auto-thrnciar-update-to-3-6-12`) into your fork without looking. |
| 161 | +This can erase data, you have been warned. |
0 commit comments