57
57
58
58
verbose = False
59
59
yes = False
60
+ allow_dirty = False
60
61
61
62
ur_default_dir = os .path .abspath (os .path .join (os .path .dirname (__file__ ), ".." ))
62
63
unified_runtime_slug = "oneapi-src/unified-runtime"
63
64
intel_llvm_slug = "intel/llvm"
64
65
65
66
66
67
def main ():
67
- global verbose , yes
68
+ global verbose , yes , allow_dirty
68
69
69
70
cli = argparse .ArgumentParser (
70
71
description = __doc__ , formatter_class = argparse .RawTextHelpFormatter
@@ -111,14 +112,20 @@ def main():
111
112
)
112
113
cli .add_argument (
113
114
"--intel-llvm-base-branch" ,
114
- default = None ,
115
+ default = "sycl" ,
115
116
help = "intel/llvm branch to base new branch upon, defaults to 'sycl'" ,
116
117
)
117
118
cli .add_argument (
118
119
"--intel-llvm-feature-branch" ,
119
120
default = None ,
120
121
help = "intel/llvm remote branch to create, defaults to --ur-branch" ,
121
122
)
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
+ )
122
129
args = cli .parse_args ()
123
130
124
131
if platform .system () != "Linux" :
@@ -127,6 +134,7 @@ def main():
127
134
128
135
verbose = args .verbose
129
136
yes = args .yes
137
+ allow_dirty = args .allow_dirty
130
138
131
139
git = get_git_executable ()
132
140
gh = get_gh_executable ()
@@ -173,7 +181,7 @@ def main():
173
181
locally
174
182
and remotely
175
183
and not confirm (
176
- f"Feature branch '{ args .intel_llvm_feature_branch } ' exists "
184
+ f"LLVM feature branch '{ args .intel_llvm_feature_branch } ' exists "
177
185
"locally and remotely, proceed with applying patches on top "
178
186
"of this branch?"
179
187
)
@@ -182,7 +190,7 @@ def main():
182
190
not locally
183
191
and remotely
184
192
and not confirm (
185
- f"Feature branch '{ args .intel_llvm_feature_branch } ' exists "
193
+ f"LLVM feature branch '{ args .intel_llvm_feature_branch } ' exists "
186
194
"remotely but not locally, proceed with applying patches on "
187
195
"top of this branch?"
188
196
)
@@ -191,7 +199,7 @@ def main():
191
199
locally
192
200
and not remotely
193
201
and not confirm (
194
- f"Feature branch '{ args .intel_llvm_feature_branch } ' exists "
202
+ f"LLVM feature branch '{ args .intel_llvm_feature_branch } ' exists "
195
203
"locally but not remotely, proceed with applying patches on "
196
204
"top of this branch?"
197
205
)
@@ -230,14 +238,14 @@ def main():
230
238
os .remove (patch )
231
239
232
240
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 } '?"
234
242
):
235
243
print ("Please push the changes and create your pull request manually." )
236
244
exit (0 )
237
245
push_branch (
238
246
git ,
239
247
args .intel_llvm_dir ,
240
- args .intel_llvm_remote ,
248
+ args .intel_llvm_push_remote ,
241
249
args .intel_llvm_feature_branch ,
242
250
)
243
251
@@ -260,7 +268,7 @@ def main():
260
268
if not confirm (f"Close { ur_pr ['url' ]} ?" ):
261
269
print ("Please create your pull request manually." )
262
270
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" ]) )
264
272
265
273
266
274
def get_git_executable () -> str :
@@ -319,6 +327,8 @@ def get_current_branch(git, dir) -> str:
319
327
320
328
321
329
def check_worktree_is_clean (git , dir ):
330
+ if allow_dirty :
331
+ return
322
332
result = run ([git , "-C" , dir , "status" , "--porcelain" ], stdout = PIPE )
323
333
stdout = result .stdout .decode ()
324
334
if verbose :
0 commit comments