mercurial/patch.py
changeset 6470 ac0bcd951c2c
parent 6467 65029a3aafc2
child 6531 c2c4fa9af016
equal deleted inserted replaced
6469:fb502719c75c 6470:ac0bcd951c2c
     7 # of the GNU General Public License, incorporated herein by reference.
     7 # of the GNU General Public License, incorporated herein by reference.
     8 
     8 
     9 from i18n import _
     9 from i18n import _
    10 from node import hex, nullid, short
    10 from node import hex, nullid, short
    11 import base85, cmdutil, mdiff, util, context, revlog, diffhelpers, copies
    11 import base85, cmdutil, mdiff, util, context, revlog, diffhelpers, copies
    12 import cStringIO, email.Parser, os, popen2, re, sha, errno
    12 import cStringIO, email.Parser, os, popen2, re, errno
    13 import sys, tempfile, zlib
    13 import sys, tempfile, zlib
    14 
    14 
    15 class PatchError(Exception):
    15 class PatchError(Exception):
    16     pass
    16     pass
    17 
    17 
  1118     '''print base85-encoded binary diff'''
  1118     '''print base85-encoded binary diff'''
  1119     def gitindex(text):
  1119     def gitindex(text):
  1120         if not text:
  1120         if not text:
  1121             return '0' * 40
  1121             return '0' * 40
  1122         l = len(text)
  1122         l = len(text)
  1123         s = sha.new('blob %d\0' % l)
  1123         s = util.sha1('blob %d\0' % l)
  1124         s.update(text)
  1124         s.update(text)
  1125         return s.hexdigest()
  1125         return s.hexdigest()
  1126 
  1126 
  1127     def fmtline(line):
  1127     def fmtline(line):
  1128         l = len(line)
  1128         l = len(line)