hgext/blackbox.py
changeset 38783 e7aa113b14f7
parent 37120 a8a902d7176e
child 40293 c303d65d2e34
equal deleted inserted replaced
38782:7eba8f83129b 38783:e7aa113b14f7
    43 from mercurial.i18n import _
    43 from mercurial.i18n import _
    44 from mercurial.node import hex
    44 from mercurial.node import hex
    45 
    45 
    46 from mercurial import (
    46 from mercurial import (
    47     encoding,
    47     encoding,
       
    48     pycompat,
    48     registrar,
    49     registrar,
    49     ui as uimod,
    50     ui as uimod,
    50     util,
    51     util,
    51 )
    52 )
    52 from mercurial.utils import (
    53 from mercurial.utils import (
   109             pass
   110             pass
   110         else:
   111         else:
   111             if st.st_size >= maxsize:
   112             if st.st_size >= maxsize:
   112                 path = vfs.join(name)
   113                 path = vfs.join(name)
   113                 maxfiles = ui.configint('blackbox', 'maxfiles')
   114                 maxfiles = ui.configint('blackbox', 'maxfiles')
   114                 for i in xrange(maxfiles - 1, 1, -1):
   115                 for i in pycompat.xrange(maxfiles - 1, 1, -1):
   115                     rotate(oldpath='%s.%d' % (path, i - 1),
   116                     rotate(oldpath='%s.%d' % (path, i - 1),
   116                            newpath='%s.%d' % (path, i))
   117                            newpath='%s.%d' % (path, i))
   117                 rotate(oldpath=path,
   118                 rotate(oldpath=path,
   118                        newpath=maxfiles > 0 and path + '.1')
   119                        newpath=maxfiles > 0 and path + '.1')
   119     return vfs(name, 'a')
   120     return vfs(name, 'a')