def setfile(self, name):
     oname = name + '.old'
     try:
         rename(name, oname)
     except:
         pass
     self.file = posixfile(name, 'wb')
     self.msg('%s, Version %s' % (APP_TITLE, version.version()))
     self.msg('Logging to file started')
def remove(args):
    path = args[0]
    logger.msg('Removing ' + path)
    roots, notifypaths = getrepos([path])
    if roots:
        for r in sorted(roots):
            tfn = os.path.join(r, '.hg', 'thgstatus')
            try:
                f = posixfile(tfn, 'rb')
                e = f.readline()
                f.close()
                if not e.startswith('@@noicons'):
                    unlink(tfn)
            except (IOError, OSError), e:
                if e.errno != errno.ENOENT:
                    logger.msg("Error while trying to remove %s (%s)" % (tfn, e))
        if notifypaths:
            shlib.shell_notify(list(notifypaths))