mercurial/revlog.py
changeset 1981 736b6c96bbbc
parent 1941 7518823709a2
child 2002 4aab906517c6
equal deleted inserted replaced
1980:dfb796786337 1981:736b6c96bbbc
    11 """
    11 """
    12 
    12 
    13 from node import *
    13 from node import *
    14 from i18n import gettext as _
    14 from i18n import gettext as _
    15 from demandload import demandload
    15 from demandload import demandload
    16 demandload(globals(), "binascii errno heapq mdiff os sha struct zlib")
    16 demandload(globals(), "binascii changegroup errno heapq mdiff os")
       
    17 demandload(globals(), "sha struct zlib")
    17 
    18 
    18 def hash(text, p1, p2):
    19 def hash(text, p1, p2):
    19     """generate a hash from the given text and its parent hashes
    20     """generate a hash from the given text and its parent hashes
    20 
    21 
    21     This hash combines both the current file contents and its history
    22     This hash combines both the current file contents and its history
   706         """
   707         """
   707         revs = [self.rev(n) for n in nodelist]
   708         revs = [self.rev(n) for n in nodelist]
   708 
   709 
   709         # if we don't have any revisions touched by these changesets, bail
   710         # if we don't have any revisions touched by these changesets, bail
   710         if not revs:
   711         if not revs:
   711             yield struct.pack(">l", 0)
   712             yield changegroup.closechunk()
   712             return
   713             return
   713 
   714 
   714         # add the parent of the first rev
   715         # add the parent of the first rev
   715         p = self.parents(self.node(revs[0]))[0]
   716         p = self.parents(self.node(revs[0]))[0]
   716         revs.insert(0, self.rev(p))
   717         revs.insert(0, self.rev(p))
   724                 infocollect(nb)
   725                 infocollect(nb)
   725 
   726 
   726             d = self.revdiff(a, b)
   727             d = self.revdiff(a, b)
   727             p = self.parents(nb)
   728             p = self.parents(nb)
   728             meta = nb + p[0] + p[1] + lookup(nb)
   729             meta = nb + p[0] + p[1] + lookup(nb)
   729             l = struct.pack(">l", len(meta) + len(d) + 4)
   730             yield changegroup.genchunk("%s%s" % (meta, d))
   730             yield l
   731 
   731             yield meta
   732         yield changegroup.closechunk()
   732             yield d
       
   733 
       
   734         yield struct.pack(">l", 0)
       
   735 
   733 
   736     def addgroup(self, revs, linkmapper, transaction, unique=0):
   734     def addgroup(self, revs, linkmapper, transaction, unique=0):
   737         """
   735         """
   738         add a delta group
   736         add a delta group
   739 
   737