Mercurial > hg-stable
comparison mercurial/shelve.py @ 46282:0a69f9e640ec
shelve: inline shelvedfile.filename() since there are no callers outside class
Differential Revision: https://phab.mercurial-scm.org/D9709
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 07 Jan 2021 16:08:30 -0800 |
parents | a34607b6d320 |
children | 8db5fa212ab0 |
comparison
equal
deleted
inserted
replaced
46281:a34607b6d320 | 46282:0a69f9e640ec |
---|---|
88 self.fname = name | 88 self.fname = name |
89 | 89 |
90 def exists(self): | 90 def exists(self): |
91 return self.vfs.exists(self.fname) | 91 return self.vfs.exists(self.fname) |
92 | 92 |
93 def filename(self): | |
94 return self.vfs.join(self.fname) | |
95 | |
96 def backupfilename(self): | 93 def backupfilename(self): |
97 def gennames(base): | 94 def gennames(base): |
98 yield base | 95 yield base |
99 base, ext = base.rsplit(b'.', 1) | 96 base, ext = base.rsplit(b'.', 1) |
100 for i in itertools.count(1): | 97 for i in itertools.count(1): |
106 return n | 103 return n |
107 | 104 |
108 def movetobackup(self): | 105 def movetobackup(self): |
109 if not self.backupvfs.isdir(): | 106 if not self.backupvfs.isdir(): |
110 self.backupvfs.makedir() | 107 self.backupvfs.makedir() |
111 util.rename(self.filename(), self.backupfilename()) | 108 util.rename(self.vfs.join(self.fname), self.backupfilename()) |
112 | 109 |
113 | 110 |
114 class Shelf(object): | 111 class Shelf(object): |
115 """Represents a shelf, including possibly multiple files storing it. | 112 """Represents a shelf, including possibly multiple files storing it. |
116 | 113 |