Skip to content

Commit abc61e9

Browse files
committed
revert changes to make changelog pr
1 parent 6e5b438 commit abc61e9

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

jupyter_releaser/lib.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,15 @@ def make_changelog_pr(auth, branch, repo, title, commit_message, body, dry_run=F
163163

164164
# Make a new branch with a uuid suffix
165165
pr_branch = f"changelog-{uuid.uuid1().hex}"
166-
util.run(f"{util.GIT_FETCH_CMD} {branch}", echo=True)
167-
dirty = False
168-
try:
169-
util.run("git stash", echo=True)
170-
dirty = True
171-
except Exception:
172-
pass
173-
util.run(f"git checkout -b {pr_branch} origin/{branch}", echo=True)
174-
if dirty:
175-
if dry_run:
176-
util.run("git merge --squash --strategy-option=theirs stash", echo=True)
177-
else:
178-
util.run("git stash apply", echo=True)
166+
167+
if not dry_run:
168+
dirty = util.run("git --no-pager diff --stat") != ""
169+
if dirty:
170+
util.run("git stash")
171+
util.run(f"{util.GIT_FETCH_CMD} {branch}")
172+
util.run(f"git checkout -b {pr_branch} origin/{branch}")
173+
if dirty:
174+
util.run("git stash apply")
179175

180176
# Add a commit with the message
181177
try:
@@ -192,8 +188,8 @@ def make_changelog_pr(auth, branch, repo, title, commit_message, body, dry_run=F
192188
head = pr_branch
193189
maintainer_can_modify = True
194190

195-
remote_name = util.get_remote_name(dry_run)
196-
util.run(f"git push {remote_name} {pr_branch}", echo=True)
191+
if not dry_run:
192+
util.run(f"git push origin {pr_branch}", echo=True)
197193

198194
# title, head, base, body, maintainer_can_modify, draft, issue
199195
pull = gh.pulls.create(title, head, base, body, maintainer_can_modify, False, None)

0 commit comments

Comments
 (0)