Commit Graph

10 Commits

Author SHA1 Message Date
Catherine Lee
57f23ca58b Bot message changes for -f and rebase (#106150)
* Encourage people to use -i instead of -f for mergebot
* Add additional info for when rebase fails due to lacking permissions

<details><summary>dryrun</summary>

````
csl@csl-mbp ~/zzzzzzzz/pytorch [csl/errormsgs] $
(forpytorch) python3 .github/scripts/tryrebase.py 106089 --branch viable/strict --dry-run
+ git -C /Users/csl/zzzzzzzz/pytorch rev-parse --verify refs/remotes/origin/viable/strict
@pytorchbot started a rebase job onto [refs/remotes/origin/viable/strict](7c97c943fb). Check the current status [here](None)
+ git -C /Users/csl/zzzzzzzz/pytorch fetch origin pull/106089/head:pull/106089/head
+ git -C /Users/csl/zzzzzzzz/pytorch rebase refs/remotes/origin/viable/strict pull/106089/head
+ git -C /Users/csl/zzzzzzzz/pytorch rev-parse --verify pull/106089/head
+ git -C /Users/csl/zzzzzzzz/pytorch rev-parse --verify refs/remotes/origin/viable/strict
+ git -C /Users/csl/zzzzzzzz/pytorch push --dry-run -f https://github.com/Lightning-Sandbox/pytorch.git pull/106089/head:fix/spaces
stdout:
remote: Permission to Lightning-Sandbox/pytorch.git denied to clee2000.
fatal: unable to access 'https://github.com/Lightning-Sandbox/pytorch.git/': The requested URL returned error: 403

stderr:

Rebase failed due to Command `git -C /Users/csl/zzzzzzzz/pytorch push --dry-run -f https://github.com/Lightning-Sandbox/pytorch.git pull/106089/head:fix/spaces` returned non-zero exit code 128
```
remote: Permission to Lightning-Sandbox/pytorch.git denied to clee2000.
fatal: unable to access 'https://github.com/Lightning-Sandbox/pytorch.git/': The requested URL returned error: 403
```
This is likely because the author did not allow edits from maintainers on the PR or because the repo has additional permissions settings that mergebot does not qualify.
````
</details>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/106150
Approved by: https://github.com/huydhn
2023-07-28 16:13:51 +00:00
Nikita Shulga
54fe828cd0 Improve rebase message when PR is uptodate (#101504)
Also, preserve target branch commit revision at time of merge

Fixes https://github.com/pytorch/test-infra/issues/4148
Pull Request resolved: https://github.com/pytorch/pytorch/pull/101504
Approved by: https://github.com/ZainRizvi, https://github.com/huydhn
2023-05-16 17:26:08 +00:00
Nikita Shulga
20deccf8a1 BE changes for tryrebase.py (#101503)
- Use context manager rather than explicit ```try: finally:```

- Add `ref/remotes` prefix to `onto_branch` in `main` rather than in
`rebase_onto` functions

- Define `MAIN_BRANCH` and `VIABLE_STRICT_BRANCH` constants in tests.
- Replace `self.assertTrue(x in y)` with `self.assertIn(x, y)`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/101503
Approved by: https://github.com/ZainRizvi, https://github.com/huydhn
2023-05-16 17:26:08 +00:00
Nikita Shulga
2418b94576
Rename default branch to main (#99210)
Mostly `s/@master/@main` in numerous `.yml` files.

Keep `master` in `weekly.yml` as it refers to `xla` repo and in `test_trymerge.py` as it refers to a branch PR originates from.
2023-04-16 18:48:14 -07:00
Huy Do
4c0dce50fd [BE] Apply ufmt to run_test and GitHub Python util scripts (#97588)
This has been bugging me for a while as I'm working on these Python scripts and they are not tracked by ufmt linter.  So I add these script into that linter.

```
[[linter]]
code = 'UFMT'
include_patterns = [
    '.github/**/*.py',
    'test/run_test.py',
```

This change should just work and not break anything as ufmt (black + usort) linter is very safe to use for standalone util scripts.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97588
Approved by: https://github.com/kit1980
2023-03-26 04:52:55 +00:00
Catherine Lee
d7674e70f4 Fix for tryrebase after PR was merged (#91337)
rebasing certain merged prs results in the rebased branch pointing at the target branch b/c git believes the pr has already been included in the branch.  Git does not replay the changes onto the target branch because the change is already in the target branch

This usually affects PRs with only 1 commit (more commits -> trymerge squashes them when merged -> git believes that the change is not in the target branch b/c the squashed commit is different from the individual changes).

It might also affect ghstack changes b/c behind the scenes the ghstack PRs are all contained within one commit on the orig branch, but I'm not sure about this.

helps w/ https://github.com/pytorch/test-infra/issues/836
looks like https://github.com/clee2000/random-testing/pull/44#issuecomment-1363439534
Pull Request resolved: https://github.com/pytorch/pytorch/pull/91337
Approved by: https://github.com/ZainRizvi
2022-12-28 18:44:08 +00:00
Catherine Lee
86c42d63c8 rebase via comment - rebase to any branch (#78772)
pr in test infra: https://github.com/pytorch/test-infra/pull/366
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78772
Approved by: https://github.com/suo, https://github.com/janeyx99
2022-06-03 17:13:11 +00:00
swang392
dde56ca329 fixing invalid upstream for rebase to viable/strict (#78371)
Testing rebase functionality [#78360](https://github.com/pytorch/pytorch/pull/78360) failed due to `invalid upstream 'viable/strict'`. Fixing by changing branch string to "refs/remotes/origin/viable/strict"
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78371
Approved by: https://github.com/janeyx99
2022-05-26 17:43:39 +00:00
swang392
bbb2964bd8 Add functionality for rebasebot to rebase onto viable/strict branch (#78276)
Fixes #325
**Summary**: Currently, the pytorchbot only allows for rebasing to the master branch. These modifications add functionality for rebasing to the 'viable/strict' branch of pytorch/pytorch by adding a flag to the comment.
**Test Plan:** tested manually on personal fork ([#1](https://github.com/swang392/pytorch/pull/1)), and included a test case in test_tryrebase.py that checks if rebasing to viable/strict branch was successful.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78276
Approved by: https://github.com/clee2000, https://github.com/janeyx99
2022-05-25 21:02:39 +00:00
Catherine Lee
0bd8e237b5 rebase via comment
Fixes #ISSUE_NUMBER

start rebase bot

random testing on my fork, using `on: issue_comment` https://github.com/clee2000/pytorch/pull/6

stealing both code and an identity from mergebot

corresponding pr on test-infra https://github.com/pytorch/test-infra/pull/305

doesnt do ghstack

should accept "@pytorchbot rebase me", "@pytorchbot rebase this", "@pytorchmergebot rebase this"
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76262
Approved by: https://github.com/janeyx99, https://github.com/seemethere
2022-04-27 00:55:05 +00:00