Show More
@@ -37,7 +37,7 b' class dirstateguard(util.transactional):' | |||||
37 | self._narrowspecbackupname = ('narrowspec.backup.%s.%d' % |
|
37 | self._narrowspecbackupname = ('narrowspec.backup.%s.%d' % | |
38 | (name, id(self))) |
|
38 | (name, id(self))) | |
39 | repo.dirstate.savebackup(repo.currenttransaction(), self._backupname) |
|
39 | repo.dirstate.savebackup(repo.currenttransaction(), self._backupname) | |
40 | narrowspec.savebackup(repo, self._narrowspecbackupname) |
|
40 | narrowspec.savewcbackup(repo, self._narrowspecbackupname) | |
41 | self._active = True |
|
41 | self._active = True | |
42 |
|
42 | |||
43 | def __del__(self): |
|
43 | def __del__(self): | |
@@ -56,12 +56,12 b' class dirstateguard(util.transactional):' | |||||
56 |
|
56 | |||
57 | self._repo.dirstate.clearbackup(self._repo.currenttransaction(), |
|
57 | self._repo.dirstate.clearbackup(self._repo.currenttransaction(), | |
58 | self._backupname) |
|
58 | self._backupname) | |
59 | narrowspec.clearbackup(self._repo, self._narrowspecbackupname) |
|
59 | narrowspec.clearwcbackup(self._repo, self._narrowspecbackupname) | |
60 | self._active = False |
|
60 | self._active = False | |
61 | self._closed = True |
|
61 | self._closed = True | |
62 |
|
62 | |||
63 | def _abort(self): |
|
63 | def _abort(self): | |
64 | narrowspec.restorebackup(self._repo, self._narrowspecbackupname) |
|
64 | narrowspec.restorewcbackup(self._repo, self._narrowspecbackupname) | |
65 | self._repo.dirstate.restorebackup(self._repo.currenttransaction(), |
|
65 | self._repo.dirstate.restorebackup(self._repo.currenttransaction(), | |
66 | self._backupname) |
|
66 | self._backupname) | |
67 | self._active = False |
|
67 | self._active = False |
@@ -185,10 +185,25 b' def restorebackup(repo, backupname):' | |||||
185 | return |
|
185 | return | |
186 | util.rename(repo.svfs.join(backupname), repo.svfs.join(FILENAME)) |
|
186 | util.rename(repo.svfs.join(backupname), repo.svfs.join(FILENAME)) | |
187 |
|
187 | |||
188 |
def c |
|
188 | def savewcbackup(repo, backupname): | |
189 | if repository.NARROW_REQUIREMENT not in repo.requirements: |
|
189 | if repository.NARROW_REQUIREMENT not in repo.requirements: | |
190 | return |
|
190 | return | |
191 | repo.svfs.unlink(backupname) |
|
191 | vfs = repo.vfs | |
|
192 | vfs.tryunlink(backupname) | |||
|
193 | # It may not exist in old repos | |||
|
194 | if vfs.exists(DIRSTATE_FILENAME): | |||
|
195 | util.copyfile(vfs.join(DIRSTATE_FILENAME), vfs.join(backupname), | |||
|
196 | hardlink=True) | |||
|
197 | ||||
|
198 | def restorewcbackup(repo, backupname): | |||
|
199 | if repository.NARROW_REQUIREMENT not in repo.requirements: | |||
|
200 | return | |||
|
201 | util.rename(repo.vfs.join(backupname), repo.vfs.join(DIRSTATE_FILENAME)) | |||
|
202 | ||||
|
203 | def clearwcbackup(repo, backupname): | |||
|
204 | if repository.NARROW_REQUIREMENT not in repo.requirements: | |||
|
205 | return | |||
|
206 | repo.vfs.unlink(backupname) | |||
192 |
|
207 | |||
193 | def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes): |
|
208 | def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes): | |
194 | r""" Restricts the patterns according to repo settings, |
|
209 | r""" Restricts the patterns according to repo settings, |
General Comments 0
You need to be logged in to leave comments.
Login now