-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathupdate_after_land.py.test
More file actions
80 lines (61 loc) · 1.91 KB
/
Copy pathupdate_after_land.py.test
File metadata and controls
80 lines (61 loc) · 1.91 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
69
70
71
72
73
74
75
76
77
78
79
80
from ghstack.test_prelude import *
init_test()
commit("A")
commit("B")
(diff1, diff2) = gh_submit("Initial 1")
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")
commit("U")
git("push")
# land first pr
gh_land(diff1.pr_url)
# go back to stack
git("checkout", "gh/ezyang/2/orig")
# update second pr
amend("B2")
# try to push
assert_expected_raises_inline(
RuntimeError,
lambda: gh_submit("Run 2"),
"""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.""",
)
# show the remediation works
git("rebase", "origin/master")
gh_submit("Run 3")
if is_direct():
assert_github_state("""""")
else:
assert_github_state(
"""\
[X] #500 Commit A (gh/ezyang/1/head -> gh/ezyang/1/base)
Stack:
* #501
* __->__ #500
This is commit A
(omitted)
[O] #501 Commit B (gh/ezyang/2/head -> gh/ezyang/2/base)
Stack:
* __->__ #501
This is commit B
* ba208a5 Run 3
* 16e1e12 Initial 1
Repository state:
* ba208a5 (gh/ezyang/2/head)
|\\ Run 3
| * 0d1bf0c (gh/ezyang/2/base)
| |\\ Run 3 (base update)
| | * ae7fbca (HEAD -> master)
| | | Commit A (#500)
| | * 7f0288c
| | | Commit U
* | | 16e1e12
|/ / Initial 1
* / 9d4a439
|/ Initial 1 (base update)
* dc8bfe4
Initial commit
"""
)
ok()