@@ -11,7 +11,11 @@ import re
11
11
import typing
12
12
import os
13
13
14
- EXCLUDES_PATH = os .path .join (os .path .expanduser ("~" ), '.excludes_show_eligible' )
14
+ EXCLUDES_PATHS = [
15
+ os .path .join (os .path .expanduser ("~" ), '.excludes_show_eligible' ),
16
+ os .path .join (os .path .expanduser ("~" ), '.excludes_show_eligible_manuals' ),
17
+ ]
18
+
15
19
16
20
def find_toplevel ():
17
21
try :
@@ -22,6 +26,7 @@ def find_toplevel():
22
26
except subprocess .CalledProcessError :
23
27
return None
24
28
29
+
25
30
def find_unpicked (repo , from_commit , to_commit , since_commit , show_all ):
26
31
base_id = repo .merge_base (from_commit .id , to_commit .id )
27
32
@@ -55,21 +60,27 @@ def find_unpicked(repo, from_commit, to_commit, since_commit, show_all):
55
60
if since_commit and commit .id == since_commit .id :
56
61
break
57
62
63
+
58
64
def read_excludes () -> typing .List [str ]:
59
- if not os .path .isfile (EXCLUDES_PATH ):
60
- return []
61
- with open (EXCLUDES_PATH , 'r' ) as f :
62
- return f .read ().splitlines ()
65
+ excludes = []
66
+ for file in EXCLUDES_PATHS :
67
+ if not os .path .isfile (file ):
68
+ continue
69
+ with open (file , 'r' ) as f :
70
+ excludes .extend (f .read ().splitlines ())
71
+ return excludes
72
+
63
73
64
74
def add_exclude_hash (excludes : typing .List [str ], commit : str ) -> None :
65
75
if commit in excludes :
66
- print (f'Commit { commit } already in the exclude list ({ EXCLUDES_PATH } ).' )
76
+ print (f'Commit { commit } already in some exclude list ({ EXCLUDES_PATHS } ).' )
67
77
sys .exit (1 )
68
- with open (EXCLUDES_PATH , 'at' ) as f :
78
+ with open (EXCLUDES_PATHS [ 0 ] , 'at' ) as f :
69
79
f .write (commit + '\n ' )
70
- print (f'Hash { commit } added successfully.' )
80
+ print (f'Hash { commit } added successfully to { EXCLUDES_PATHS [ 0 ] } .' )
71
81
exit (0 )
72
82
83
+
73
84
def main ():
74
85
parser = argparse .ArgumentParser (description = 'Show commits, eligible for cherry-picking' )
75
86
parser .add_argument ('branch' , metavar = 'BRANCH' , help = 'Name for the branch to check against' ,
@@ -79,7 +90,7 @@ def main():
79
90
parser .add_argument ('--since' , metavar = 'COMMIT' , help = 'Start checking since specified commit' )
80
91
parser .add_argument ('--all' , action = 'store_true' , help = 'Show commits from all users' )
81
92
parser .add_argument ('--add-to-exclude-list' , metavar = 'COMMIT' , help = 'Add a merge commit hash so it, '
82
- f'and its children, no longer are displayed in the output. This is saved in "{ EXCLUDES_PATH } ".' )
93
+ f'and its children, no longer are displayed in the output. This is saved in "{ EXCLUDES_PATHS [ 0 ] } ".' )
83
94
84
95
top = find_toplevel ()
85
96
excludes = read_excludes ()
@@ -167,4 +178,4 @@ def main():
167
178
168
179
169
180
if __name__ == '__main__' :
170
- main ()
181
+ main ()
0 commit comments