You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
print(f"For our already-reviewed base branch, using `{MERGED_MASTER_REVIEWED}`. Starting from there:")
245
+
print(f"For our already-reviewed base branch, using `{MERGED_MASTER_REVIEWED}`. If this fails, create / check out that branch locally from upstream's copy. Starting from there:")
201
246
202
247
bitcoin_commits=get_bitcoin_commits()
203
248
print(f"Found a total of {len(bitcoin_commits)} Bitcoin Core commits to review (on `{BITCOIN_MASTER}`).")
@@ -227,24 +272,27 @@ def main() -> None:
227
272
sys.exit(1)
228
273
print()
229
274
230
-
SKIP_CLEAN=False
275
+
SKIP_CLEAN=True
231
276
232
277
forcommitinmerged_commits:
233
278
REQUIRE_MANUAL_REVIEW=False
234
279
# Figure out what incoming/upstream commit this is merging, from which side.
235
280
incoming_commit: Dict[str, Any] = {}
236
-
ifcommit["chain"]=="Bitcoin":
281
+
ifcommit.get("chain", None)=="Bitcoin":
237
282
incoming_commit=bitcoin_commits.pop(0)
238
-
elifcommit["chain"]=="Elements":
283
+
elifcommit.get("chain", None)=="Elements":
239
284
incoming_commit=elements_commits.pop(0)
240
-
elifcommit["fromsecp"]:
285
+
elifcommit.get("fromsecp", False):
241
286
incoming_commit= {"cid": commit["merged_cid"]}
242
287
print()
243
288
print("WARNING: The next commit claims to merge a libsecp256k1 commit. We have no way to verify where it came from.")
244
289
print()
245
290
REQUIRE_MANUAL_REVIEW=True
246
291
else:
247
-
raiseException(f"This is neither a Bitcoin nor an Elements merge; I don't know what to do with it. Details: {commit}")
292
+
# TODO: A bunch of stuff doesn't really work right in this mode. Fix the UI so it makes sense.
293
+
incoming_commit=None
294
+
print(f"WARNING: This is neither a Bitcoin nor an Elements merge; I don't know what to do with it. Details: {commit}")
os.system(f"git -C {WQ} diff --color=always --color-moved=dimmed_zebra --ignore-space-change --histogram HEAD {cid}")
286
-
else:
287
-
print("** No diff, merge was clean!")
338
+
diff4()
288
339
289
-
print()
290
-
said=prompt_chars("Accept this commit? (If unsure, say 'N', which will exit the review script.) Or [r]edisplay commit, or [a]utoskip clean diffs?", "ynra")
print(f"The current commit (in `{WORKTREE_LOCATION}`) is the conflicted diff as git produced it. The command we used to diff it against the actual merge was:")
print("Look over the commits however you like, or contact someone for assistance. If you are satisfied that the diff is okay, run the review script again.")
303
-
sys.exit(1)
304
-
305
-
ifprompt_chars("Locally mark all commits up to and including this commit as reviewed, so we skip them in the future?", "yn") =="y":
print(f"Done. (Updated local branch `{MERGED_MASTER_REVIEWED}` in `{WORKTREE_LOCATION}`. ** You will need to push this branch to gitlab if you want to persist this. **)")
340
+
said=""
341
+
ifincoming_commitisnotNone:
342
+
whilesaid!="y":
343
+
said=prompt_chars("Accept this commit? (If unsure, say 'N', which will exit the review script.) Or show a [d]iff, [r]edisplay commit, or [a]utoskip clean diffs [toggle]?", "yndra")
print(" - 4way: shows a very confusing diff between (1) the conflicted merge git would have made, left to its own devices, and (2) the resolved merge in the actual merged history.")
374
+
print(" - orig-commits: shows the commits from the original (upstream) PR, using `git show`.")
375
+
print(" - merged-commits: shows the commits of the PR as merged into the actual merged history, using `git show`. This will normally be the same commits as upstream, plus a merge commit resolving the merge conflicts, which is shown in a confusing format as described under `COMBINED DIFF FORMAT` in `man git-diff`.")
376
+
print(" - merged-flattened: shows a single flattened diff of the entire PR as applied in the actual merged history.")
377
+
# XXX: It would be nice to have a mode showing merged-flattened and orig-flattened (which I maybe could add) side-by-side.
378
+
print()
379
+
380
+
elifsaid=="n":
381
+
break
382
+
else: # incoming_commit is None
383
+
os.system(f"git -C {WQ} show {GIT_DIFF_OPTS}{cid}")
384
+
whilesaid!="y":
385
+
said=prompt_chars("Accept this commit? (If unsure, say 'N', which will exit the review script.) Or [r]edisplay commit and diff?", "ynr")
os.system(f"git -C {WQ} show {GIT_DIFF_OPTS}{cid}")
393
+
elifsaid=="n":
394
+
break
395
+
396
+
ifsaid=="n":
397
+
print(f"The current commit (in `{WORKTREE_LOCATION}`) is the conflicted diff as git produced it. The command we used to diff it against the actual merge was:")
398
+
print(f"git -C {WQ} diff {GIT_DIFF_OPTS} HEAD {cid}")
399
+
print("Look over the commits however you like, or contact someone for assistance. If you are satisfied that the diff is okay, run the review script again.")
print(f"Done. (Updated local branch `{MERGED_MASTER_REVIEWED}` in `{WORKTREE_LOCATION}`. ** You will need to push this branch to gitlab if you want to persist this. **)")
0 commit comments