[PATCH STABLE V2] annotate: pre-calculate the "needed" dictionary (issue5360)
Yuya Nishihara
yuya at tcha.org
Mon Sep 5 09:59:21 EDT 2016
On Sun, 4 Sep 2016 22:42:23 +0100, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1472826059 -3600
> # Fri Sep 02 15:20:59 2016 +0100
> # Node ID 00579a5483badf47576253fad3a472090dc3ed24
> # Parent d130a38ef41f3c9e2d2f26df3535d89a93f87301
> # Available At https://bitbucket.org/quark-zju/hg-draft
> # hg pull https://bitbucket.org/quark-zju/hg-draft -r 00579a5483ba
> annotate: pre-calculate the "needed" dictionary (issue5360)
Nice. I couldn't find any errors, so queued for stable, thanks.
> + # 2nd DFS does the actual annotate
> + visit[:] = [base]
> + hist = {}
> + while visit:
> f = visit[-1]
> - pcached = f in pcache
> - if not pcached:
> - pcache[f] = parents(f)
> + if f in hist:
> + visit.pop()
> + continue
>
> ready = True
> @@ -1007,16 +1021,9 @@ class basefilectx(object):
> ready = False
> visit.append(p)
> - if not pcached:
> - needed[p] = needed.get(p, 0) + 1
> if ready:
> visit.pop()
> - reusable = f in hist
> - if reusable:
> - curr = hist[f]
> - else:
> - curr = decorate(f.data(), f)
> + curr = decorate(f.data(), f)
> for p in pl:
> - if not reusable:
> - curr = pair(hist[p], curr)
> + curr = pair(hist[p], curr)
> if needed[p] == 1:
> del hist[p]
I believe the "reusable" case mentioned in a54ddfae8907 is handled well in
new code. Foozy, can you revalidate that?
https://selenic.com/repo/hg/rev/a54ddfae8907
> +Issue5360: Deleted chunk in p1 of a merge changeset
> +
> + $ cd ..
Moved "cd .." to the bottom of new test.
> + $ hg init repo-5360
> + $ cd repo-5360
> + $ echo 1 > a
> + $ hg commit -A a -m 1
> + $ echo 2 >> a
> + $ hg commit -m 2
> + $ echo a > a
> + $ hg commit -m a
> + $ hg update '.^' -q
> + $ echo 3 >> a
> + $ hg commit -m 3 -q
> + $ hg merge 2 -q
> + $ cat > a << EOF
> + > b
> + > 1
> + > 2
> + > 3
> + > a
> + > EOF
> + $ hg resolve --mark -q
> + $ hg commit -m m
> + $ hg annotate a
> + 4: b
> + 0: 1
> + 1: 2
> + 3: 3
> + 2: a
More information about the Mercurial-devel
mailing list