Submitter | Siddharth Agarwal |
---|---|
Date | July 15, 2013, 10:23 p.m. |
Message ID | <940aec4ff8f68c3bfdde.1373927002@dev1091.prn1.facebook.com> |
Download | mbox | patch |
Permalink | /patch/1907/ |
State | Accepted |
Commit | 4da845cd854f12c03509cd875990b5aef82a4820 |
Headers | show |
Comments
On Mon, Jul 15, 2013 at 03:23:22PM -0700, Siddharth Agarwal wrote: > # HG changeset patch > # User Siddharth Agarwal <sid0@fb.com> > # Date 1373926783 25200 > # Mon Jul 15 15:19:43 2013 -0700 > # Node ID 940aec4ff8f68c3bfddefa49f8d05d4fc20a42e6 > # Parent 546afdcea212c18fdbf59952810c532202f605fb > summary: use missing ancestors algorithm to find new commits queued, thanks > > For a repository with around 520,000 commits and 190,000 files, this reduces > the time hg summary takes from 5.5 seconds to 2.75. > > diff --git a/mercurial/commands.py b/mercurial/commands.py > --- a/mercurial/commands.py > +++ b/mercurial/commands.py > @@ -5480,18 +5480,8 @@ > ui.write(_('commit: %s\n') % t.strip()) > > # all ancestors of branch heads - all ancestors of parent = new csets > - new = [0] * len(repo) > - cl = repo.changelog > - for a in [cl.rev(n) for n in bheads]: > - new[a] = 1 > - for a in cl.ancestors([cl.rev(n) for n in bheads]): > - new[a] = 1 > - for a in [p.rev() for p in parents]: > - if a >= 0: > - new[a] = 0 > - for a in cl.ancestors([p.rev() for p in parents]): > - new[a] = 0 > - new = sum(new) > + new = len(repo.changelog.findmissing([ctx.node() for ctx in parents], > + bheads)) > > if new == 0: > # i18n: column positioning for "hg summary" > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
Patch
diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -5480,18 +5480,8 @@ ui.write(_('commit: %s\n') % t.strip()) # all ancestors of branch heads - all ancestors of parent = new csets - new = [0] * len(repo) - cl = repo.changelog - for a in [cl.rev(n) for n in bheads]: - new[a] = 1 - for a in cl.ancestors([cl.rev(n) for n in bheads]): - new[a] = 1 - for a in [p.rev() for p in parents]: - if a >= 0: - new[a] = 0 - for a in cl.ancestors([p.rev() for p in parents]): - new[a] = 0 - new = sum(new) + new = len(repo.changelog.findmissing([ctx.node() for ctx in parents], + bheads)) if new == 0: # i18n: column positioning for "hg summary"