mercurial/scmutil.py
changeset 38345 bec1212eceaa
parent 38331 cf59de802883
child 38373 ef692614e601
equal deleted inserted replaced
38344:c6f82a18a63d 38345:bec1212eceaa
  1283     arguments that ui.system does, and returns the exit code of the
  1283     arguments that ui.system does, and returns the exit code of the
  1284     subprocess."""
  1284     subprocess."""
  1285     return _locksub(repo, repo.currentwlock(), 'HG_WLOCK_LOCKER', cmd, *args,
  1285     return _locksub(repo, repo.currentwlock(), 'HG_WLOCK_LOCKER', cmd, *args,
  1286                     **kwargs)
  1286                     **kwargs)
  1287 
  1287 
       
  1288 class progress(object):
       
  1289     def __init__(self, ui, topic, unit="", total=None):
       
  1290         self.ui = ui
       
  1291         self.pos = 0
       
  1292         self.topic = topic
       
  1293         self.unit = unit
       
  1294         self.total = total
       
  1295 
       
  1296     def update(self, pos, item="", total=None):
       
  1297         if total:
       
  1298             self.total = total
       
  1299         self.pos = pos
       
  1300         self._print(item)
       
  1301 
       
  1302     def increment(self, step=1, item="", total=None):
       
  1303         self.update(self.pos + step, item, total)
       
  1304 
       
  1305     def _print(self, item):
       
  1306         self.ui.progress(self.topic, self.pos, item, self.unit,
       
  1307                          self.total)
       
  1308 
  1288 def gdinitconfig(ui):
  1309 def gdinitconfig(ui):
  1289     """helper function to know if a repo should be created as general delta
  1310     """helper function to know if a repo should be created as general delta
  1290     """
  1311     """
  1291     # experimental config: format.generaldelta
  1312     # experimental config: format.generaldelta
  1292     return (ui.configbool('format', 'generaldelta')
  1313     return (ui.configbool('format', 'generaldelta')