comparison mercurial/commands.py @ 17126:8fa8717b47b6

obsolete: write obsolete marker inside a transaction Marker are now written as soon as possible but within a transaction. Using a transaction ensure a proper behavior on error and rollback compatibility. Flush logic are not necessary anymore and are dropped from lock release. With this changeset, the obsstore is open, written and closed for every single added marker. This is expected to be highly inefficient and batched write should be implemented "quickly". Another issue is that every flush of the file will invalidate the obsstore filecache and trigger a full re instantiation of the repo.obsstore attribute (including, reading and parsing entry). This is also expected to be highly inefficient and proper filecache operation should be implemented "quickly" too. A side benefit of the filecache issue is that repo.obsstore object is properly invalidated on transaction abortion.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 04 Jul 2012 02:21:04 +0200
parents 8e030168b09e
children f7152a0d90df
comparison
equal deleted inserted replaced
17125:95d785ccb4e5 17126:8fa8717b47b6
2059 metadata['date'] = opts['date'] 2059 metadata['date'] = opts['date']
2060 metadata['user'] = opts['user'] or ui.username() 2060 metadata['user'] = opts['user'] or ui.username()
2061 succs = tuple(bin(succ) for succ in successors) 2061 succs = tuple(bin(succ) for succ in successors)
2062 l = repo.lock() 2062 l = repo.lock()
2063 try: 2063 try:
2064 repo.obsstore.create(bin(precursor), succs, 0, metadata) 2064 tr = repo.transaction('debugobsolete')
2065 try:
2066 repo.obsstore.create(tr, bin(precursor), succs, 0, metadata)
2067 tr.close()
2068 finally:
2069 tr.release()
2065 finally: 2070 finally:
2066 l.release() 2071 l.release()
2067 else: 2072 else:
2068 for m in obsolete.allmarkers(repo): 2073 for m in obsolete.allmarkers(repo):
2069 ui.write(hex(m.precnode())) 2074 ui.write(hex(m.precnode()))