Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHGdf2162672d24: progress: delete deprecated ui.progress()
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
pulkit |
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/ui.py (24 lines) | |||
M | relnotes/next (2 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
df2162672d24 | 161958ebf73c | Martin von Zweigbergk | Jan 24 2020, 5:32 PM |
def _progclear(self): | def _progclear(self): | ||||
"""clear progress bar output if any. use it before any output""" | """clear progress bar output if any. use it before any output""" | ||||
if not haveprogbar(): # nothing loaded yet | if not haveprogbar(): # nothing loaded yet | ||||
return | return | ||||
if self._progbar is not None and self._progbar.printed: | if self._progbar is not None and self._progbar.printed: | ||||
self._progbar.clear() | self._progbar.clear() | ||||
def progress(self, topic, pos, item=b"", unit=b"", total=None): | |||||
'''show a progress message | |||||
By default a textual progress bar will be displayed if an operation | |||||
takes too long. 'topic' is the current operation, 'item' is a | |||||
non-numeric marker of the current position (i.e. the currently | |||||
in-process file), 'pos' is the current numeric position (i.e. | |||||
revision, bytes, etc.), unit is a corresponding unit label, | |||||
and total is the highest expected pos. | |||||
Multiple nested topics may be active at a time. | |||||
All topics should be marked closed by setting pos to None at | |||||
termination. | |||||
''' | |||||
self.deprecwarn( | |||||
b"use ui.makeprogress() instead of ui.progress()", b"5.1" | |||||
) | |||||
progress = self.makeprogress(topic, unit, total) | |||||
if pos is not None: | |||||
progress.update(pos, item=item) | |||||
else: | |||||
progress.complete() | |||||
def makeprogress(self, topic, unit=b"", total=None): | def makeprogress(self, topic, unit=b"", total=None): | ||||
"""Create a progress helper for the specified topic""" | """Create a progress helper for the specified topic""" | ||||
if getattr(self._fmsgerr, 'structured', False): | if getattr(self._fmsgerr, 'structured', False): | ||||
# channel for machine-readable output with metadata, just send | # channel for machine-readable output with metadata, just send | ||||
# raw information | # raw information | ||||
# TODO: consider porting some useful information (e.g. estimated | # TODO: consider porting some useful information (e.g. estimated | ||||
# time) from progbar. we might want to support update delay to | # time) from progbar. we might want to support update delay to | ||||
# reduce the cost of transferring progress messages. | # reduce the cost of transferring progress messages. |
== New Features == | == New Features == | ||||
== New Experimental Features == | == New Experimental Features == | ||||
== Bug Fixes == | == Bug Fixes == | ||||
== Backwards Compatibility Changes == | == Backwards Compatibility Changes == | ||||
== Internal API Changes == | == Internal API Changes == | ||||
* The deprecated `ui.progress()` has now been deleted. Please use | |||||
`ui.makeprogress()` instead. |