comparison mercurial/merge.py @ 6517:fcfb6a0a0a84

python-2.6: use sha wrapper from util for new merge code
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Fri, 11 Apr 2008 12:04:26 +0200
parents 368a4ec603cc
children 92ccccb55ba3
comparison
equal deleted inserted replaced
6516:7a6243bf209d 6517:fcfb6a0a0a84
5 # This software may be used and distributed according to the terms 5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference. 6 # of the GNU General Public License, incorporated herein by reference.
7 7
8 from node import nullid, nullrev, hex 8 from node import nullid, nullrev, hex
9 from i18n import _ 9 from i18n import _
10 import errno, util, os, filemerge, copies, sha, shutil 10 import errno, util, os, filemerge, copies, shutil
11 11
12 class mergestate(object): 12 class mergestate(object):
13 '''track 3-way merge state of individual files''' 13 '''track 3-way merge state of individual files'''
14 def __init__(self, repo): 14 def __init__(self, repo):
15 self._repo = repo 15 self._repo = repo
17 self._data = {} 17 self._data = {}
18 def reset(self, node): 18 def reset(self, node):
19 self._local = node 19 self._local = node
20 shutil.rmtree(self._repo.join("merge"), True) 20 shutil.rmtree(self._repo.join("merge"), True)
21 def add(self, fcl, fco, fca, fd, flags): 21 def add(self, fcl, fco, fca, fd, flags):
22 hash = sha.sha(fcl.path()).hexdigest() 22 hash = util.sha1(fcl.path()).hexdigest()
23 self._repo.opener("merge/" + hash, "w").write(fcl.data()) 23 self._repo.opener("merge/" + hash, "w").write(fcl.data())
24 self._state[fd] = 'u' 24 self._state[fd] = 'u'
25 self._data[fd] = (hash, fcl.path(), fca.path(), hex(fca.filenode()), 25 self._data[fd] = (hash, fcl.path(), fca.path(), hex(fca.filenode()),
26 fco.path(), flags) 26 fco.path(), flags)
27 def __contains__(self, dfile): 27 def __contains__(self, dfile):