Submitter | Pulkit Goyal |
---|---|
Date | May 31, 2017, 9:47 p.m. |
Message ID | <66f3c6ec7827f4bc1d28.1496267220@workspace> |
Download | mbox | patch |
Permalink | /patch/21099/ |
State | Accepted |
Headers | show |
Comments
On Thu, Jun 01, 2017 at 03:17:00AM +0530, Pulkit Goyal wrote: > # HG changeset patch > # User Pulkit Goyal <7895pulkit@gmail.com> > # Date 1496259842 -19800 > # Thu Jun 01 01:14:02 2017 +0530 > # Node ID 66f3c6ec7827f4bc1d28673c0478ca42d60656ed > # Parent 25718d4a6de987771b43874573e1095c9cfc5ab2 > py3: pass dict.items() to list() to obtain a list > > dict.items() returned a list on Python 2 and whereas on Python 3 it returns a > view object, so we need to pass it into list() to get a list. > > diff --git a/mercurial/copies.py b/mercurial/copies.py > --- a/mercurial/copies.py > +++ b/mercurial/copies.py > @@ -419,8 +419,9 @@ > for f in u2u: > _checkcopies(c2, f, m2, m1, base, tca, dirtyc2, limit, data2) > > - copy = dict(data1['copy'].items() + data2['copy'].items()) > - fullcopy = dict(data1['fullcopy'].items() + data2['fullcopy'].items()) > + copy = dict(list(data1['copy'].items()) + list(data2['copy'].items())) > + fullcopy = dict(list(data1['fullcopy'].items()) + > + list(data2['fullcopy'].items())) Hm. I think it'd be more efficient to do: copy = dict(data1['copy']) copy.update(data2['copy']) which avoids actually constructing the lists, and should save on gc churn. Can you try that? > > if dirtyc1: > _combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge, > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -419,8 +419,9 @@ for f in u2u: _checkcopies(c2, f, m2, m1, base, tca, dirtyc2, limit, data2) - copy = dict(data1['copy'].items() + data2['copy'].items()) - fullcopy = dict(data1['fullcopy'].items() + data2['fullcopy'].items()) + copy = dict(list(data1['copy'].items()) + list(data2['copy'].items())) + fullcopy = dict(list(data1['fullcopy'].items()) + + list(data2['fullcopy'].items())) if dirtyc1: _combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge,