Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/checkout/basic.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ init_test()
commit("A")
(A,) = gh_submit("Initial commit")

# Move to master and create another commit
git("checkout", "master")
# Move to main and create another commit
git("checkout", "main")
commit("B")

# Verify we're on master with commit B
# Verify we're on main with commit B
current_log = git("log", "--oneline", "-n", "1")
assert "Commit B" in current_log

Expand Down
2 changes: 1 addition & 1 deletion test/checkout/same_base_allows.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ assert len(diffs) == 2
A = diffs[0] # First commit (A)
B = diffs[1] # Second commit (B)

# Both PRs should have the same merge-base with master (initial commit)
# Both PRs should have the same merge-base with main (initial commit)
# Checkout PR A
gh_checkout(f"https://github.com/pytorch/pytorch/pull/{A.number}")

Expand Down
10 changes: 5 additions & 5 deletions test/checkout/same_base_rejects.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ from ghstack.test_prelude import *

init_test()

# Create first PR based on initial master
# Create first PR based on initial main
commit("A")
(A,) = gh_submit("First PR")

# Go back to master and advance it
git("checkout", "master")
# Go back to main and advance it
git("checkout", "main")
commit("B")
git("push", "origin", "master")
git("push", "origin", "main")

# Create second PR based on new master (different merge-base)
# Create second PR based on new main (different merge-base)
commit("C")
(C,) = gh_submit("Second PR")

Expand Down
8 changes: 4 additions & 4 deletions test/cherry_pick/basic.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ git("checkout", "-b", "feature")
commit("A")
(A,) = gh_submit("Initial commit")

# Switch to master and add another commit
git("checkout", "master")
# Switch to main and add another commit
git("checkout", "main")
commit("M")

# Before cherry-pick, "Commit A" should NOT be in recent master history
# Before cherry-pick, "Commit A" should NOT be in recent main history
log_before = git("log", "--oneline", "-n", "2")
assert "Commit A" not in log_before
assert "Commit M" in log_before

# Now cherry-pick the PR commit
gh_cherry_pick(f"https://github.com/pytorch/pytorch/pull/{A.number}")

# After cherry-pick, "Commit A" SHOULD be in recent master history
# After cherry-pick, "Commit A" SHOULD be in recent main history
log_after = git("log", "--oneline", "-n", "3")
assert "Commit A" in log_after
assert "Commit M" in log_after
Expand Down
6 changes: 3 additions & 3 deletions test/cherry_pick/conflict.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ git("checkout", "-b", "feature")
commit("A")
(A,) = gh_submit("Initial commit")

# Switch to master and modify the same file differently
git("checkout", "master")
# Switch to main and modify the same file differently
git("checkout", "main")
# The commit() function creates <name>.txt with content "A"
# Let's create a conflicting change by committing to the same file
write_file_and_add("A.txt", "Different content")
git("commit", "-m", "Conflicting change")

# Before cherry-pick, verify "Commit A" is not in master
# Before cherry-pick, verify "Commit A" is not in main
log_before = git("log", "--oneline", "-n", "2")
assert "Commit A" not in log_before
assert "Conflicting change" in log_before
Expand Down
8 changes: 4 additions & 4 deletions test/cherry_pick/stack.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ commit("A")
commit("B")
A, B = gh_submit("Initial stack")

# Switch to master and add another commit
git("checkout", "master")
# Switch to main and add another commit
git("checkout", "main")
commit("M")

# Before cherry-pick, "Commit B" should NOT be in recent master history
# Before cherry-pick, "Commit B" should NOT be in recent main history
log_before = git("log", "--oneline", "-n", "2")
assert "Commit B" not in log_before
assert "Commit M" in log_before
Expand All @@ -22,7 +22,7 @@ assert "Commit M" in log_before
# in the test environment's temporary directories
gh_cherry_pick(f"https://github.com/pytorch/pytorch/pull/{B.number}")

# After cherry-pick, "Commit B" SHOULD be in recent master history
# After cherry-pick, "Commit B" SHOULD be in recent main history
log_output = git("log", "--oneline", "-n", "3")
assert "Commit B" in log_output
assert "Commit M" in log_output
Expand Down
8 changes: 4 additions & 4 deletions test/cherry_pick/stack_manual.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ commit("C")
# Create PRs for the stack
A, B, C = gh_submit("Stack of 3 commits")

# Go back to master and create a divergent commit
git("checkout", "master")
# Go back to main and create a divergent commit
git("checkout", "main")
commit("M")

