forked from ezyang/ghstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinvalid_resubmit.py.test
More file actions
68 lines (50 loc) · 1.62 KB
/
invalid_resubmit.py.test
File metadata and controls
68 lines (50 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from ghstack.test_prelude import *
init_test()
commit("A")
(diff,) = gh_submit("Initial")
assert diff is not None
pr_url = diff.pr_url
gh_land(pr_url)
write_file_and_add("file2.txt", "A")
git("commit", "--amend", "--no-edit")
assert_expected_raises_inline(
RuntimeError,
lambda: gh_submit("Update"),
"""Cannot ghstack a stack with closed PR #500 whose branch was deleted. If you were just trying to update a later PR in the stack, `git rebase` and try again. Otherwise, you may have been trying to update a PR that was already closed. To disassociate your update from the old PR and open a new PR, run `ghstack unlink`, `git rebase` and then try again.""",
)
# Do the remediation
gh_unlink()
git("rebase", "origin/master")
gh_submit("New PR")
if is_direct():
assert_github_state("""""")
else:
assert_github_state(
"""\
[X] #500 Commit A (gh/ezyang/1/head -> gh/ezyang/1/base)
Stack:
* __->__ #500
This is commit A
(omitted)
[O] #501 Commit A (gh/ezyang/1/head -> gh/ezyang/1/base)
Stack:
* __->__ #501
This is commit A
* 98fcb03 New PR
Repository state:
* 98fcb03 (gh/ezyang/1/head)
| New PR
* 0d09e7d (gh/ezyang/1/base)
| New PR (base update)
* 8927014 (HEAD -> master)
| Commit A
* dc8bfe4
Initial commit
"""
)
ok()
# only the amend shows up now
assert_expected_inline(
git("show", "--pretty=", "--name-only", "origin/gh/ezyang/1/orig"),
"""file2.txt""",
)