Patchwork [remotefilelog-ext,remotefilelog-ext] datapack: don't depend on demandimport when cstore isn't available

login
register
mail settings
Submitter Augie Fackler
Date March 13, 2017, 7 p.m.
Message ID <7d290452e8f119b1329f.1489431623@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19297/
State Changes Requested
Headers show

Comments

Augie Fackler - March 13, 2017, 7 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1489431594 14400
#      Mon Mar 13 14:59:54 2017 -0400
# Node ID 7d290452e8f119b1329f70c9d529a8c5ff271cea
# Parent  dd7bb6e663c80553a6abb197bbe74de439c4410f
datapack: don't depend on demandimport when cstore isn't available

We've got a goofy test binary that doesn't use demandimport, and this
was tripping it up.
Kostia Balytskyi - March 13, 2017, 9:06 p.m.
This looks good to me.

On 13/03/2017 12:00, Augie Fackler wrote:
> # HG changeset patch

> # User Augie Fackler <augie@google.com>

> # Date 1489431594 14400

> #      Mon Mar 13 14:59:54 2017 -0400

> # Node ID 7d290452e8f119b1329f70c9d529a8c5ff271cea

> # Parent  dd7bb6e663c80553a6abb197bbe74de439c4410f

> datapack: don't depend on demandimport when cstore isn't available

>

> We've got a goofy test binary that doesn't use demandimport, and this

> was tripping it up.

>

> diff --git a/remotefilelog/datapack.py b/remotefilelog/datapack.py

> --- a/remotefilelog/datapack.py

> +++ b/remotefilelog/datapack.py

> @@ -3,7 +3,11 @@ from mercurial import util

>   from mercurial.node import nullid, hex

>   from mercurial.i18n import _

>   import basepack, constants

> -import cstore

> +try:

> +    import cstore

> +    cstore.datapack

> +except ImportError:

> +    cstore = None

>   

>   # Index entry format is: <node><delta offset><pack data offset><pack data size>

>   # See the mutabledatapack doccomment for more details.

> _______________________________________________

> Mercurial-devel mailing list

> Mercurial-devel@mercurial-scm.org

> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Durham Goode - March 14, 2017, 7:45 p.m.
On 3/13/17 2:06 PM, Kostia Balytskyi wrote:
> This looks good to me.
>
> On 13/03/2017 12:00, Augie Fackler wrote:
>> # HG changeset patch
>> # User Augie Fackler <augie@google.com>
>> # Date 1489431594 14400
>> #      Mon Mar 13 14:59:54 2017 -0400
>> # Node ID 7d290452e8f119b1329f70c9d529a8c5ff271cea
>> # Parent  dd7bb6e663c80553a6abb197bbe74de439c4410f
>> datapack: don't depend on demandimport when cstore isn't available
>>
>> We've got a goofy test binary that doesn't use demandimport, and this
>> was tripping it up.

Accepted and pushed. Thanks

Patch

diff --git a/remotefilelog/datapack.py b/remotefilelog/datapack.py
--- a/remotefilelog/datapack.py
+++ b/remotefilelog/datapack.py
@@ -3,7 +3,11 @@  from mercurial import util
 from mercurial.node import nullid, hex
 from mercurial.i18n import _
 import basepack, constants
-import cstore
+try:
+    import cstore
+    cstore.datapack
+except ImportError:
+    cstore = None
 
 # Index entry format is: <node><delta offset><pack data offset><pack data size>
 # See the mutabledatapack doccomment for more details.