comparison hgext/largefiles/lfcommands.py @ 29341:0d83ad967bf8

cleanup: replace uses of util.(md5|sha1|sha256|sha512) with hashlib.\1 All versions of Python we support or hope to support make the hash functions available in the same way under the same name, so we may as well drop the util forwards.
author Augie Fackler <raf@durin42.com>
date Fri, 10 Jun 2016 00:12:33 -0400
parents 5ec25534ef4f
children 85868ecf2c0d
comparison
equal deleted inserted replaced
29340:ae92c3eee88e 29341:0d83ad967bf8
8 8
9 '''High-level command function for lfconvert, plus the cmdtable.''' 9 '''High-level command function for lfconvert, plus the cmdtable.'''
10 from __future__ import absolute_import 10 from __future__ import absolute_import
11 11
12 import errno 12 import errno
13 import hashlib
13 import os 14 import os
14 import shutil 15 import shutil
15 16
16 from mercurial.i18n import _ 17 from mercurial.i18n import _
17 18
227 renamed = fctx.renamed() 228 renamed = fctx.renamed()
228 if renamed and renamed[0] in lfiles: 229 if renamed and renamed[0] in lfiles:
229 raise error.Abort(_('largefile %s becomes symlink') % f) 230 raise error.Abort(_('largefile %s becomes symlink') % f)
230 231
231 # largefile was modified, update standins 232 # largefile was modified, update standins
232 m = util.sha1('') 233 m = hashlib.sha1('')
233 m.update(ctx[f].data()) 234 m.update(ctx[f].data())
234 hash = m.hexdigest() 235 hash = m.hexdigest()
235 if f not in lfiletohash or lfiletohash[f] != hash: 236 if f not in lfiletohash or lfiletohash[f] != hash:
236 rdst.wwrite(f, ctx[f].data(), ctx[f].flags()) 237 rdst.wwrite(f, ctx[f].data(), ctx[f].flags())
237 executable = 'x' in ctx[f].flags() 238 executable = 'x' in ctx[f].flags()