comparison hgext/obsolete.py @ 341:7653f80fd7a4 stable

obsolete: harden convertion from first format
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Fri, 06 Jul 2012 17:15:30 +0200
parents 37b543215187
children 9bbcd2746898
comparison
equal deleted inserted replaced
340:37b543215187 341:7653f80fd7a4
587 sucs = (suc==nullid) and [] or [suc] 587 sucs = (suc==nullid) and [] or [suc]
588 meta = { 588 meta = {
589 'date': '%i %i' % util.makedate(), 589 'date': '%i %i' % util.makedate(),
590 'user': ui.username(), 590 'user': ui.username(),
591 } 591 }
592 store.create(prec, sucs, 0, meta) 592 try:
593 cnt += 1 593 store.create(prec, sucs, 0, meta)
594 cnt += 1
595 except ValueError:
596 repo.ui.write_err("invalid old marker line: %s"
597 % (line))
598 err += 1
594 finally: 599 finally:
595 f.close() 600 f.close()
596 util.unlink(repo.join('obsolete-relations')) 601 util.unlink(repo.join('obsolete-relations'))
597 except IOError: 602 except IOError:
598 pass 603 pass
621 meta = dict((k.encode('utf-8'), v.encode('utf-8')) 626 meta = dict((k.encode('utf-8'), v.encode('utf-8'))
622 for k, v in oldmark.iteritems()) 627 for k, v in oldmark.iteritems())
623 try: 628 try:
624 store.create(bin(oldobject), [bin(n) for n in oldsubjects], 629 store.create(bin(oldobject), [bin(n) for n in oldsubjects],
625 0, meta) 630 0, meta)
631 cnt += 1
626 except ValueError: 632 except ValueError:
627 repo.ui.write_err("invalid marker %s -> %s\n" 633 repo.ui.write_err("invalid marker %s -> %s\n"
628 % (oldobject, oldsubjects)) 634 % (oldobject, oldsubjects))
629 err += 1 635 err += 1
630 cnt += 1
631 util.unlink(repo.sjoin('obsoletemarkers')) 636 util.unlink(repo.sjoin('obsoletemarkers'))
632 finally: 637 finally:
633 del repo._importoldobsolete 638 del repo._importoldobsolete
634 l.release() 639 l.release()
635 if not some: 640 if not some: