mercurial/revlog.py
changeset 224 ccbcc4d76f81
parent 221 2bfe525ef6ca
child 237 4f802588cdfb
child 237 4f802588cdfb
child 241 afe895fcc0d0
equal deleted inserted replaced
223:1aaa49039a6b 224:ccbcc4d76f81
   431             yield meta
   431             yield meta
   432             yield d
   432             yield d
   433 
   433 
   434         yield struct.pack(">l", 0)
   434         yield struct.pack(">l", 0)
   435 
   435 
   436     def addgroup(self, revs, linkmapper, transaction):
   436     def addgroup(self, revs, linkmapper, transaction, unique = 0):
   437         # given a set of deltas, add them to the revision log. the
   437         # given a set of deltas, add them to the revision log. the
   438         # first delta is against its parent, which should be in our
   438         # first delta is against its parent, which should be in our
   439         # log, the rest are against the previous delta.
   439         # log, the rest are against the previous delta.
   440 
   440 
   441         # track the base of the current delta log
   441         # track the base of the current delta log
   461         chain = None
   461         chain = None
   462         for chunk in revs:
   462         for chunk in revs:
   463             node, p1, p2, cs = struct.unpack("20s20s20s20s", chunk[:80])
   463             node, p1, p2, cs = struct.unpack("20s20s20s20s", chunk[:80])
   464             link = linkmapper(cs)
   464             link = linkmapper(cs)
   465             if node in self.nodemap:
   465             if node in self.nodemap:
   466                 raise "already have %s" % hex(node[:4])
   466                 # this can happen if two branches make the same change
       
   467                 if unique:
       
   468                     raise "already have %s" % hex(node[:4])
       
   469                 continue
   467             delta = chunk[80:]
   470             delta = chunk[80:]
   468 
   471 
   469             if not chain:
   472             if not chain:
   470                 # retrieve the parent revision of the delta chain
   473                 # retrieve the parent revision of the delta chain
   471                 chain = p1
   474                 chain = p1