##// END OF EJS Templates
shelve: refactor directory name into constant...
Oleg Afanasyev -
r28862:39130afc default
parent child Browse files
Show More
@@ -60,6 +60,7 command = cmdutil.command(cmdtable)
60 60 testedwith = 'internal'
61 61
62 62 backupdir = 'shelve-backup'
63 shelvedir = 'shelved'
63 64
64 65 class shelvedfile(object):
65 66 """Helper for the file storing a single shelve
@@ -69,7 +70,7 class shelvedfile(object):
69 70 def __init__(self, repo, name, filetype=None):
70 71 self.repo = repo
71 72 self.name = name
72 self.vfs = scmutil.vfs(repo.join('shelved'))
73 self.vfs = scmutil.vfs(repo.join(shelvedir))
73 74 self.backupvfs = scmutil.vfs(repo.join(backupdir))
74 75 self.ui = self.repo.ui
75 76 if filetype:
@@ -408,7 +409,7 def cleanupcmd(ui, repo):
408 409 """subcommand that deletes all shelves"""
409 410
410 411 with repo.wlock():
411 for (name, _type) in repo.vfs.readdir('shelved'):
412 for (name, _type) in repo.vfs.readdir(shelvedir):
412 413 suffix = name.rsplit('.', 1)[-1]
413 414 if suffix in ('hg', 'patch'):
414 415 shelvedfile(repo, name).movetobackup()
@@ -432,7 +433,7 def deletecmd(ui, repo, pats):
432 433 def listshelves(repo):
433 434 """return all shelves in repo as list of (time, filename)"""
434 435 try:
435 names = repo.vfs.readdir('shelved')
436 names = repo.vfs.readdir(shelvedir)
436 437 except OSError as err:
437 438 if err.errno != errno.ENOENT:
438 439 raise
General Comments 0
You need to be logged in to leave comments. Login now