diff options
Diffstat (limited to 'subcmds/init.py')
-rw-r--r-- | subcmds/init.py | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/subcmds/init.py b/subcmds/init.py index fbc406e2..75a58f11 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -148,20 +148,33 @@ to update the working directory files. | |||
148 | print >>sys.stderr, 'fatal: %s' % str(e) | 148 | print >>sys.stderr, 'fatal: %s' % str(e) |
149 | sys.exit(1) | 149 | sys.exit(1) |
150 | 150 | ||
151 | def _PromptKey(self, prompt, key, value): | 151 | def _Prompt(self, prompt, value): |
152 | mp = self.manifest.manifestProject | 152 | mp = self.manifest.manifestProject |
153 | 153 | ||
154 | sys.stdout.write('%-10s [%s]: ' % (prompt, value)) | 154 | sys.stdout.write('%-10s [%s]: ' % (prompt, value)) |
155 | a = sys.stdin.readline().strip() | 155 | a = sys.stdin.readline().strip() |
156 | if a != '' and a != value: | 156 | if a == '': |
157 | mp.config.SetString(key, a) | 157 | return value |
158 | return a | ||
158 | 159 | ||
159 | def _ConfigureUser(self): | 160 | def _ConfigureUser(self): |
160 | mp = self.manifest.manifestProject | 161 | mp = self.manifest.manifestProject |
161 | 162 | ||
162 | print '' | 163 | while True: |
163 | self._PromptKey('Your Name', 'user.name', mp.UserName) | 164 | print '' |
164 | self._PromptKey('Your Email', 'user.email', mp.UserEmail) | 165 | name = self._Prompt('Your Name', mp.UserName) |
166 | email = self._Prompt('Your Email', mp.UserEmail) | ||
167 | |||
168 | print '' | ||
169 | print 'Your identity is: %s <%s>' % (name, email) | ||
170 | sys.stdout.write('is this correct [yes/no]? ') | ||
171 | if 'yes' == sys.stdin.readline().strip(): | ||
172 | break | ||
173 | |||
174 | if name != mp.UserName: | ||
175 | mp.config.SetString('user.name', name) | ||
176 | if email != mp.UserEmail: | ||
177 | mp.config.SetString('user.email', email) | ||
165 | 178 | ||
166 | def _HasColorSet(self, gc): | 179 | def _HasColorSet(self, gc): |
167 | for n in ['ui', 'diff', 'status']: | 180 | for n in ['ui', 'diff', 'status']: |