Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a parent commit pointing to orig base to help CI scripts out #241

Merged
merged 1 commit into from
Mar 25, 2024
Merged
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
20 changes: 19 additions & 1 deletion ghstack/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,22 @@ def _create_non_orig_branches(
base_args: List[str] = []
if push_branches.base.commit is not None:
base_args.extend(("-p", push_branches.base.commit.commit_id))
# We don't technically need to do this, but often tooling
# relies on pull requests being able to compute merge-base
# with the main branch. While the result you get here can be
# misleading (in particular, the merge-base will not
# incorporate changes on base, and if a ghstack has been
# rebased backwards in time, the merge-base will be stuck
# on the more recent commit), it is useful so we put it in.
extra_base = self.sh.git("merge-base", base.commit_id, self.base)
if push_branches.base.commit is None or not self.sh.git(
"merge-base",
"--is-ancestor",
extra_base,
push_branches.base.commit.commit_id,
exitcode=True,
):
base_args.extend(("-p", extra_base))
new_base = GitCommitHash(
self.sh.git(
"commit-tree",
Expand Down Expand Up @@ -1676,7 +1692,9 @@ def assert_eq(a: Any, b: Any) -> None:
# Direct commit parent typically have base, as it will be the
# main branch
if not self.direct:
assert not base_commit.parents
pass
# This is now set to the orig base
# assert not base_commit.parents

# 8. Head branch is not malformed
assert self.sh.git(
Expand Down
32 changes: 19 additions & 13 deletions test/land/default_branch_change.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ assert_github_state(

This is commit A

* 36498d0 Initial 1
* 36fcfdf Initial 1

Repository state:

* 36498d0 (gh/ezyang/1/head)
* 36fcfdf (gh/ezyang/1/head)
| Initial 1
* 3e4048c (gh/ezyang/1/base)
Initial 1 (base update)
* 5a32949 (gh/ezyang/1/base)
| Initial 1 (base update)
* dc8bfe4 (HEAD -> master)
Initial commit
"""
)

Expand Down Expand Up @@ -71,7 +73,7 @@ assert_github_state(

This is commit A

* 36498d0 Initial 1
* 36fcfdf Initial 1

[O] #501 Commit B (gh/ezyang/2/head -> gh/ezyang/2/base)

Expand All @@ -80,18 +82,22 @@ assert_github_state(

This is commit B

* f30ebce Initial 2
* cfc0530 Initial 2

Repository state:

* f30ebce (gh/ezyang/2/head)
* cfc0530 (gh/ezyang/2/head)
| Initial 2
* 94673ed (gh/ezyang/2/base)
Initial 2 (base update)
* 36498d0 (gh/ezyang/1/head)
| Initial 1
* 3e4048c (gh/ezyang/1/base)
Initial 1 (base update)
* bf457db (gh/ezyang/2/base)
| Initial 2 (base update)
* 8b023bd (main, 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)
Initial commit
"""
)

Expand Down
12 changes: 8 additions & 4 deletions test/land/invalid_resubmit.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,18 @@ else:

This is commit A

* 5f66713 New PR
* edc8acf New PR

Repository state:

* 5f66713 (gh/ezyang/1/head)
* edc8acf (gh/ezyang/1/head)
| New PR
* dd7d794 (gh/ezyang/1/base)
New PR (base update)
* b38da4f (gh/ezyang/1/base)
| New PR (base update)
* 8b023bd (HEAD -> master)
| Commit A
* dc8bfe4
Initial commit
"""
)

Expand Down
24 changes: 15 additions & 9 deletions test/land/update_after_land.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,25 @@ else:

This is commit B

* ea56242 Run 3
* a3419f5 Initial 1
* 885020e Run 3
* d96fc53 Initial 1

Repository state:

* ea56242 (gh/ezyang/2/head)
* 885020e (gh/ezyang/2/head)
|\\ Run 3
| * c7cbff7 (gh/ezyang/2/base)
| | Run 3 (base update)
* | a3419f5
|/ Initial 1
* c66825d
Initial 1 (base update)
| * 1396fc7 (gh/ezyang/2/base)
| |\\ Run 3 (base update)
| | * 7f0288c
| | | Commit U
* | | d96fc53
|/ / Initial 1
* | 20df153
| | Initial 1 (base update)
* | c5f6953
|/ Commit A
* dc8bfe4
Initial commit
"""
)

Expand Down
14 changes: 8 additions & 6 deletions test/submit/amend.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,18 @@ else:

This is commit A

* 5d7b4a1 Update A
* 36498d0 Initial 1
* f004e08 Update A
* 36fcfdf Initial 1

Repository state:

* 5d7b4a1 (gh/ezyang/1/head)
* f004e08 (gh/ezyang/1/head)
| Update A
* 36498d0
* 36fcfdf
| Initial 1
* 3e4048c (gh/ezyang/1/base)
Initial 1 (base update)
* 5a32949 (gh/ezyang/1/base)
| Initial 1 (base update)
* dc8bfe4 (HEAD -> master)
Initial commit
""",
)
36 changes: 20 additions & 16 deletions test/submit/amend_all.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ else:

This is commit A

* 2beb1f1 Update A
* 36498d0 Initial 1
* 3bc91e8 Update A
* 36fcfdf Initial 1

[O] #501 Commit B (gh/ezyang/2/head -> gh/ezyang/2/base)

Expand All @@ -67,24 +67,28 @@ else:

This is commit B

* 4430ba6 Update A
* f30ebce Initial 2
* 3fb0bed Update A
* cfc0530 Initial 2

Repository state:

* 2beb1f1 (gh/ezyang/1/head)
* 3bc91e8 (gh/ezyang/1/head)
| Update A
* 36498d0
* 36fcfdf
| Initial 1
* 3e4048c (gh/ezyang/1/base)
Initial 1 (base update)
* 4430ba6 (gh/ezyang/2/head)
|\\ Update A
| * d315f95 (gh/ezyang/2/base)
| | Update A (base update)
* | f30ebce
|/ Initial 2
* 94673ed
Initial 2 (base update)
* 5a32949 (gh/ezyang/1/base)
| Initial 1 (base update)
| * 3fb0bed (gh/ezyang/2/head)
| |\\ Update A
| | * edd4564 (gh/ezyang/2/base)
| | | Update A (base update)
| * | cfc0530
| |/ Initial 2
| * bf457db
| | Initial 2 (base update)
| * 8b023bd
|/ Commit A
* dc8bfe4 (HEAD -> master)
Initial commit
"""
)
34 changes: 19 additions & 15 deletions test/submit/amend_bottom.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ else:

This is commit A

* 23930b1 Update A
* 36498d0 Initial 1
* 414cdf2 Update A
* 36fcfdf Initial 1

[O] #501 Commit B (gh/ezyang/2/head -> gh/ezyang/2/base)

Expand All @@ -67,24 +67,28 @@ else:

This is commit B

* 976c018 Update B
* f30ebce Initial 2
* c11f047 Update B
* cfc0530 Initial 2

Repository state:

* 976c018 (gh/ezyang/2/head)
* c11f047 (gh/ezyang/2/head)
|\\ Update B
| * e3a6e9d (gh/ezyang/2/base)
| * 7c6b228 (gh/ezyang/2/base)
| | Update B (base update)
* | f30ebce
* | cfc0530
|/ Initial 2
* 94673ed
Initial 2 (base update)
* 23930b1 (gh/ezyang/1/head)
| Update A
* 36498d0
| Initial 1
* 3e4048c (gh/ezyang/1/base)
Initial 1 (base update)
* bf457db
| Initial 2 (base update)
* 8b023bd
| Commit A
| * 414cdf2 (gh/ezyang/1/head)
| | Update A
| * 36fcfdf
| | Initial 1
| * 5a32949 (gh/ezyang/1/base)
|/ Initial 1 (base update)
* dc8bfe4 (HEAD -> master)
Initial commit
""",
)
10 changes: 6 additions & 4 deletions test/submit/amend_message_only.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ else:

This is commit AAA

* 6f7501b Initial 1
* 1081a5b Initial 1

Repository state:

* 6f7501b (gh/ezyang/1/head)
* 1081a5b (gh/ezyang/1/head)
| Initial 1
* 3e4048c (gh/ezyang/1/base)
Initial 1 (base update)
* 5a32949 (gh/ezyang/1/base)
| Initial 1 (base update)
* dc8bfe4 (HEAD -> master)
Initial commit
""",
)

Expand Down
26 changes: 15 additions & 11 deletions test/submit/amend_top.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ else:

This is commit A

* 36498d0 Initial 1
* 36fcfdf Initial 1

[O] #501 Commit B (gh/ezyang/2/head -> gh/ezyang/2/base)

Expand All @@ -60,20 +60,24 @@ else:

This is commit B

* 339d734 Update A
* f30ebce Initial 2
* 9a4a9ae Update A
* cfc0530 Initial 2

Repository state:

* 339d734 (gh/ezyang/2/head)
* 9a4a9ae (gh/ezyang/2/head)
| Update A
* f30ebce
* cfc0530
| Initial 2
* 94673ed (gh/ezyang/2/base)
Initial 2 (base update)
* 36498d0 (gh/ezyang/1/head)
| Initial 1
* 3e4048c (gh/ezyang/1/base)
Initial 1 (base update)
* bf457db (gh/ezyang/2/base)
| Initial 2 (base update)
* 8b023bd
| Commit A
| * 36fcfdf (gh/ezyang/1/head)
| | Initial 1
| * 5a32949 (gh/ezyang/1/base)
|/ Initial 1 (base update)
* dc8bfe4 (HEAD -> master)
Initial commit
""",
)
10 changes: 6 additions & 4 deletions test/submit/bullet_divider.py.test
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ else:
* It starts with a fabulous
* Bullet list

* 6ee2f33 Initial
* 7e90855 Initial

Repository state:

* 6ee2f33 (gh/ezyang/1/head)
* 7e90855 (gh/ezyang/1/head)
| Initial
* 4e54cdd (gh/ezyang/1/base)
Initial (base update)
* 11e6d4d (gh/ezyang/1/base)
| Initial (base update)
* dc8bfe4 (HEAD -> master)
Initial commit
"""
)

Expand Down
Loading
Loading