@@ -148,7 +148,7 @@ def get_branch_for_repo(config, repo_name, scheme_name, scheme_map,
148
148
149
149
def update_single_repository (pool_args ):
150
150
source_root , config , repo_name , scheme_name , scheme_map , tag , timestamp , \
151
- reset_to_remote , should_clean , cross_repos_pr = pool_args
151
+ reset_to_remote , should_clean , should_stash , cross_repos_pr = pool_args
152
152
repo_path = os .path .join (source_root , repo_name )
153
153
if not os .path .isdir (repo_path ) or os .path .islink (repo_path ):
154
154
return
@@ -171,9 +171,13 @@ def update_single_repository(pool_args):
171
171
checkout_target )
172
172
173
173
# The clean option restores a repository to pristine condition.
174
- if should_clean :
175
- shell .run (['git' , 'clean' , '-fdx' ],
176
- echo = True , prefix = prefix )
174
+ if should_clean or should_stash :
175
+ if should_stash :
176
+ shell .run (['git' , 'stash' ],
177
+ echo = True , prefix = prefix )
178
+ elif should_clean :
179
+ shell .run (['git' , 'clean' , '-fdx' ],
180
+ echo = True , prefix = prefix )
177
181
shell .run (['git' , 'submodule' , 'foreach' , '--recursive' ,
178
182
'git' , 'clean' , '-fdx' ],
179
183
echo = True , prefix = prefix )
@@ -343,6 +347,7 @@ def update_all_repositories(args, config, scheme_name, scheme_map, cross_repos_p
343
347
timestamp ,
344
348
args .reset_to_remote ,
345
349
args .clean ,
350
+ args .stash ,
346
351
cross_repos_pr ]
347
352
pool_args .append (my_args )
348
353
@@ -605,7 +610,11 @@ def main():
605
610
action = 'store_true' )
606
611
parser .add_argument (
607
612
'--clean' ,
608
- help = 'Clean unrelated files from each repository.' ,
613
+ help = 'Clean untracked files from each repository.' ,
614
+ action = 'store_true' )
615
+ parser .add_argument (
616
+ '--stash' ,
617
+ help = 'Stash untracked files from each repository.' ,
609
618
action = 'store_true' )
610
619
parser .add_argument (
611
620
"--config" ,
0 commit comments