]> git.wh0rd.org - home.git/blobdiff - .bin/git-rb-catchup
gentoo-sync: remove duplicate date calls
[home.git] / .bin / git-rb-catchup
index 66b87a829ac2b61397f216d9be4c845d7dc6843d..5cfdfc877e31c03ff53ebfdeb165afb55178f3af 100755 (executable)
@@ -13,6 +13,8 @@ into smaller pieces, and be able to run tests to make sure things were still OK.
 """
 
 import argparse
+import os
+from pathlib import Path
 import subprocess
 import sys
 from typing import List, Tuple, Union
@@ -84,12 +86,13 @@ def rebase_bisect(lbranch: str,
 
     if pmin or pmax:
         last_target = f'{rbranch}~{first_fail}'
+        result = git(['log', '-1', '--format=%s', last_target])
+        subject = result.stdout.strip()
         if leave_rebase:
             print('Restarting', last_target)
             result = git(['rebase', last_target], check=False)
             print(result.stdout.strip())
-        else:
-            print('Found first failure', last_target)
+        print(f'* Found first failure {last_target}: {subject}')
     else:
         print('All caught up!')
 
@@ -150,7 +153,10 @@ def main(argv: List[str]) -> int:
     parser = get_parser()
     opts = parser.parse_args(argv)
 
-    lbranch = get_local_branch()
+    try:
+        lbranch = get_local_branch()
+    except subprocess.CalledProcessError as e:
+        sys.exit(f'{os.path.basename(sys.argv[0])}: {Path.cwd()}:\n{e}\n{e.stderr.strip()}')
     print(f'Local branch resolved to "{lbranch}".')
     if not lbranch:
         print('Unable to resolve local branch', file=sys.stderr)