[PATCH] D122772: [Utils] Add URL formatting for revert_checker

Jordan R AW via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 30 17:06:48 PDT 2022


CrystalSplitter created this revision.
CrystalSplitter added a reviewer: gbiv.
CrystalSplitter added a project: LLVM.
Herald added a reviewer: george.burgess.iv.
Herald added a project: All.
CrystalSplitter requested review of this revision.
Herald added a subscriber: llvm-commits.

This lets the revert_checker.py get called with the `-u` option, which formats the revert and reverted SHAs into handy URLs which point to the LLVM reviews associated with those SHAs.
This is useful for viewers to look quickly at the changes made by SHAs that were potentially reverted.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122772

Files:
  llvm/utils/revert_checker.py


Index: llvm/utils/revert_checker.py
===================================================================
--- llvm/utils/revert_checker.py
+++ llvm/utils/revert_checker.py
@@ -237,6 +237,9 @@
   parser.add_argument(
       'root', nargs='+', help='Root(s) to search for commits from.')
   parser.add_argument('--debug', action='store_true')
+  parser.add_argument(
+      '-u', '--review_url', action='store_true',
+      help='Format SHAs as llvm review URLs')
   opts = parser.parse_args()
 
   logging.basicConfig(
@@ -257,7 +260,11 @@
         all_reverts.append(revert)
 
   for revert in all_reverts:
-    print(f'{revert.sha} claims to revert {revert.reverted_sha}')
+    sha_fmt = (f'https://reviews.llvm.org/rG{revert.sha}'
+               if opts.review_url else revert.sha)
+    reverted_sha_fmt = (f'https://reviews.llvm.org/rG{revert.reverted_sha}'
+                        if opts.review_url else revert.reverted_sha)
+    print(f'{sha_fmt} claims to revert {reverted_sha_fmt}')
 
 
 if __name__ == '__main__':


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122772.419292.patch
Type: text/x-patch
Size: 1023 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220331/a784bb77/attachment.bin>


More information about the llvm-commits mailing list