Mercurial > hg
comparison hgext/mq.py @ 4970:30d4d8985dd8
transactions: avoid late tear-down (issue641)
We use weak references (ugh) to avoid having to manually delete
transaction references out of each call frame when an exception occurs.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 22 Jul 2007 14:53:57 -0500 |
parents | 126f527b3ba3 |
children | 7041869a1bf6 dd714452c26e |
comparison
equal
deleted
inserted
replaced
4969:b43db44cd047 | 4970:30d4d8985dd8 |
---|---|
440 try: | 440 try: |
441 wlock = repo.wlock() | 441 wlock = repo.wlock() |
442 lock = repo.lock() | 442 lock = repo.lock() |
443 tr = repo.transaction() | 443 tr = repo.transaction() |
444 try: | 444 try: |
445 ret = self._apply(tr, repo, series, list, update_status, | 445 ret = self._apply(repo, series, list, update_status, |
446 strict, patchdir, merge, all_files=all_files) | 446 strict, patchdir, merge, all_files=all_files) |
447 tr.close() | 447 tr.close() |
448 self.save_dirty() | 448 self.save_dirty() |
449 return ret | 449 return ret |
450 except: | 450 except: |
455 repo.dirstate.invalidate() | 455 repo.dirstate.invalidate() |
456 raise | 456 raise |
457 finally: | 457 finally: |
458 del lock, wlock, tr | 458 del lock, wlock, tr |
459 | 459 |
460 def _apply(self, tr, repo, series, list=False, update_status=True, | 460 def _apply(self, repo, series, list=False, update_status=True, |
461 strict=False, patchdir=None, merge=None, all_files={}): | 461 strict=False, patchdir=None, merge=None, all_files={}): |
462 # TODO unify with commands.py | 462 # TODO unify with commands.py |
463 if not patchdir: | 463 if not patchdir: |
464 patchdir = self.path | 464 patchdir = self.path |
465 err = 0 | 465 err = 0 |