##// END OF EJS Templates
shelve: rewrite check for unknown shelf to delete...
Martin von Zweigbergk -
r46988:161313f9 default
parent child Browse files
Show More
@@ -600,20 +600,12 b' def deletecmd(ui, repo, pats):'
600 raise error.Abort(_(b'no shelved changes specified!'))
600 raise error.Abort(_(b'no shelved changes specified!'))
601 with repo.wlock():
601 with repo.wlock():
602 for name in pats:
602 for name in pats:
603 try:
603 if not shelvedfile(repo, name, patchextension).exists():
604 for suffix in shelvefileextensions:
605 shfile = shelvedfile(repo, name, suffix)
606 # patch file is necessary, as it should
607 # be present for any kind of shelve,
608 # but the .hg file is optional as in future we
609 # will add obsolete shelve with does not create a
610 # bundle
611 if shfile.exists() or suffix == patchextension:
612 shfile.movetobackup()
613 except OSError as err:
614 if err.errno != errno.ENOENT:
615 raise
616 raise error.Abort(_(b"shelved change '%s' not found") % name)
604 raise error.Abort(_(b"shelved change '%s' not found") % name)
605 for suffix in shelvefileextensions:
606 shfile = shelvedfile(repo, name, suffix)
607 if shfile.exists():
608 shfile.movetobackup()
617 cleanupoldbackups(repo)
609 cleanupoldbackups(repo)
618
610
619
611
@@ -776,8 +776,8 b' Test corrupt shelves (in .hg/shelved/, n'
776 $ find .hg/shelve* | sort
776 $ find .hg/shelve* | sort
777 .hg/shelve-backup
777 .hg/shelve-backup
778 .hg/shelve-backup/junk1.patch
778 .hg/shelve-backup/junk1.patch
779 .hg/shelve-backup/junk2.hg
780 .hg/shelved
779 .hg/shelved
780 .hg/shelved/junk2.hg
781
781
782 # A file with an unexpected extension
782 # A file with an unexpected extension
783 $ touch .hg/shelved/junk3
783 $ touch .hg/shelved/junk3
@@ -791,8 +791,8 b' Test corrupt shelves (in .hg/shelved/, n'
791 $ find .hg/shelve* | sort
791 $ find .hg/shelve* | sort
792 .hg/shelve-backup
792 .hg/shelve-backup
793 .hg/shelve-backup/junk1.patch
793 .hg/shelve-backup/junk1.patch
794 .hg/shelve-backup/junk2.hg
795 .hg/shelved
794 .hg/shelved
795 .hg/shelved/junk2.hg
796 .hg/shelved/junk3
796 .hg/shelved/junk3
797
797
798 $ cd ..
798 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now