Patchwork [5,of,5,filtering,part,2] getbundle: apply discovery on unfiltered changelog

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 4, 2012, 12:26 a.m.
Message ID <d71687d5baf86c20ad30.1354580818@yamac.lan>
Download mbox | patch
Permalink /patch/10/
State Superseded, archived
Headers show

Comments

Pierre-Yves David - Dec. 4, 2012, 12:26 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1354468865 -3600
# Node ID d71687d5baf86c20ad3029377b5fc743f4ee1bca
# Parent  cf4c5d45f5049f584202f7af4434b6586201e623
getbundle: apply discovery on unfiltered changelog.

When a bundle is requested, the common set may contains changesets that are
currently filtered at changelog level. We can pretent we really no have them or
us them to save time and bandwidth. This changeset choose the second option and
ensure the filtering and `findcommonmissing` call is done on an unfiltered repo.

Note: that with the current implementation, nodemap is not filtered resulting in
crash in possible `findcommonmissing` before this changeset. If the first option
were prefered we had to use `ch.hasnode(n)` instead of `n in nm` to ensure
consistent filtering.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2196,20 +2196,21 @@  class localrepository(object):
         If heads is None, use the local heads. If common is None, use [nullid].
 
         The nodes in common might not all be known locally due to the way the
         current discovery protocol works.
         """
-        cl = self.changelog
+        ucl = self.unfiltered().changelog
         if common:
-            nm = cl.nodemap
+            nm = ucl.nodemap
             common = [n for n in common if n in nm]
+
         else:
             common = [nullid]
         if not heads:
-            heads = cl.heads()
+            heads = self.changelog.heads()
         return self.getlocalbundle(source,
-                                   discovery.outgoing(cl, common, heads))
+                                   discovery.outgoing(ucl, common, heads))
 
     @unfilteredmethod
     def _changegroupsubset(self, commonrevs, csets, heads, source):
 
         cl = self.changelog