Permalink
Browse files

Merge branch 'indexrewrite'

* indexrewrite:
  Greatly improved progress reporting during index/save.
  Fix bugs in new indexing code.
  Speed up cmd-drecurse by 40%.
  Split directory recursion stuff from cmd-index.py into drecurse.py.
  Massive speedups to bupindex code.
  • Loading branch information...
2 parents 62f3fae + 689b162 commit 2658037b7b528609e2110d3f2773d7d705a7b42a @apenwarr apenwarr committed Feb 4, 2010
Showing with 624 additions and 325 deletions.
  1. +1 −1 Makefile
  2. +36 −0 cmd-drecurse.py
  3. +4 −5 cmd-fsck.py
  4. +123 −159 cmd-index.py
  5. +47 −17 cmd-save.py
  6. +94 −0 drecurse.py
  7. +4 −4 git.py
  8. +3 −2 hashsplit.py
  9. +54 −1 helpers.py
  10. +218 −123 index.py
  11. 0 t/sampledata/b2/foozy
  12. 0 t/sampledata/b2/foozy2
  13. +26 −13 t/test.sh
  14. +14 −0 t/tindex.py
View
@@ -20,7 +20,7 @@ endif
default: all
all: bup-split bup-join bup-save bup-init bup-server bup-index bup-tick \
- bup-midx bup-fuse bup-ls bup-damage bup-fsck bup-margin \
+ bup-midx bup-fuse bup-ls bup-damage bup-fsck bup-margin bup-drecurse \
bup memtest randomgen$(EXT) _hashsplit$(SOEXT)
randomgen$(EXT): randomgen.o
View
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+import options, drecurse
+from helpers import *
+
+optspec = """
+bup drecurse <path>
+--
+x,xdev,one-file-system don't cross filesystem boundaries
+q,quiet don't actually print filenames
+profile run under the python profiler
+"""
+o = options.Options('bup drecurse', optspec)
+(opt, flags, extra) = o.parse(sys.argv[1:])
+
+if len(extra) != 1:
+ log("drecurse: exactly one filename expected\n")
+ o.usage()
+
+it = drecurse.recursive_dirlist(extra, opt.xdev)
+if opt.profile:
+ import cProfile
+ def do_it():
+ for i in it:
+ pass
+ cProfile.run('do_it()')
+else:
+ if opt.quiet:
+ for i in it:
+ pass
+ else:
+ for (name,st) in it:
+ print name
+
+if saved_errors:
+ log('WARNING: %d errors encountered.\n' % len(saved_errors))
+ sys.exit(1)
View
@@ -3,7 +3,6 @@
import options, git
from helpers import *
-istty = os.isatty(1)
par2_ok = 0
nullf = open('/dev/null')
@@ -163,8 +162,8 @@ def do_pack(base, last):
sys.stdout.flush()
debug('fsck: checking %s (%s)\n'
% (last, par2_ok and par2_exists and 'par2' or 'git'))
- if not opt.verbose and istty:
- log('fsck (%d/%d)\r' % (count, len(extra)))
+ if not opt.verbose:
+ progress('fsck (%d/%d)\r' % (count, len(extra)))
if not opt.jobs:
nc = do_pack(base, last)
@@ -195,8 +194,8 @@ def do_pack(base, last):
del outstanding[pid]
code = code or nc
count += 1
- if not opt.verbose and istty:
- log('fsck (%d/%d)\r' % (count, len(extra)))
+ if not opt.verbose:
+ progress('fsck (%d/%d)\r' % (count, len(extra)))
if not opt.verbose and istty:
log('fsck done. \n')
Oops, something went wrong.

0 comments on commit 2658037

Please sign in to comment.