diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-10-02 12:56:32 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-10-02 12:56:32 +0100 |
commit | 70d92bf0604c239e866761fb2ea8a9dd9f0ea594 (patch) | |
tree | d3f50ed0f596e2714d6e5b39f1c75d074b06def6 /fsck-larch | |
parent | 16954a73a2fab7b2a726a213c7b34bbb485d0522 (diff) | |
download | larch-70d92bf0604c239e866761fb2ea8a9dd9f0ea594.tar.gz |
Allow fsck to fix missing-children problem in index nodes.
Also make some errors be just warnings, they should hopefully
be benign (i.e., not crash users of larch).
Diffstat (limited to 'fsck-larch')
-rwxr-xr-x | fsck-larch | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -29,6 +29,7 @@ class Fsck(cliapp.Application): def add_settings(self): self.settings.string_list(['trace'], 'add PATTERN to trace patterns', metavar='PATTERN') + self.settings.boolean(['fix'], 'fix problems found?') def process_args(self, args): for pattern in self.settings['trace']: @@ -48,7 +49,8 @@ class Fsck(cliapp.Application): for dirname in args: self.ts.notify('fsck-larch for %s' % dirname) forest = larch.open_forest(dirname=dirname) - fsck = larch.fsck.Fsck(forest, self.report) + fsck = larch.fsck.Fsck(forest, self.warning, self.error, + self.settings['fix']) fsck.find_work() self.ts['checks'] = len(fsck.work) @@ -63,10 +65,14 @@ class Fsck(cliapp.Application): if self.errors: sys.exit(1) - def report(self, msg): + def error(self, msg): self.errors = True self.ts.notify(msg) logging.error(msg) + def warning(self, msg): + self.ts.notify(msg) + logging.warning(msg) + if __name__ == '__main__': Fsck().run() |