mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Allow review.URL.autoupload to skip prompting during repo upload
If review.URL.autoupload is set to true in a project's .git/config or in ~/.gitconfig then `repo upload` will automatically upload, and skip prompting the end-user. Conversely, if review.URL.autoupload is set to false, then repo will refuse to upload to that project. Bug: REPO-25 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
f8e3273dec
commit
a608fb024b
@ -61,6 +61,28 @@ existing change(s) in Gerrit match up to the commits in the branch
|
||||
being uploaded. For each matched pair of change,commit the commit
|
||||
will be added as a new patch set, completely replacing the set of
|
||||
files and description associated with the change in Gerrit.
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
review.URL.autoupload:
|
||||
|
||||
To disable the "Upload ... (y/n)?" prompt, you can set a per-project
|
||||
or global Git configuration option. If review.URL.autoupload is set
|
||||
to "true" then repo will assume you always answer "y" at the prompt,
|
||||
and will not prompt you further. If it is set to "false" then repo
|
||||
will assume you always answer "n", and will abort.
|
||||
|
||||
The URL must match the review URL listed in the manifest XML file,
|
||||
or in the .git/config within the project. For example:
|
||||
|
||||
[remote "origin"]
|
||||
url = git://git.example.com/project.git
|
||||
review = http://review.example.com/
|
||||
|
||||
[review "http://review.example.com/"]
|
||||
autoupload = true
|
||||
|
||||
"""
|
||||
|
||||
def _Options(self, p):
|
||||
@ -79,7 +101,15 @@ files and description associated with the change in Gerrit.
|
||||
name = branch.name
|
||||
date = branch.date
|
||||
list = branch.commits
|
||||
remote = project.GetBranch(name).remote
|
||||
|
||||
key = 'review.%s.autoupload' % remote.review
|
||||
answer = project.config.GetBoolean(key)
|
||||
|
||||
if answer is False:
|
||||
_die("upload blocked by %s = false" % key)
|
||||
|
||||
if answer is None:
|
||||
print 'Upload project %s/:' % project.relpath
|
||||
print ' branch %s (%2d commit%s, %s):' % (
|
||||
name,
|
||||
@ -91,7 +121,9 @@ files and description associated with the change in Gerrit.
|
||||
|
||||
sys.stdout.write('(y/n)? ')
|
||||
answer = sys.stdin.readline().strip()
|
||||
if answer in ('y', 'Y', 'yes', '1', 'true', 't'):
|
||||
answer = answer in ('y', 'Y', 'yes', '1', 'true', 't')
|
||||
|
||||
if answer:
|
||||
self._UploadAndReport([branch], people)
|
||||
else:
|
||||
_die("upload aborted by user")
|
||||
|
Loading…
Reference in New Issue
Block a user