Patchwork [remotefilelog] shallowbundle: specifically compare instance to remotefilelog.remotefilelog

login
register
mail settings
Submitter via Mercurial-devel
Date July 16, 2016, 6:58 a.m.
Message ID <b2a93bc0af6451608283.1468652301@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/15905/
State Accepted
Headers show

Comments

via Mercurial-devel - July 16, 2016, 6:58 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1468651989 25200
#      Fri Jul 15 23:53:09 2016 -0700
# Node ID b2a93bc0af645160828399e51970e1e6c778b130
# Parent  066664a96b8fdce9184a21184dbaf66c5a762d38
shallowbundle: specifically compare instance to remotefilelog.remotefilelog

In two place, we were checking if a revlog was an instance of
revlog.revlog and, I think, treating it as a
remotefilelog.remotefilelog otherwise. I noticed this when I created
another non-revlog.revlog revlog in narrowhg and remotefilelog thought
it was a remotefilelog.remotefilelog. Let's specifically check if it's
a remotefilelog.remotefilelog instead.
Durham Goode - July 19, 2016, 7:33 p.m.
Accepted and pushed. Thanks!

On 7/15/16, 11:58 PM, "Martin von Zweigbergk" <martinvonz@google.com> wrote:

># HG changeset patch

># User Martin von Zweigbergk <martinvonz@google.com>

># Date 1468651989 25200

>#      Fri Jul 15 23:53:09 2016 -0700

># Node ID b2a93bc0af645160828399e51970e1e6c778b130

># Parent  066664a96b8fdce9184a21184dbaf66c5a762d38

>shallowbundle: specifically compare instance to remotefilelog.remotefilelog

>

>In two place, we were checking if a revlog was an instance of

>revlog.revlog and, I think, treating it as a

>remotefilelog.remotefilelog otherwise. I noticed this when I created

>another non-revlog.revlog revlog in narrowhg and remotefilelog thought

>it was a remotefilelog.remotefilelog. Let's specifically check if it's

>a remotefilelog.remotefilelog instead.

>

>diff -r 066664a96b8f -r b2a93bc0af64 remotefilelog/shallowbundle.py

>--- a/remotefilelog/shallowbundle.py	Thu Jul 07 15:59:06 2016 -0700

>+++ b/remotefilelog/shallowbundle.py	Fri Jul 15 23:53:09 2016 -0700

>@@ -8,7 +8,7 @@

> import fileserverclient, remotefilelog, shallowutil

> import collections, os

> from mercurial.node import bin, hex, nullid, nullrev

>-from mercurial import changegroup, revlog, phases, mdiff, match, bundlerepo

>+from mercurial import changegroup, phases, mdiff, match, bundlerepo

> from mercurial import util, error

> from mercurial.i18n import _

> 

>@@ -19,7 +19,7 @@

> requirement = "remotefilelog"

> 

> def shallowgroup(cls, self, nodelist, rlog, lookup, units=None, reorder=None):

>-    if isinstance(rlog, revlog.revlog):

>+    if not isinstance(rlog, remotefilelog.remotefilelog):

>         for c in super(cls, self).group(nodelist, rlog, lookup,

>                                         units=units):

>             yield c

>@@ -135,7 +135,7 @@

>         return NoFiles

> 

>     def prune(self, rlog, missing, commonrevs):

>-        if isinstance(rlog, revlog.revlog):

>+        if not isinstance(rlog, remotefilelog.remotefilelog):

>             return super(shallowcg1packer, self).prune(rlog, missing,

>                 commonrevs)

>

Patch

diff -r 066664a96b8f -r b2a93bc0af64 remotefilelog/shallowbundle.py
--- a/remotefilelog/shallowbundle.py	Thu Jul 07 15:59:06 2016 -0700
+++ b/remotefilelog/shallowbundle.py	Fri Jul 15 23:53:09 2016 -0700
@@ -8,7 +8,7 @@ 
 import fileserverclient, remotefilelog, shallowutil
 import collections, os
 from mercurial.node import bin, hex, nullid, nullrev
-from mercurial import changegroup, revlog, phases, mdiff, match, bundlerepo
+from mercurial import changegroup, phases, mdiff, match, bundlerepo
 from mercurial import util, error
 from mercurial.i18n import _
 
@@ -19,7 +19,7 @@ 
 requirement = "remotefilelog"
 
 def shallowgroup(cls, self, nodelist, rlog, lookup, units=None, reorder=None):
-    if isinstance(rlog, revlog.revlog):
+    if not isinstance(rlog, remotefilelog.remotefilelog):
         for c in super(cls, self).group(nodelist, rlog, lookup,
                                         units=units):
             yield c
@@ -135,7 +135,7 @@ 
         return NoFiles
 
     def prune(self, rlog, missing, commonrevs):
-        if isinstance(rlog, revlog.revlog):
+        if not isinstance(rlog, remotefilelog.remotefilelog):
             return super(shallowcg1packer, self).prune(rlog, missing,
                 commonrevs)