summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--subcmds/upload.py56
1 files changed, 44 insertions, 12 deletions
diff --git a/subcmds/upload.py b/subcmds/upload.py
index 3e664056..6a98a8bd 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -61,6 +61,28 @@ existing change(s) in Gerrit match up to the commits in the branch
61being uploaded. For each matched pair of change,commit the commit 61being uploaded. For each matched pair of change,commit the commit
62will be added as a new patch set, completely replacing the set of 62will be added as a new patch set, completely replacing the set of
63files and description associated with the change in Gerrit. 63files and description associated with the change in Gerrit.
64
65Configuration
66-------------
67
68review.URL.autoupload:
69
70To disable the "Upload ... (y/n)?" prompt, you can set a per-project
71or global Git configuration option. If review.URL.autoupload is set
72to "true" then repo will assume you always answer "y" at the prompt,
73and will not prompt you further. If it is set to "false" then repo
74will assume you always answer "n", and will abort.
75
76The URL must match the review URL listed in the manifest XML file,
77or in the .git/config within the project. For example:
78
79 [remote "origin"]
80 url = git://git.example.com/project.git
81 review = http://review.example.com/
82
83 [review "http://review.example.com/"]
84 autoupload = true
85
64""" 86"""
65 87
66 def _Options(self, p): 88 def _Options(self, p):
@@ -79,19 +101,29 @@ files and description associated with the change in Gerrit.
79 name = branch.name 101 name = branch.name
80 date = branch.date 102 date = branch.date
81 list = branch.commits 103 list = branch.commits
104 remote = project.GetBranch(name).remote
105
106 key = 'review.%s.autoupload' % remote.review
107 answer = project.config.GetBoolean(key)
108
109 if answer is False:
110 _die("upload blocked by %s = false" % key)
111
112 if answer is None:
113 print 'Upload project %s/:' % project.relpath
114 print ' branch %s (%2d commit%s, %s):' % (
115 name,
116 len(list),
117 len(list) != 1 and 's' or '',
118 date)
119 for commit in list:
120 print ' %s' % commit
121
122 sys.stdout.write('(y/n)? ')
123 answer = sys.stdin.readline().strip()
124 answer = answer in ('y', 'Y', 'yes', '1', 'true', 't')
82 125
83 print 'Upload project %s/:' % project.relpath 126 if answer:
84 print ' branch %s (%2d commit%s, %s):' % (
85 name,
86 len(list),
87 len(list) != 1 and 's' or '',
88 date)
89 for commit in list:
90 print ' %s' % commit
91
92 sys.stdout.write('(y/n)? ')
93 answer = sys.stdin.readline().strip()
94 if answer in ('y', 'Y', 'yes', '1', 'true', 't'):
95 self._UploadAndReport([branch], people) 127 self._UploadAndReport([branch], people)
96 else: 128 else:
97 _die("upload aborted by user") 129 _die("upload aborted by user")