Skip to content

Commit 2fdbba3

Browse files
zzl0facebook-github-bot
authored andcommitted
ghstack: fix stdout check in sapling_land
Summary: Current behavior: ``` File "/Users/zhaolong/fbsource/fbcode/eden/scm/ghstack/sapling_land.py", line 88, in main rebase_base = mappings[s.oid][0] KeyError: '4cf7c5a37180fd76afac15397ecfa1719fdc0d7b' ``` Reviewed By: bolinfest Differential Revision: D41140977 fbshipit-source-id: fc2bcd5e5209422b7ab8747eed5b4b4278367a71
1 parent c9e5203 commit 2fdbba3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

eden/scm/ghstack/sapling_land.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,12 @@ def main(pull_request: str,
7575
rebase_base = default_branch_oid
7676
for s in stack:
7777
stdout = sh.run_sapling_command("rebase", "--keep", "-s", s.oid, "-d", rebase_base, "-q", "-T", "{nodechanges|json}")
78-
# If there is no output, it appears that '""' is returned as opposed
79-
# to '{}', which is a little weird...
80-
if not stdout or stdout == '""':
78+
mappings = json.loads(stdout) if stdout else None
79+
if not mappings:
8180
# If there was no stdout, then s.oid was not rebased because
8281
# its parent is already the existing `rebase_base`.
8382
rebase_base = s.oid
8483
else:
85-
mappings = json.loads(stdout)
8684
rebase_base = mappings[s.oid][0]
8785

8886
# Advance base to head to "close" the PR for all PRs.

0 commit comments

Comments
 (0)