Show More
@@ -226,28 +226,10 b' def cleanupoldbackups(repo):' | |||||
226 | def _aborttransaction(repo): |
|
226 | def _aborttransaction(repo): | |
227 | '''Abort current transaction for shelve/unshelve, but keep dirstate |
|
227 | '''Abort current transaction for shelve/unshelve, but keep dirstate | |
228 | ''' |
|
228 | ''' | |
229 | backupname = 'dirstate.shelve' |
|
229 | tr = repo.currenttransaction() | |
230 | dirstatebackup = None |
|
230 | repo.dirstate.savebackup(tr, suffix='.shelve') | |
231 | try: |
|
231 | tr.abort() | |
232 | # create backup of (un)shelved dirstate, because aborting transaction |
|
232 | repo.dirstate.restorebackup(None, suffix='.shelve') | |
233 | # should restore dirstate to one at the beginning of the |
|
|||
234 | # transaction, which doesn't include the result of (un)shelving |
|
|||
235 | fp = repo.vfs.open(backupname, "w") |
|
|||
236 | dirstatebackup = backupname |
|
|||
237 | # clearing _dirty/_dirtypl of dirstate by _writedirstate below |
|
|||
238 | # is unintentional. but it doesn't cause problem in this case, |
|
|||
239 | # because no code path refers them until transaction is aborted. |
|
|||
240 | repo.dirstate._writedirstate(fp) # write in-memory changes forcibly |
|
|||
241 |
|
||||
242 | tr = repo.currenttransaction() |
|
|||
243 | tr.abort() |
|
|||
244 |
|
||||
245 | # restore to backuped dirstate |
|
|||
246 | repo.vfs.rename(dirstatebackup, 'dirstate') |
|
|||
247 | dirstatebackup = None |
|
|||
248 | finally: |
|
|||
249 | if dirstatebackup: |
|
|||
250 | repo.vfs.unlink(dirstatebackup) |
|
|||
251 |
|
233 | |||
252 | def createcmd(ui, repo, pats, opts): |
|
234 | def createcmd(ui, repo, pats, opts): | |
253 | """subcommand that creates a new shelve""" |
|
235 | """subcommand that creates a new shelve""" |
General Comments 0
You need to be logged in to leave comments.
Login now