Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG164306d3f4b4: largefiles: use progress helper
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
pulkit |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/largefiles/basestore.py (7 lines) | |||
M | hgext/largefiles/lfcommands.py (15 lines) | |||
M | hgext/largefiles/lfutil.py (7 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Martin von Zweigbergk | Jun 18 2018, 6:14 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | D3806 lfs: use progess helper | |
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
been presented to the user, so missing is just supplied as a | been presented to the user, so missing is just supplied as a | ||||
summary.)''' | summary.)''' | ||||
success = [] | success = [] | ||||
missing = [] | missing = [] | ||||
ui = self.ui | ui = self.ui | ||||
at = 0 | at = 0 | ||||
available = self.exists(set(hash for (_filename, hash) in files)) | available = self.exists(set(hash for (_filename, hash) in files)) | ||||
for filename, hash in files: | progress = ui.makeprogress(_('getting largefiles'), unit=_('files'), | ||||
ui.progress(_('getting largefiles'), at, unit=_('files'), | |||||
total=len(files)) | total=len(files)) | ||||
for filename, hash in files: | |||||
progress.update(at) | |||||
at += 1 | at += 1 | ||||
ui.note(_('getting %s:%s\n') % (filename, hash)) | ui.note(_('getting %s:%s\n') % (filename, hash)) | ||||
if not available.get(hash): | if not available.get(hash): | ||||
ui.warn(_('%s: largefile %s not available from %s\n') | ui.warn(_('%s: largefile %s not available from %s\n') | ||||
% (filename, hash, util.hidepassword(self.url))) | % (filename, hash, util.hidepassword(self.url))) | ||||
missing.append(filename) | missing.append(filename) | ||||
continue | continue | ||||
if self._gethash(filename, hash): | if self._gethash(filename, hash): | ||||
success.append((filename, hash)) | success.append((filename, hash)) | ||||
else: | else: | ||||
missing.append(filename) | missing.append(filename) | ||||
ui.progress(_('getting largefiles'), None) | progress.complete() | ||||
return (success, missing) | return (success, missing) | ||||
def _gethash(self, filename, hash): | def _gethash(self, filename, hash): | ||||
"""Get file with the provided hash and store it in the local repo's | """Get file with the provided hash and store it in the local repo's | ||||
store and in the usercache. | store and in the usercache. | ||||
filename is for informational messages only. | filename is for informational messages only. | ||||
""" | """ | ||||
util.makedirs(lfutil.storepath(self.repo, '')) | util.makedirs(lfutil.storepath(self.repo, '')) |
This one can also be progress.increment().