5757
5858verbose = False
5959yes = False
60+ allow_dirty = False
6061
6162ur_default_dir = os .path .abspath (os .path .join (os .path .dirname (__file__ ), ".." ))
6263unified_runtime_slug = "oneapi-src/unified-runtime"
6364intel_llvm_slug = "intel/llvm"
6465
6566
6667def main ():
67- global verbose , yes
68+ global verbose , yes , allow_dirty
6869
6970 cli = argparse .ArgumentParser (
7071 description = __doc__ , formatter_class = argparse .RawTextHelpFormatter
@@ -111,14 +112,20 @@ def main():
111112 )
112113 cli .add_argument (
113114 "--intel-llvm-base-branch" ,
114- default = None ,
115+ default = "sycl" ,
115116 help = "intel/llvm branch to base new branch upon, defaults to 'sycl'" ,
116117 )
117118 cli .add_argument (
118119 "--intel-llvm-feature-branch" ,
119120 default = None ,
120121 help = "intel/llvm remote branch to create, defaults to --ur-branch" ,
121122 )
123+ cli .add_argument (
124+ "--allow-dirty" ,
125+ default = False ,
126+ action = "store_true" ,
127+ help = "Skip checks for a clean workspace. Please check any generated patch files before applying" ,
128+ )
122129 args = cli .parse_args ()
123130
124131 if platform .system () != "Linux" :
@@ -127,6 +134,7 @@ def main():
127134
128135 verbose = args .verbose
129136 yes = args .yes
137+ allow_dirty = args .allow_dirty
130138
131139 git = get_git_executable ()
132140 gh = get_gh_executable ()
@@ -173,7 +181,7 @@ def main():
173181 locally
174182 and remotely
175183 and not confirm (
176- f"Feature branch '{ args .intel_llvm_feature_branch } ' exists "
184+ f"LLVM feature branch '{ args .intel_llvm_feature_branch } ' exists "
177185 "locally and remotely, proceed with applying patches on top "
178186 "of this branch?"
179187 )
@@ -182,7 +190,7 @@ def main():
182190 not locally
183191 and remotely
184192 and not confirm (
185- f"Feature branch '{ args .intel_llvm_feature_branch } ' exists "
193+ f"LLVM feature branch '{ args .intel_llvm_feature_branch } ' exists "
186194 "remotely but not locally, proceed with applying patches on "
187195 "top of this branch?"
188196 )
@@ -191,7 +199,7 @@ def main():
191199 locally
192200 and not remotely
193201 and not confirm (
194- f"Feature branch '{ args .intel_llvm_feature_branch } ' exists "
202+ f"LLVM feature branch '{ args .intel_llvm_feature_branch } ' exists "
195203 "locally but not remotely, proceed with applying patches on "
196204 "top of this branch?"
197205 )
@@ -230,14 +238,14 @@ def main():
230238 os .remove (patch )
231239
232240 if not confirm (
233- f"Push '{ args .intel_llvm_feature_branch } ' to '{ args .intel_llvm_remote } '?"
241+ f"Push '{ args .intel_llvm_feature_branch } ' to '{ args .intel_llvm_push_remote } '?"
234242 ):
235243 print ("Please push the changes and create your pull request manually." )
236244 exit (0 )
237245 push_branch (
238246 git ,
239247 args .intel_llvm_dir ,
240- args .intel_llvm_remote ,
248+ args .intel_llvm_push_remote ,
241249 args .intel_llvm_feature_branch ,
242250 )
243251
@@ -260,7 +268,7 @@ def main():
260268 if not confirm (f"Close { ur_pr ['url' ]} ?" ):
261269 print ("Please create your pull request manually." )
262270 exit ()
263- close_pull_request (gh , args .ur_dir , unified_runtime_slug , ur_pr ["number" ])
271+ close_pull_request (gh , args .ur_dir , unified_runtime_slug , str ( ur_pr ["number" ]) )
264272
265273
266274def get_git_executable () -> str :
@@ -319,6 +327,8 @@ def get_current_branch(git, dir) -> str:
319327
320328
321329def check_worktree_is_clean (git , dir ):
330+ if allow_dirty :
331+ return
322332 result = run ([git , "-C" , dir , "status" , "--porcelain" ], stdout = PIPE )
323333 stdout = result .stdout .decode ()
324334 if verbose :
0 commit comments