Mercurial > hg
comparison hgext/shelve.py @ 40029:e2697acd9381
cleanup: some Yoda conditions, this patch removes
It seems the factor 20 is less than the frequency of " < \d" compared
to " \d > ".
Differential Revision: https://phab.mercurial-scm.org/D4862
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 03 Oct 2018 10:27:44 -0700 |
parents | d9ba836fc234 |
children | c303d65d2e34 |
comparison
equal
deleted
inserted
replaced
40028:51f10e6d66c7 | 40029:e2697acd9381 |
---|---|
300 vfs = vfsmod.vfs(repo.vfs.join(backupdir)) | 300 vfs = vfsmod.vfs(repo.vfs.join(backupdir)) |
301 maxbackups = repo.ui.configint('shelve', 'maxbackups') | 301 maxbackups = repo.ui.configint('shelve', 'maxbackups') |
302 hgfiles = [f for f in vfs.listdir() | 302 hgfiles = [f for f in vfs.listdir() |
303 if f.endswith('.' + patchextension)] | 303 if f.endswith('.' + patchextension)] |
304 hgfiles = sorted([(vfs.stat(f)[stat.ST_MTIME], f) for f in hgfiles]) | 304 hgfiles = sorted([(vfs.stat(f)[stat.ST_MTIME], f) for f in hgfiles]) |
305 if 0 < maxbackups and maxbackups < len(hgfiles): | 305 if maxbackups > 0 and maxbackups < len(hgfiles): |
306 bordermtime = hgfiles[-maxbackups][0] | 306 bordermtime = hgfiles[-maxbackups][0] |
307 else: | 307 else: |
308 bordermtime = None | 308 bordermtime = None |
309 for mtime, f in hgfiles[:len(hgfiles) - maxbackups]: | 309 for mtime, f in hgfiles[:len(hgfiles) - maxbackups]: |
310 if mtime == bordermtime: | 310 if mtime == bordermtime: |