equal
deleted
inserted
replaced
3337 ''' |
3337 ''' |
3338 |
3338 |
3339 def __init__(self, repo, name): |
3339 def __init__(self, repo, name): |
3340 self._repo = repo |
3340 self._repo = repo |
3341 self._suffix = '.backup.%s.%d' % (name, id(self)) |
3341 self._suffix = '.backup.%s.%d' % (name, id(self)) |
3342 repo.dirstate._savebackup(repo, self._suffix) |
3342 repo.dirstate._savebackup(repo.currenttransaction(), self._suffix) |
3343 self._active = True |
3343 self._active = True |
3344 self._closed = False |
3344 self._closed = False |
3345 |
3345 |
3346 def __del__(self): |
3346 def __del__(self): |
3347 if self._active: # still active |
3347 if self._active: # still active |
3355 if not self._active: # already inactivated |
3355 if not self._active: # already inactivated |
3356 msg = (_("can't close already inactivated backup: dirstate%s") |
3356 msg = (_("can't close already inactivated backup: dirstate%s") |
3357 % self._suffix) |
3357 % self._suffix) |
3358 raise error.Abort(msg) |
3358 raise error.Abort(msg) |
3359 |
3359 |
3360 self._repo.dirstate._clearbackup(self._repo, self._suffix) |
3360 self._repo.dirstate._clearbackup(self._repo.currenttransaction(), |
|
3361 self._suffix) |
3361 self._active = False |
3362 self._active = False |
3362 self._closed = True |
3363 self._closed = True |
3363 |
3364 |
3364 def _abort(self): |
3365 def _abort(self): |
3365 self._repo.dirstate._restorebackup(self._repo, self._suffix) |
3366 self._repo.dirstate._restorebackup(self._repo.currenttransaction(), |
|
3367 self._suffix) |
3366 self._active = False |
3368 self._active = False |
3367 |
3369 |
3368 def release(self): |
3370 def release(self): |
3369 if not self._closed: |
3371 if not self._closed: |
3370 if not self._active: # already inactivated |
3372 if not self._active: # already inactivated |