diff options
author | Martin Geisler <mgeisler@google.com> | 2022-07-08 10:50:10 +0200 |
---|---|---|
committer | Martin Geisler <mgeisler@google.com> | 2022-07-11 17:57:43 +0000 |
commit | 9fb64ae29cb978f869de5ff11a47f86e070b4274 (patch) | |
tree | 91254b0a4dc779f1db2ed24a9a2f679539173b5c /subcmds/upload.py | |
parent | d47d9ff1cbb33da4b3e37bc524c58feef6866b7a (diff) | |
download | git-repo-9fb64ae29cb978f869de5ff11a47f86e070b4274.tar.gz |
upload: add ‘--ignore-untracked-files’ option
This option will suppress the
Uncommitted changes in ... (did you forget to amend?)
prompt when there are untracked (unknown) files in the working copy.
The prompt is still shown if tracked files are modified.
Change-Id: Ia3fcc82989b7fad09b69214eda31e2d0dfc14600
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/340456
Tested-by: Martin Geisler <mgeisler@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/upload.py')
-rw-r--r-- | subcmds/upload.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py index 20b8fe5d..09ee5c02 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
@@ -204,6 +204,12 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
204 | p.add_option('-y', '--yes', | 204 | p.add_option('-y', '--yes', |
205 | default=False, action='store_true', | 205 | default=False, action='store_true', |
206 | help='answer yes to all safe prompts') | 206 | help='answer yes to all safe prompts') |
207 | p.add_option('--ignore-untracked-files', | ||
208 | action='store_true', default=False, | ||
209 | help='ignore untracked files in the working copy') | ||
210 | p.add_option('--no-ignore-untracked-files', | ||
211 | dest='ignore_untracked_files', action='store_false', | ||
212 | help='always ask about untracked files in the working copy') | ||
207 | p.add_option('--no-cert-checks', | 213 | p.add_option('--no-cert-checks', |
208 | dest='validate_certs', action='store_false', default=True, | 214 | dest='validate_certs', action='store_false', default=True, |
209 | help='disable verifying ssl certs (unsafe)') | 215 | help='disable verifying ssl certs (unsafe)') |
@@ -370,6 +376,10 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
370 | 376 | ||
371 | # Check if there are local changes that may have been forgotten | 377 | # Check if there are local changes that may have been forgotten |
372 | changes = branch.project.UncommitedFiles() | 378 | changes = branch.project.UncommitedFiles() |
379 | if opt.ignore_untracked_files: | ||
380 | untracked = set(branch.project.UntrackedFiles()) | ||
381 | changes = [x for x in changes if x not in untracked] | ||
382 | |||
373 | if changes: | 383 | if changes: |
374 | key = 'review.%s.autoupload' % branch.project.remote.review | 384 | key = 'review.%s.autoupload' % branch.project.remote.review |
375 | answer = branch.project.config.GetBoolean(key) | 385 | answer = branch.project.config.GetBoolean(key) |