# Before cherry-pick, "Commit C" should NOT be in master history
# Before cherry-pick, "Commit C" should NOT be in main history
log_before = git("log", "--oneline", "-n", "2")
assert "Commit C" not in log_before
assert "Commit M" in log_before

# Now test cherry-picking the top commit only (not stack)
gh_cherry_pick(f"https://github.com/pytorch/pytorch/pull/{C.number}")

# After cherry-pick, should only have C and M in recent master history, not A and B
# After cherry-pick, should only have C and M in recent main history, not A and B
log_output = git("log", "--oneline", "-n", "4")
assert "Commit C" in log_output
assert "Commit M" in log_output
Expand Down
28 changes: 14 additions & 14 deletions test/land/default_branch_change.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ commit("A")
(diff1,) = gh_submit("Initial 1")
assert diff1 is not None

# make main branch
git("branch", "main", "master")
git("push", "origin", "main")
# change default branch to main
# make release branch
git("branch", "release", "main")
git("push", "origin", "release")
# change default branch to release
get_github().patch(
"repos/pytorch/pytorch",
name="pytorch",
default_branch="main",
default_branch="release",
)

assert_github_state(
Expand All @@ -33,7 +33,7 @@ assert_github_state(
| Initial 1
* 5a32949 (gh/ezyang/1/base)
| Initial 1 (base update)
* dc8bfe4 (HEAD -> master)
* dc8bfe4 (HEAD -> main)
Initial commit
"""
)
Expand All @@ -42,11 +42,11 @@ assert_github_state(
gh_land(diff1.pr_url)

assert_expected_inline(
get_upstream_sh().git("log", "--oneline", "master"),
get_upstream_sh().git("log", "--oneline", "main"),
"""dc8bfe4 Initial commit""",
)
assert_expected_inline(
get_upstream_sh().git("log", "--oneline", "main"),
get_upstream_sh().git("log", "--oneline", "release"),
"""\
8927014 Commit A
dc8bfe4 Initial commit""",
Expand All @@ -57,11 +57,11 @@ commit("B")
(diff2,) = gh_submit("Initial 2")
assert diff2 is not None

# change default branch back to master
# change default branch back to main
get_github().patch(
"repos/pytorch/pytorch",
name="pytorch",
default_branch="master",
default_branch="main",
)

assert_github_state(
Expand Down Expand Up @@ -90,13 +90,13 @@ assert_github_state(
| Initial 2
* 742ae0b (gh/ezyang/2/base)
| Initial 2 (base update)
* 8927014 (main, gh/ezyang/1/orig)
* 8927014 (release, gh/ezyang/1/orig)
| Commit A
| * 36fcfdf (gh/ezyang/1/head)
| | Initial 1
| * 5a32949 (gh/ezyang/1/base)
|/ Initial 1 (base update)
* dc8bfe4 (HEAD -> master)
* dc8bfe4 (HEAD -> main)
Initial commit
"""
)
Expand All @@ -105,14 +105,14 @@ assert_github_state(
gh_land(diff2.pr_url)

assert_expected_inline(
get_upstream_sh().git("log", "--oneline", "master"),
get_upstream_sh().git("log", "--oneline", "main"),
"""\
6b7e56e Commit B (#501)
1132c50 Commit A (#500)
dc8bfe4 Initial commit""",
)
assert_expected_inline(
get_upstream_sh().git("log", "--oneline", "main"),
get_upstream_sh().git("log", "--oneline", "release"),
"""\
8927014 Commit A
dc8bfe4 Initial commit""",
Expand Down
4 changes: 2 additions & 2 deletions test/land/early_mod.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ amend("A2")
gh_submit("Update")

gh_land(pr_url)
assert_expected_inline(get_upstream_sh().git("show", "master:A2.txt"), """A""")
assert_expected_inline(get_upstream_sh().git("show", "master:B.txt"), """A""")
assert_expected_inline(get_upstream_sh().git("show", "main:A2.txt"), """A""")
assert_expected_inline(get_upstream_sh().git("show", "main:B.txt"), """A""")
2 changes: 1 addition & 1 deletion test/land/ff.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pr_url = diff.pr_url

gh_land(pr_url)
assert_expected_inline(
get_upstream_sh().git("log", "--oneline", "master"),
get_upstream_sh().git("log", "--oneline", "main"),
"""\
d518c9f Commit A (#500)
dc8bfe4 Initial commit""",
Expand Down
2 changes: 1 addition & 1 deletion test/land/ff_stack.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pr_url = diff2.pr_url

gh_land(pr_url)
assert_expected_inline(
get_upstream_sh().git("log", "--oneline", "master"),
get_upstream_sh().git("log", "--oneline", "main"),
"""\
4099517 Commit B (#501)
c28edd5 Commit A (#500)
Expand Down
2 changes: 1 addition & 1 deletion test/land/ff_stack_two_phase.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pr_url2 = diff2.pr_url
gh_land(pr_url1)
gh_land(pr_url2)
assert_expected_inline(
get_upstream_sh().git("log", "--oneline", "master"),
get_upstream_sh().git("log", "--oneline", "main"),
"""\
4099517 Commit B (#501)
c28edd5 Commit A (#500)
Expand Down
4 changes: 2 additions & 2 deletions test/land/invalid_resubmit.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ assert_expected_raises_inline(

# Do the remediation
gh_unlink()
git("rebase", "origin/master")
git("rebase", "origin/main")
gh_submit("New PR")

if is_direct():
Expand Down Expand Up @@ -52,7 +52,7 @@ else:
| New PR
* 5f392f5 (gh/ezyang/1/base)
| New PR (base update)
* d518c9f (HEAD -> master)
* d518c9f (HEAD -> main)
| Commit A (#500)
* dc8bfe4
Initial commit
Expand Down
4 changes: 2 additions & 2 deletions test/land/non_ff.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ commit("A")
assert diff is not None
pr_url = diff.pr_url

git("reset", "--hard", "origin/master")
git("reset", "--hard", "origin/main")
commit("U")
git("push")

git("checkout", "gh/ezyang/1/orig")
gh_land(pr_url)

assert_expected_inline(
get_upstream_sh().git("log", "--oneline", "master"),
get_upstream_sh().git("log", "--oneline", "main"),
"""\
8b61aeb Commit A (#500)
38808c0 Commit U
Expand Down
6 changes: 3 additions & 3 deletions test/land/non_ff_stack_two_phase.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ assert diff2 is not None
pr_url1 = diff1.pr_url
pr_url2 = diff2.pr_url

git("checkout", "origin/master")
git("checkout", "origin/main")
commit("C")
git("push", "origin", "HEAD:master")
git("push", "origin", "HEAD:main")

gh_land(pr_url1)
gh_land(pr_url2)
assert_expected_inline(
get_upstream_sh().git("log", "--oneline", "master"),
get_upstream_sh().git("log", "--oneline", "main"),
"""\
402e96c Commit B (#501)
e388a10 Commit A (#500)
Expand Down
6 changes: 3 additions & 3 deletions test/land/update_after_land.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ assert diff1 is not None
assert diff2 is not None

# setup an upstream commit, so the land isn't just trivial
git("reset", "--hard", "origin/master")
git("reset", "--hard", "origin/main")
commit("U")
git("push")

Expand All @@ -30,7 +30,7 @@ assert_expected_raises_inline(
)

# show the remediation works
git("rebase", "origin/master")
git("rebase", "origin/main")
gh_submit("Run 3")

if is_direct():
Expand Down Expand Up @@ -64,7 +64,7 @@ else:
|\\ Run 3
| * a800ca6 (gh/ezyang/2/base)
| |\\ Run 3 (base update)
| | * 70eb094 (HEAD -> master)
| | * 70eb094 (HEAD -> main)
| | | Commit A (#500)
| | * 7f0288c
| | | Commit U
Expand Down
2 changes: 1 addition & 1 deletion test/log/explicit_pr.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ init_test()
commit("A")
(A,) = gh_submit("Initial commit")

git("checkout", "master")
git("checkout", "main")

with captured_output() as (out, _):
gh_log(
Expand Down
6 changes: 3 additions & 3 deletions test/submit/amend.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ amend("A2")
if is_direct():
assert_github_state(
"""\
[O] #500 Commit A (gh/ezyang/1/head -> master)
[O] #500 Commit A (gh/ezyang/1/head -> main)

This is commit A

Expand All @@ -24,7 +24,7 @@ if is_direct():
| Update A
* 8c7d059
| Initial 1
* dc8bfe4 (HEAD -> master)
* dc8bfe4 (HEAD -> main)
Initial commit
"""
)
Expand All @@ -49,7 +49,7 @@ else:
| Initial 1
* 5a32949 (gh/ezyang/1/base)
| Initial 1 (base update)
* dc8bfe4 (HEAD -> master)
* dc8bfe4 (HEAD -> main)
Initial commit
""",
)
Loading
Loading