[llvm] r369544 - git-llvm: Make push --force suppress error on nothing to commit as well

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 09:03:35 PDT 2019


Author: nico
Date: Wed Aug 21 09:03:34 2019
New Revision: 369544

URL: http://llvm.org/viewvc/llvm-project?rev=369544&view=rev
Log:
git-llvm: Make push --force suppress error on nothing to commit as well

Modified:
    llvm/trunk/utils/git-svn/git-llvm

Modified: llvm/trunk/utils/git-svn/git-llvm
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/git-svn/git-llvm?rev=369544&r1=369543&r2=369544&view=diff
==============================================================================
--- llvm/trunk/utils/git-svn/git-llvm (original)
+++ llvm/trunk/utils/git-svn/git-llvm Wed Aug 21 09:03:34 2019
@@ -209,11 +209,8 @@ def get_revs_to_push(rev_range):
     # Use git show rather than some plumbing command to figure out which revs
     # are in rev_range because it handles single revs (HEAD^) and ranges
     # (foo..bar) like we want.
-    revs = git('show', '--reverse', '--quiet',
+    return git('show', '--reverse', '--quiet',
                '--pretty=%h', rev_range).splitlines()
-    if not revs:
-        die('Nothing to push: No revs in range %s.' % rev_range)
-    return revs
 
 
 def clean_svn(svn_repo):
@@ -462,6 +459,10 @@ def cmd_push(args):
     rev_range = args.rev_range
     dry_run = args.dry_run
     revs = get_revs_to_push(rev_range)
+
+    if not args.force and not revs:
+        die('Nothing to push: No revs in range %s.' % rev_range)
+
     log('%sPushing %d %s commit%s:\n%s' %
         ('[DryRun] ' if dry_run else '', len(revs),
          'split-repo (%s)' % split_repo_path
@@ -471,7 +472,7 @@ def cmd_push(args):
                    for c in revs)))
 
     # Ask confirmation if multiple commits are about to be pushed
-    if not args.force and len(revs) != 1:
+    if not args.force and len(revs) > 1:
         if not ask_confirm("Are you sure you want to create %d commits?" % len(revs)):
             die("Aborting")
 




More information about the llvm-commits mailing list