equal
deleted
inserted
replaced
32 |
32 |
33 def __init__(self, repo, name): |
33 def __init__(self, repo, name): |
34 self._repo = repo |
34 self._repo = repo |
35 self._active = False |
35 self._active = False |
36 self._closed = False |
36 self._closed = False |
37 self._backupname = 'dirstate.backup.%s.%d' % (name, id(self)) |
37 self._backupname = b'dirstate.backup.%s.%d' % (name, id(self)) |
38 self._narrowspecbackupname = 'narrowspec.backup.%s.%d' % ( |
38 self._narrowspecbackupname = b'narrowspec.backup.%s.%d' % ( |
39 name, |
39 name, |
40 id(self), |
40 id(self), |
41 ) |
41 ) |
42 repo.dirstate.savebackup(repo.currenttransaction(), self._backupname) |
42 repo.dirstate.savebackup(repo.currenttransaction(), self._backupname) |
43 narrowspec.savewcbackup(repo, self._narrowspecbackupname) |
43 narrowspec.savewcbackup(repo, self._narrowspecbackupname) |
52 self._abort() |
52 self._abort() |
53 |
53 |
54 def close(self): |
54 def close(self): |
55 if not self._active: # already inactivated |
55 if not self._active: # already inactivated |
56 msg = ( |
56 msg = ( |
57 _("can't close already inactivated backup: %s") |
57 _(b"can't close already inactivated backup: %s") |
58 % self._backupname |
58 % self._backupname |
59 ) |
59 ) |
60 raise error.Abort(msg) |
60 raise error.Abort(msg) |
61 |
61 |
62 self._repo.dirstate.clearbackup( |
62 self._repo.dirstate.clearbackup( |
75 |
75 |
76 def release(self): |
76 def release(self): |
77 if not self._closed: |
77 if not self._closed: |
78 if not self._active: # already inactivated |
78 if not self._active: # already inactivated |
79 msg = ( |
79 msg = ( |
80 _("can't release already inactivated backup: %s") |
80 _(b"can't release already inactivated backup: %s") |
81 % self._backupname |
81 % self._backupname |
82 ) |
82 ) |
83 raise error.Abort(msg) |
83 raise error.Abort(msg) |
84 self._abort() |
84 self._abort() |