Patchwork [in,crew] clfilter: fix `nodemap` usage in `getbundle`

login
register
mail settings
Submitter Kevin Bullock
Date Dec. 18, 2012, 8:38 p.m.
Message ID <739c88ff043c10edfaf7.1355863091@opendoor.mincava.umn.edu>
Download mbox | patch
Permalink /patch/186/
State Accepted
Commit 739c88ff043c10edfaf741cbac64901f47c10e5d
Headers show

Comments

Kevin Bullock - Dec. 18, 2012, 8:38 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1355159561 -3600
# Node ID 739c88ff043c10edfaf741cbac64901f47c10e5d
# Parent  4c53f015564fea7dea633e52bee37af2ca05a391
clfilter: fix `nodemap` usage in `getbundle`

With the current implementation, `changelog.nodemap` is not filtered. So some
filtered changeset in common are not filtered by `n in nodemap`. This leads to
crash lower in the stack when the bundle generation try to access those node on
a filtered changelog.
Kevin Bullock - Dec. 18, 2012, 8:41 p.m.
On Dec 18, 2012, at 2:38 PM, Kevin Bullock wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1355159561 -3600
> # Node ID 739c88ff043c10edfaf741cbac64901f47c10e5d
> # Parent  4c53f015564fea7dea633e52bee37af2ca05a391
> clfilter: fix `nodemap` usage in `getbundle`

This apparently should've been included in Pierre-Yves' most recent filtering series, [N of 7 V3]. It's independent of the work in that series, so I went ahead and queued it after patches 1 and 4 from that series. Here it is, in the words of Carol Off[1], "for the record".

[1]: <http://www.cbc.ca/asithappens/>

pacem in terris / ??? / ?????? / ????????? / ??
Kevin R. Bullock

> 
> With the current implementation, `changelog.nodemap` is not filtered. So some
> filtered changeset in common are not filtered by `n in nodemap`. This leads to
> crash lower in the stack when the bundle generation try to access those node on
> a filtered changelog.
> 
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -2107,8 +2107,8 @@ class localrepository(object):
>         """
>         cl = self.changelog
>         if common:
> -            nm = cl.nodemap
> -            common = [n for n in common if n in nm]
> +            hasnode = cl.hasnode
> +            common = [n for n in common if hasnode(n)]
>         else:
>             common = [nullid]
>         if not heads:

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2107,8 +2107,8 @@  class localrepository(object):
         """
         cl = self.changelog
         if common:
-            nm = cl.nodemap
-            common = [n for n in common if n in nm]
+            hasnode = cl.hasnode
+            common = [n for n in common if hasnode(n)]
         else:
             common = [nullid]
         if not heads: