Patchwork [evolve-ext] evolve: use hashlib to compute sha1 hashes

login
register
mail settings
Submitter Jeroen Vaelen
Date June 15, 2016, 10:26 p.m.
Message ID <458efaad64dff4c58225.1466029578@dev879.lla1.facebook.com>
Download mbox | patch
Permalink /patch/15526/
State Accepted
Headers show

Comments

Jeroen Vaelen - June 15, 2016, 10:26 p.m.
# HG changeset patch
# User Jeroen Vaelen <jeroen@fb.com>
# Date 1466029178 25200
#      Wed Jun 15 15:19:38 2016 -0700
# Node ID 458efaad64dff4c58225e8674c81212d1a225acd
# Parent  9e2d27a7782601700f1783fc683dee5660ef9a8f
evolve: use hashlib to compute sha1 hashes

The util alias for sha1 was dropped in c27dc3c3122 in favor of hashlib.
Matt Mackall - June 15, 2016, 10:31 p.m.
On Wed, 2016-06-15 at 15:26 -0700, Jeroen Vaelen wrote:
> # HG changeset patch
> # User Jeroen Vaelen <jeroen@fb.com>
> # Date 1466029178 25200
> #      Wed Jun 15 15:19:38 2016 -0700
> # Node ID 458efaad64dff4c58225e8674c81212d1a225acd
> # Parent  9e2d27a7782601700f1783fc683dee5660ef9a8f
> evolve: use hashlib to compute sha1 hashes
> 
> The util alias for sha1 was dropped in c27dc3c3122 in favor of hashlib.

LGTM.

-- 
Mathematics is the supreme nostalgia of our time.
Pierre-Yves David - June 17, 2016, 3:54 p.m.
Pushed to evolve main thanks!

On 06/16/2016 12:31 AM, Matt Mackall wrote:
> On Wed, 2016-06-15 at 15:26 -0700, Jeroen Vaelen wrote:
>> # HG changeset patch
>> # User Jeroen Vaelen <jeroen@fb.com>
>> # Date 1466029178 25200
>> #      Wed Jun 15 15:19:38 2016 -0700
>> # Node ID 458efaad64dff4c58225e8674c81212d1a225acd
>> # Parent  9e2d27a7782601700f1783fc683dee5660ef9a8f
>> evolve: use hashlib to compute sha1 hashes
>>
>> The util alias for sha1 was dropped in c27dc3c3122 in favor of hashlib.
> 
> LGTM.
> 
> -- 
> Mathematics is the supreme nostalgia of our time.
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -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')
 
@@ -3860,7 +3861,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 --git a/hgext/simple4server.py b/hgext/simple4server.py
--- a/hgext/simple4server.py
+++ b/hgext/simple4server.py
@@ -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()