[llvm] a4b56d7 - [Utils] Add URL formatting for revert_checker

George Burgess IV via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 30 17:31:02 PDT 2022


Author: Jordan R Abrahams-Whitehead
Date: 2022-03-30T17:30:25-07:00
New Revision: a4b56d762097008d7449770333adb0b84d66dbdc

URL: https://github.com/llvm/llvm-project/commit/a4b56d762097008d7449770333adb0b84d66dbdc
DIFF: https://github.com/llvm/llvm-project/commit/a4b56d762097008d7449770333adb0b84d66dbdc.diff

LOG: [Utils] Add URL formatting for revert_checker

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.

Differential Revision: https://reviews.llvm.org/D122772

Added: 
    

Modified: 
    llvm/utils/revert_checker.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/revert_checker.py b/llvm/utils/revert_checker.py
index deb49412b1ec3..ef0c06bd1b5a4 100755
--- a/llvm/utils/revert_checker.py
+++ b/llvm/utils/revert_checker.py
@@ -237,6 +237,9 @@ def _main() -> None:
   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 @@ def _main() -> None:
         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__':


        


More information about the llvm-commits mailing list