@@ -11,7 +11,10 @@ import re
1111import typing
1212import os
1313
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+ ]
1518
1619def find_toplevel ():
1720 try :
@@ -22,6 +25,7 @@ def find_toplevel():
2225 except subprocess .CalledProcessError :
2326 return None
2427
28+
2529def find_unpicked (repo , from_commit , to_commit , since_commit , show_all ):
2630 base_id = repo .merge_base (from_commit .id , to_commit .id )
2731
@@ -55,21 +59,27 @@ def find_unpicked(repo, from_commit, to_commit, since_commit, show_all):
5559 if since_commit and commit .id == since_commit .id :
5660 break
5761
62+
5863def 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 ()
64+ excludes = []
65+ for file in EXCLUDES_PATHS :
66+ if not os .path .isfile (file ):
67+ continue
68+ with open (file , 'r' ) as f :
69+ excludes .extend (f .read ().splitlines ())
70+ return excludes
71+
6372
6473def add_exclude_hash (excludes : typing .List [str ], commit : str ) -> None :
6574 if commit in excludes :
66- print (f'Commit { commit } already in the exclude list ({ EXCLUDES_PATH } ).' )
75+ print (f'Commit { commit } already in some exclude list ({ EXCLUDES_PATHS } ).' )
6776 sys .exit (1 )
68- with open (EXCLUDES_PATH , 'at' ) as f :
77+ with open (EXCLUDES_PATHS [ 0 ] , 'at' ) as f :
6978 f .write (commit + '\n ' )
70- print (f'Hash { commit } added successfully.' )
79+ print (f'Hash { commit } added successfully to { EXCLUDES_PATHS [ 0 ] } .' )
7180 exit (0 )
7281
82+
7383def main ():
7484 parser = argparse .ArgumentParser (description = 'Show commits, eligible for cherry-picking' )
7585 parser .add_argument ('branch' , metavar = 'BRANCH' , help = 'Name for the branch to check against' ,
@@ -79,7 +89,7 @@ def main():
7989 parser .add_argument ('--since' , metavar = 'COMMIT' , help = 'Start checking since specified commit' )
8090 parser .add_argument ('--all' , action = 'store_true' , help = 'Show commits from all users' )
8191 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 } ".' )
92+ f'and its children, no longer are displayed in the output. This is saved in "{ EXCLUDES_PATHS [ 0 ] } ".' )
8393
8494 top = find_toplevel ()
8595 excludes = read_excludes ()
@@ -167,4 +177,4 @@ def main():
167177
168178
169179if __name__ == '__main__' :
170- main ()
180+ main ()
0 commit comments