Show More
@@ -62,6 +62,7 b" testedwith = 'ships-with-hg-core'" | |||||
62 |
|
62 | |||
63 | backupdir = 'shelve-backup' |
|
63 | backupdir = 'shelve-backup' | |
64 | shelvedir = 'shelved' |
|
64 | shelvedir = 'shelved' | |
|
65 | shelvefileextensions = ['hg', 'patch'] | |||
65 |
|
66 | |||
66 | class shelvedfile(object): |
|
67 | class shelvedfile(object): | |
67 | """Helper for the file storing a single shelve |
|
68 | """Helper for the file storing a single shelve | |
@@ -221,7 +222,7 b' def cleanupoldbackups(repo):' | |||||
221 | # keep it, because timestamp can't decide exact order of backups |
|
222 | # keep it, because timestamp can't decide exact order of backups | |
222 | continue |
|
223 | continue | |
223 | base = f[:-3] |
|
224 | base = f[:-3] | |
224 |
for ext in |
|
225 | for ext in shelvefileextensions: | |
225 | try: |
|
226 | try: | |
226 | vfs.unlink(base + '.' + ext) |
|
227 | vfs.unlink(base + '.' + ext) | |
227 | except OSError as err: |
|
228 | except OSError as err: | |
@@ -399,7 +400,7 b' def cleanupcmd(ui, repo):' | |||||
399 | with repo.wlock(): |
|
400 | with repo.wlock(): | |
400 | for (name, _type) in repo.vfs.readdir(shelvedir): |
|
401 | for (name, _type) in repo.vfs.readdir(shelvedir): | |
401 | suffix = name.rsplit('.', 1)[-1] |
|
402 | suffix = name.rsplit('.', 1)[-1] | |
402 |
if suffix in |
|
403 | if suffix in shelvefileextensions: | |
403 | shelvedfile(repo, name).movetobackup() |
|
404 | shelvedfile(repo, name).movetobackup() | |
404 | cleanupoldbackups(repo) |
|
405 | cleanupoldbackups(repo) | |
405 |
|
406 | |||
@@ -410,8 +411,15 b' def deletecmd(ui, repo, pats):' | |||||
410 | with repo.wlock(): |
|
411 | with repo.wlock(): | |
411 | try: |
|
412 | try: | |
412 | for name in pats: |
|
413 | for name in pats: | |
413 |
for suffix in |
|
414 | for suffix in shelvefileextensions: | |
414 |
shelvedfile(repo, name, suffix) |
|
415 | shfile = shelvedfile(repo, name, suffix) | |
|
416 | # patch file is necessary, as it should | |||
|
417 | # be present for any kind of shelve, | |||
|
418 | # but the .hg file is optional as in future we | |||
|
419 | # will add obsolete shelve with does not create a | |||
|
420 | # bundle | |||
|
421 | if shfile.exists() or suffix == 'patch': | |||
|
422 | shfile.movetobackup() | |||
415 | cleanupoldbackups(repo) |
|
423 | cleanupoldbackups(repo) | |
416 | except OSError as err: |
|
424 | except OSError as err: | |
417 | if err.errno != errno.ENOENT: |
|
425 | if err.errno != errno.ENOENT: | |
@@ -557,8 +565,10 b' def restorebranch(ui, repo, branchtorest' | |||||
557 | def unshelvecleanup(ui, repo, name, opts): |
|
565 | def unshelvecleanup(ui, repo, name, opts): | |
558 | """remove related files after an unshelve""" |
|
566 | """remove related files after an unshelve""" | |
559 | if not opts.get('keep'): |
|
567 | if not opts.get('keep'): | |
560 |
for filetype in |
|
568 | for filetype in shelvefileextensions: | |
561 |
shelvedfile(repo, name, filetype) |
|
569 | shfile = shelvedfile(repo, name, filetype) | |
|
570 | if shfile.exists(): | |||
|
571 | shfile.movetobackup() | |||
562 | cleanupoldbackups(repo) |
|
572 | cleanupoldbackups(repo) | |
563 |
|
573 | |||
564 | def unshelvecontinue(ui, repo, state, opts): |
|
574 | def unshelvecontinue(ui, repo, state, opts): |
General Comments 0
You need to be logged in to leave comments.
Login now