Patchwork [evolve-ext] evolve: use hashlib.sha1() directly

login
register
mail settings
Submitter via Mercurial-devel
Date June 17, 2016, 5:39 a.m.
Message ID <3a3691cccd62741a2f86.1466141962@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/15532/
State Rejected
Headers show

Comments

via Mercurial-devel - June 17, 2016, 5:39 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1466141846 25200
#      Thu Jun 16 22:37:26 2016 -0700
# Node ID 3a3691cccd62741a2f8680a0659925a32e2187fe
# Parent  a4de197218cf11de51b2a73c774be6ebaeba337a
evolve: use hashlib.sha1() directly

Since hg core commit c27dc3c31222 (util: drop local aliases for md5,
sha1, sha256, and sha512, 2016-06-10), we can no longer use
util.sha1().
Martijn Pieters - June 17, 2016, 9:18 a.m.
On 17 June 2016 at 06:39, Martin von Zweigbergk via Mercurial-devel
<mercurial-devel@mercurial-scm.org> wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1466141846 25200
> #      Thu Jun 16 22:37:26 2016 -0700
> # Node ID 3a3691cccd62741a2f8680a0659925a32e2187fe
> # Parent  a4de197218cf11de51b2a73c774be6ebaeba337a
> evolve: use hashlib.sha1() directly
>
> Since hg core commit c27dc3c31222 (util: drop local aliases for md5,
> sha1, sha256, and sha512, 2016-06-10), we can no longer use
> util.sha1().

Jeroen Vaelen sent the exact same patch 2 days ago:
https://patchwork.mercurial-scm.org/patch/15526/

> diff -r a4de197218cf -r 3a3691cccd62 hgext/evolve.py
> --- a/hgext/evolve.py   Fri May 27 17:36:07 2016 +0200
> +++ b/hgext/evolve.py   Thu Jun 16 22:37:26 2016 -0700
> @@ -71,6 +71,7 @@
>  import collections
>  import socket
>  import errno
> +import hashlib
>  import struct
>  sha1re = re.compile(r'\b[0-9a-f]{6,40}\b')
>
> @@ -3859,7 +3860,7 @@
>      for i in unfi:
>          ctx = unfi[i]
>          entry = 0
> -        sha = util.sha1()
> +        sha = hashlib.sha1()
>          # add data from p1
>          for p in ctx.parents():
>              p = p.rev()
> diff -r a4de197218cf -r 3a3691cccd62 hgext/simple4server.py
> --- a/hgext/simple4server.py    Fri May 27 17:36:07 2016 +0200
> +++ b/hgext/simple4server.py    Thu Jun 16 22:37:26 2016 -0700
> @@ -13,6 +13,7 @@
>
>  import mercurial.obsolete
>
> +import hashlib
>  import struct
>  from mercurial import util
>  from mercurial import wireproto
> @@ -192,7 +193,7 @@
>      for i in unfi:
>          ctx = unfi[i]
>          entry = 0
> -        sha = util.sha1()
> +        sha = hashlib.sha1()
>          # add data from p1
>          for p in ctx.parents():
>              p = p.rev()
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
via Mercurial-devel - June 17, 2016, 3:35 p.m.
Oh, I should clearly have checked first. I've marked mine as
"Superseded" in patchwork. Thanks.

On Fri, Jun 17, 2016 at 2:18 AM, Martijn Pieters <mj@zopatista.com> wrote:
> On 17 June 2016 at 06:39, Martin von Zweigbergk via Mercurial-devel
> <mercurial-devel@mercurial-scm.org> wrote:
>> # HG changeset patch
>> # User Martin von Zweigbergk <martinvonz@google.com>
>> # Date 1466141846 25200
>> #      Thu Jun 16 22:37:26 2016 -0700
>> # Node ID 3a3691cccd62741a2f8680a0659925a32e2187fe
>> # Parent  a4de197218cf11de51b2a73c774be6ebaeba337a
>> evolve: use hashlib.sha1() directly
>>
>> Since hg core commit c27dc3c31222 (util: drop local aliases for md5,
>> sha1, sha256, and sha512, 2016-06-10), we can no longer use
>> util.sha1().
>
> Jeroen Vaelen sent the exact same patch 2 days ago:
> https://patchwork.mercurial-scm.org/patch/15526/
>
>> diff -r a4de197218cf -r 3a3691cccd62 hgext/evolve.py
>> --- a/hgext/evolve.py   Fri May 27 17:36:07 2016 +0200
>> +++ b/hgext/evolve.py   Thu Jun 16 22:37:26 2016 -0700
>> @@ -71,6 +71,7 @@
>>  import collections
>>  import socket
>>  import errno
>> +import hashlib
>>  import struct
>>  sha1re = re.compile(r'\b[0-9a-f]{6,40}\b')
>>
>> @@ -3859,7 +3860,7 @@
>>      for i in unfi:
>>          ctx = unfi[i]
>>          entry = 0
>> -        sha = util.sha1()
>> +        sha = hashlib.sha1()
>>          # add data from p1
>>          for p in ctx.parents():
>>              p = p.rev()
>> diff -r a4de197218cf -r 3a3691cccd62 hgext/simple4server.py
>> --- a/hgext/simple4server.py    Fri May 27 17:36:07 2016 +0200
>> +++ b/hgext/simple4server.py    Thu Jun 16 22:37:26 2016 -0700
>> @@ -13,6 +13,7 @@
>>
>>  import mercurial.obsolete
>>
>> +import hashlib
>>  import struct
>>  from mercurial import util
>>  from mercurial import wireproto
>> @@ -192,7 +193,7 @@
>>      for i in unfi:
>>          ctx = unfi[i]
>>          entry = 0
>> -        sha = util.sha1()
>> +        sha = hashlib.sha1()
>>          # add data from p1
>>          for p in ctx.parents():
>>              p = p.rev()
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel@mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
>
>
> --
> Martijn Pieters

Patch

diff -r a4de197218cf -r 3a3691cccd62 hgext/evolve.py
--- a/hgext/evolve.py	Fri May 27 17:36:07 2016 +0200
+++ b/hgext/evolve.py	Thu Jun 16 22:37:26 2016 -0700
@@ -71,6 +71,7 @@ 
 import collections
 import socket
 import errno
+import hashlib
 import struct
 sha1re = re.compile(r'\b[0-9a-f]{6,40}\b')
 
@@ -3859,7 +3860,7 @@ 
     for i in unfi:
         ctx = unfi[i]
         entry = 0
-        sha = util.sha1()
+        sha = hashlib.sha1()
         # add data from p1
         for p in ctx.parents():
             p = p.rev()
diff -r a4de197218cf -r 3a3691cccd62 hgext/simple4server.py
--- a/hgext/simple4server.py	Fri May 27 17:36:07 2016 +0200
+++ b/hgext/simple4server.py	Thu Jun 16 22:37:26 2016 -0700
@@ -13,6 +13,7 @@ 
 
 import mercurial.obsolete
 
+import hashlib
 import struct
 from mercurial import util
 from mercurial import wireproto
@@ -192,7 +193,7 @@ 
     for i in unfi:
         ctx = unfi[i]
         entry = 0
-        sha = util.sha1()
+        sha = hashlib.sha1()
         # add data from p1
         for p in ctx.parents():
             p = p.rev()