Mercurial > hgsubversion
comparison hgsubversion/compathacks.py @ 1601:5d8603f080c5
compathacks: add compat code for ui.makeprogress() deprecation
ui.makeprogress() is deprecated and will be dropped in 5.1. This patch adds
compat code for that. The compat code is plain copy of compat code available in
evolve extension.
author | Pulkit Goyal <pulkit@yandex-team.ru> |
---|---|
date | Mon, 04 Feb 2019 20:56:39 +0300 |
parents | 7bb6562feb85 |
children | 6a6ce9d9da35 |
comparison
equal
deleted
inserted
replaced
1600:6f5b296c01dd | 1601:5d8603f080c5 |
---|---|
1 """Functions to work around API changes.""" | 1 """Functions to work around API changes.""" |
2 | 2 |
3 import errno | 3 import errno |
4 import sys | 4 import sys |
5 | 5 |
6 from mercurial import util | 6 from mercurial import ui as uimod, util |
7 | |
8 # ui.makeprogress will be dropped after hg-5.1 | |
9 if util.safehasattr(uimod.ui, 'makeprogress'): | |
10 def progress(ui, topic, pos, item="", unit="", total=None): | |
11 progress = ui.makeprogress(topic, unit, total) | |
12 if pos is not None: | |
13 progress.update(pos, item=item) | |
14 else: | |
15 progress.complete() | |
16 else: | |
17 def progress(ui, topic, pos, item="", unit="", total=None): | |
18 ui.progress(topic, pos, item="", unit="", total=None) | |
7 | 19 |
8 def pickle_load(f): | 20 def pickle_load(f): |
9 import cPickle as pickle | 21 import cPickle as pickle |
10 f.seek(0) | 22 f.seek(0) |
11 return pickle.load(f) | 23 return pickle.load(f) |