Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commandserver.py @ 29366:d269e7db2f55
ui: provide official way to reset internal state per command
This will allow us to clear in-memory password storage per runcommand().
I've updated commandserver to call resetstate() of both ui and repo.ui because
they may have different states in theory.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 12 Jun 2016 14:07:26 +0900 |
parents | ff5f923fca3c |
children | 33770d2b6cf9 |
comparison
equal
deleted
inserted
replaced
29365:f652e84f23f2 | 29366:d269e7db2f55 |
---|---|
227 repoui.copy = copiedui.copy # redo copy protection | 227 repoui.copy = copiedui.copy # redo copy protection |
228 uis.append(repoui) | 228 uis.append(repoui) |
229 self.repo.ui = self.repo.dirstate._ui = repoui | 229 self.repo.ui = self.repo.dirstate._ui = repoui |
230 self.repo.invalidateall() | 230 self.repo.invalidateall() |
231 | 231 |
232 # reset last-print time of progress bar per command | |
233 # (progbar is singleton, we don't have to do for all uis) | |
234 if copiedui._progbar: | |
235 copiedui._progbar.resetstate() | |
236 | |
237 for ui in uis: | 232 for ui in uis: |
233 ui.resetstate() | |
238 # any kind of interaction must use server channels, but chg may | 234 # any kind of interaction must use server channels, but chg may |
239 # replace channels by fully functional tty files. so nontty is | 235 # replace channels by fully functional tty files. so nontty is |
240 # enforced only if cin is a channel. | 236 # enforced only if cin is a channel. |
241 if not util.safehasattr(self.cin, 'fileno'): | 237 if not util.safehasattr(self.cin, 'fileno'): |
242 ui.setconfig('ui', 'nontty', 'true', 'commandserver') | 238 ui.setconfig('ui', 'nontty', 'true', 'commandserver') |