Mercurial > hg
comparison mercurial/revlog.py @ 31856:0ab7f469d386
revlog: make "size" diverge from "rawsize"
Previously, revlog.size equals to revlog.rawsize. However, the flag
processor framework could make a difference - "size" could mean the length
of len(revision(raw=False)), while "rawsize" means len(revision(raw=True)).
This patch makes it so.
This corrects "hg status" output when flag processor is involved. The call
stack looks like:
basectx.status -> workingctx._buildstatus -> workingctx._dirstatestatus
-> workingctx._checklookup -> filectx.cmp -> filelog.cmp -> filelog.size
-> revlog.size
author | Jun Wu <quark@fb.com> |
---|---|
date | Sun, 09 Apr 2017 12:53:31 -0700 |
parents | 726f24123f02 |
children | 1395f843ece4 e9d325cfe071 |
comparison
equal
deleted
inserted
replaced
31855:a418c5837bc0 | 31856:0ab7f469d386 |
---|---|
444 if l >= 0: | 444 if l >= 0: |
445 return l | 445 return l |
446 | 446 |
447 t = self.revision(rev, raw=True) | 447 t = self.revision(rev, raw=True) |
448 return len(t) | 448 return len(t) |
449 size = rawsize | 449 |
450 def size(self, rev): | |
451 """length of non-raw text (processed by a "read" flag processor)""" | |
452 # fast path: if no "read" flag processor could change the content, | |
453 # size is rawsize. note: ELLIPSIS is known to not change the content. | |
454 flags = self.flags(rev) | |
455 if flags & (REVIDX_KNOWN_FLAGS ^ REVIDX_ELLIPSIS) == 0: | |
456 return self.rawsize(rev) | |
457 | |
458 return len(self.revision(rev, raw=False)) | |
450 | 459 |
451 def chainbase(self, rev): | 460 def chainbase(self, rev): |
452 base = self._chainbasecache.get(rev) | 461 base = self._chainbasecache.get(rev) |
453 if base is not None: | 462 if base is not None: |
454 return base | 463 return base |