Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/context.py @ 18992:a54ddfae8907
annotate: reuse already calculated annotation
Before this patch, annotation is re-calculated even if it is already
calculated. This may cause unexpected annotation, because already
cleared "pcache" ("pcache[f] = []") prevents from scanning ancestors.
This patch reuses already calculated annotation if it is available.
In fact, "reusable" situation should be seen only on legacy
repositories in which a filelog include the merging between the
revision and its ancestor, because:
- tree is scanned in depth-first
without such merging, annotation result should be released soon
- recent Mercurial doesn't allow such merging
changelog and manifest can include such merging someway, but
filelogs can't, because "localrepository._filecommit()" converts
such merging request to linear history.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 29 Mar 2013 22:57:15 +0900 |
parents | 2f7186400a07 |
children | 0fd0612dc855 |
comparison
equal
deleted
inserted
replaced
18991:c1af1fb314bc | 18992:a54ddfae8907 |
---|---|
699 ready = False | 699 ready = False |
700 visit.append(p) | 700 visit.append(p) |
701 needed[p] = needed.get(p, 0) + 1 | 701 needed[p] = needed.get(p, 0) + 1 |
702 if ready: | 702 if ready: |
703 visit.pop() | 703 visit.pop() |
704 curr = decorate(f.data(), f) | 704 reusable = f in hist |
705 if reusable: | |
706 curr = hist[f] | |
707 else: | |
708 curr = decorate(f.data(), f) | |
705 for p in pl: | 709 for p in pl: |
706 curr = pair(hist[p], curr) | 710 if not reusable: |
711 curr = pair(hist[p], curr) | |
707 if needed[p] == 1: | 712 if needed[p] == 1: |
708 del hist[p] | 713 del hist[p] |
709 else: | 714 else: |
710 needed[p] -= 1 | 715 needed[p] -= 1 |
711 | 716 |