Mercurial > hg
comparison mercurial/ui.py @ 44159:df2162672d24
progress: delete deprecated ui.progress()
Differential Revision: https://phab.mercurial-scm.org/D7991
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 24 Jan 2020 14:32:53 -0800 |
parents | e2278581b1c6 |
children | b746a22349f9 |
comparison
equal
deleted
inserted
replaced
44158:161958ebf73c | 44159:df2162672d24 |
---|---|
1937 if not haveprogbar(): # nothing loaded yet | 1937 if not haveprogbar(): # nothing loaded yet |
1938 return | 1938 return |
1939 if self._progbar is not None and self._progbar.printed: | 1939 if self._progbar is not None and self._progbar.printed: |
1940 self._progbar.clear() | 1940 self._progbar.clear() |
1941 | 1941 |
1942 def progress(self, topic, pos, item=b"", unit=b"", total=None): | |
1943 '''show a progress message | |
1944 | |
1945 By default a textual progress bar will be displayed if an operation | |
1946 takes too long. 'topic' is the current operation, 'item' is a | |
1947 non-numeric marker of the current position (i.e. the currently | |
1948 in-process file), 'pos' is the current numeric position (i.e. | |
1949 revision, bytes, etc.), unit is a corresponding unit label, | |
1950 and total is the highest expected pos. | |
1951 | |
1952 Multiple nested topics may be active at a time. | |
1953 | |
1954 All topics should be marked closed by setting pos to None at | |
1955 termination. | |
1956 ''' | |
1957 self.deprecwarn( | |
1958 b"use ui.makeprogress() instead of ui.progress()", b"5.1" | |
1959 ) | |
1960 progress = self.makeprogress(topic, unit, total) | |
1961 if pos is not None: | |
1962 progress.update(pos, item=item) | |
1963 else: | |
1964 progress.complete() | |
1965 | |
1966 def makeprogress(self, topic, unit=b"", total=None): | 1942 def makeprogress(self, topic, unit=b"", total=None): |
1967 """Create a progress helper for the specified topic""" | 1943 """Create a progress helper for the specified topic""" |
1968 if getattr(self._fmsgerr, 'structured', False): | 1944 if getattr(self._fmsgerr, 'structured', False): |
1969 # channel for machine-readable output with metadata, just send | 1945 # channel for machine-readable output with metadata, just send |
1970 # raw information | 1946 # raw information |