hgext/evolve.py
changeset 1624 081605c2e9b6
parent 1623 47a0ce11b4ca
child 1626 0edb545503fe
equal deleted inserted replaced
1623:47a0ce11b4ca 1624:081605c2e9b6
  1642     count = allopt and len(troubled) or 1
  1642     count = allopt and len(troubled) or 1
  1643     showprogress = allopt
  1643     showprogress = allopt
  1644 
  1644 
  1645     def progresscb():
  1645     def progresscb():
  1646         if revopt or allopt:
  1646         if revopt or allopt:
  1647             ui.progress(_('evolve'), seen, unit='changesets', total=count)
  1647             ui.progress(_('evolve'), seen, unit=_('changesets'), total=count)
  1648 
  1648 
  1649     # Continuation handling
  1649     # Continuation handling
  1650     if contopt:
  1650     if contopt:
  1651         if anyopt:
  1651         if anyopt:
  1652             raise error.Abort('cannot specify both "--any" and "--continue"')
  1652             raise error.Abort('cannot specify both "--any" and "--continue"')
  3262     @util.propertycache
  3262     @util.propertycache
  3263     def length(self):
  3263     def length(self):
  3264         return len(self.getvalue())
  3264         return len(self.getvalue())
  3265 
  3265 
  3266     def read(self, size=None):
  3266     def read(self, size=None):
  3267         obsexcprg(self.ui, self.tell(), unit="bytes", total=self.length)
  3267         obsexcprg(self.ui, self.tell(), unit=_("bytes"), total=self.length)
  3268         return StringIO.read(self, size)
  3268         return StringIO.read(self, size)
  3269 
  3269 
  3270     def __iter__(self):
  3270     def __iter__(self):
  3271         d = self.read(4096)
  3271         d = self.read(4096)
  3272         while d:
  3272         while d:
  3314             obsexcmsg(repo.ui, "pushing %i obsolescence markers in %i "
  3314             obsexcmsg(repo.ui, "pushing %i obsolescence markers in %i "
  3315                                "pushkey payload (%i bytes)\n"
  3315                                "pushkey payload (%i bytes)\n"
  3316                                % (len(markers), len(remotedata), totalbytes),
  3316                                % (len(markers), len(remotedata), totalbytes),
  3317                       True)
  3317                       True)
  3318             for key, data in remotedata:
  3318             for key, data in remotedata:
  3319                 obsexcprg(repo.ui, sentbytes, item=key, unit="bytes",
  3319                 obsexcprg(repo.ui, sentbytes, item=key, unit=_("bytes"),
  3320                           total=totalbytes)
  3320                           total=totalbytes)
  3321                 rslts.append(remote.pushkey('obsolete', key, '', data))
  3321                 rslts.append(remote.pushkey('obsolete', key, '', data))
  3322                 sentbytes += len(data)
  3322                 sentbytes += len(data)
  3323                 obsexcprg(repo.ui, sentbytes, item=key, unit="bytes",
  3323                 obsexcprg(repo.ui, sentbytes, item=key, unit=_("bytes"),
  3324                           total=totalbytes)
  3324                           total=totalbytes)
  3325             obsexcprg(repo.ui, None)
  3325             obsexcprg(repo.ui, None)
  3326             if [r for r in rslts if not r]:
  3326             if [r for r in rslts if not r]:
  3327                 msg = _('failed to push some obsolete markers!\n')
  3327                 msg = _('failed to push some obsolete markers!\n')
  3328                 repo.ui.warn(msg)
  3328                 repo.ui.warn(msg)
  3527     length = int(f.read(20))
  3527     length = int(f.read(20))
  3528     chunk = 4096
  3528     chunk = 4096
  3529     current = 0
  3529     current = 0
  3530     data = StringIO()
  3530     data = StringIO()
  3531     ui = self.ui
  3531     ui = self.ui
  3532     obsexcprg(ui, current, unit="bytes", total=length)
  3532     obsexcprg(ui, current, unit=_("bytes"), total=length)
  3533     while current < length:
  3533     while current < length:
  3534         readsize = min(length - current, chunk)
  3534         readsize = min(length - current, chunk)
  3535         data.write(f.read(readsize))
  3535         data.write(f.read(readsize))
  3536         current += readsize
  3536         current += readsize
  3537         obsexcprg(ui, current, unit="bytes", total=length)
  3537         obsexcprg(ui, current, unit=_("bytes"), total=length)
  3538     obsexcprg(ui, None)
  3538     obsexcprg(ui, None)
  3539     data.seek(0)
  3539     data.seek(0)
  3540     return data
  3540     return data
  3541 
  3541 
  3542 @eh.addattr(localrepo.localpeer, 'evoext_pullobsmarkers_0')
  3542 @eh.addattr(localrepo.localpeer, 'evoext_pullobsmarkers_0')