Mercurial > hg
changeset 28862:39130afcce60
shelve: refactor directory name into constant
Shelve directory name extracted into constant to avoid typos/duplication.
author | Oleg Afanasyev <olegaf@fb.com> |
---|---|
date | Fri, 08 Apr 2016 23:33:28 -0700 |
parents | 86db5cb55d46 |
children | 6e06fbee9244 |
files | hgext/shelve.py |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/shelve.py Sun Apr 10 20:55:37 2016 +0000 +++ b/hgext/shelve.py Fri Apr 08 23:33:28 2016 -0700 @@ -60,6 +60,7 @@ testedwith = 'internal' backupdir = 'shelve-backup' +shelvedir = 'shelved' class shelvedfile(object): """Helper for the file storing a single shelve @@ -69,7 +70,7 @@ def __init__(self, repo, name, filetype=None): self.repo = repo self.name = name - self.vfs = scmutil.vfs(repo.join('shelved')) + self.vfs = scmutil.vfs(repo.join(shelvedir)) self.backupvfs = scmutil.vfs(repo.join(backupdir)) self.ui = self.repo.ui if filetype: @@ -408,7 +409,7 @@ """subcommand that deletes all shelves""" with repo.wlock(): - for (name, _type) in repo.vfs.readdir('shelved'): + for (name, _type) in repo.vfs.readdir(shelvedir): suffix = name.rsplit('.', 1)[-1] if suffix in ('hg', 'patch'): shelvedfile(repo, name).movetobackup() @@ -432,7 +433,7 @@ def listshelves(repo): """return all shelves in repo as list of (time, filename)""" try: - names = repo.vfs.readdir('shelved') + names = repo.vfs.readdir(shelvedir) except OSError as err: if err.errno != errno.ENOENT: raise