@@ -32,9 +32,7 @@ import re
32
32
import subprocess
33
33
import sys
34
34
35
- usage = (
36
- "git clang-format [OPTIONS] [<commit>] [<commit>|--staged] [--] [<file>...]"
37
- )
35
+ usage = "git clang-format [OPTIONS] [<commit>] [<commit>|--staged] [--] [<file>...]"
38
36
39
37
desc = """
40
38
If zero or one commits are given, run clang-format on all lines that differ
@@ -236,10 +234,7 @@ def main():
236
234
if not opts .diff :
237
235
die ("--diff is required when two commits are given" )
238
236
elif opts .diff_from_common_commit :
239
- die (
240
- "--diff_from_common_commit is only allowed when two commits are "
241
- "given"
242
- )
237
+ die ("--diff_from_common_commit is only allowed when two commits are given" )
243
238
244
239
if os .path .dirname (opts .binary ):
245
240
opts .binary = os .path .abspath (opts .binary )
@@ -385,10 +380,7 @@ def disambiguate_revision(value):
385
380
return False
386
381
if object_type in ("commit" , "tag" ):
387
382
return True
388
- die (
389
- "`%s` is a %s, but a commit or filename was expected"
390
- % (value , object_type )
391
- )
383
+ die ("`%s` is a %s, but a commit or filename was expected" % (value , object_type ))
392
384
393
385
394
386
def get_object_type (value ):
@@ -463,9 +455,7 @@ def extract_lines(patch_file):
463
455
line_count = 1
464
456
if start_line == 0 :
465
457
continue
466
- matches .setdefault (filename , []).append (
467
- Range (start_line , line_count )
468
- )
458
+ matches .setdefault (filename , []).append (Range (start_line , line_count ))
469
459
return matches
470
460
471
461
@@ -780,13 +770,10 @@ def apply_changes(old_tree, new_tree, force=False, patch_mode=False):
780
770
.split ("\0 " )
781
771
)
782
772
if not force :
783
- unstaged_files = run (
784
- "git" , "diff-files" , "--name-status" , * changed_files
785
- )
773
+ unstaged_files = run ("git" , "diff-files" , "--name-status" , * changed_files )
786
774
if unstaged_files :
787
775
print (
788
- "The following files would be modified but have unstaged "
789
- "changes:" ,
776
+ "The following files would be modified but have unstaged changes:" ,
790
777
file = sys .stderr ,
791
778
)
792
779
print (unstaged_files , file = sys .stderr )
@@ -828,17 +815,13 @@ def run(*args, **kwargs):
828
815
if p .returncode == 0 :
829
816
if stderr :
830
817
if verbose :
831
- print (
832
- "`%s` printed to stderr:" % " " .join (args ), file = sys .stderr
833
- )
818
+ print ("`%s` printed to stderr:" % " " .join (args ), file = sys .stderr )
834
819
print (stderr .rstrip (), file = sys .stderr )
835
820
if strip :
836
821
stdout = stdout .rstrip ("\r \n " )
837
822
return stdout
838
823
if verbose :
839
- print (
840
- "`%s` returned %s" % (" " .join (args ), p .returncode ), file = sys .stderr
841
- )
824
+ print ("`%s` returned %s" % (" " .join (args ), p .returncode ), file = sys .stderr )
842
825
if stderr :
843
826
print (stderr .rstrip (), file = sys .stderr )
844
827
sys .exit (2 )
0 commit comments