110 """compute the rev of one revision, assert previous revision has an hot cache |
110 """compute the rev of one revision, assert previous revision has an hot cache |
111 """ |
111 """ |
112 cl = repo.unfiltered().changelog |
112 cl = repo.unfiltered().changelog |
113 total = len(data) |
113 total = len(data) |
114 |
114 |
115 def progress(pos, rev): |
115 def progress(pos, rev=None): |
|
116 revstr = '' if rev is None else ('rev %d' % rev) |
116 compat.progress(repo.ui, 'updating depth cache', |
117 compat.progress(repo.ui, 'updating depth cache', |
117 pos, 'rev %s' % rev, unit='revision', total=total) |
118 pos, revstr, unit='revision', total=total) |
118 progress(0, '') |
119 progress(0) |
119 for idx, rev in enumerate(data, 1): |
120 for idx, rev in enumerate(data, 1): |
120 assert rev == len(self._data), (rev, len(self._data)) |
121 assert rev == len(self._data), (rev, len(self._data)) |
121 self._data.append(self._depth(cl, rev)) |
122 self._data.append(self._depth(cl, rev)) |
122 if not (idx % 10000): # progress as a too high performance impact |
123 if not (idx % 10000): # progress as a too high performance impact |
123 progress(idx, rev) |
124 progress(idx, rev) |
124 progress(None, '') |
125 progress(None) |
125 |
126 |
126 def _depth(self, changelog, rev): |
127 def _depth(self, changelog, rev): |
127 cl = changelog |
128 cl = changelog |
128 ps = filterparents(cl.parentrevs(rev)) |
129 ps = filterparents(cl.parentrevs(rev)) |
129 if not ps: |
130 if not ps: |