import sys, stat, time, os
from bup import options, git, index, drecurse
from bup.helpers import *
-
+from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE
class IterHelper:
def __init__(self, l):
def update_index(top, excluded_paths):
+ tmax = time.time() - 1
ri = index.Reader(indexfile)
- wi = index.Writer(indexfile)
+ wi = index.Writer(indexfile, tmax)
rig = IterHelper(ri.iter(name=top))
tstart = int(time.time())
hashgen = None
if opt.fake_valid:
def hashgen(name):
- return (0100644, index.FAKE_SHA)
+ return (GIT_MODE_FILE, index.FAKE_SHA)
total = 0
bup_dir = os.path.abspath(git.repo())
check_index(ri)
log('check: before merging: newfile\n')
check_index(wr)
- mi = index.Writer(indexfile)
+ mi = index.Writer(indexfile, tmax)
for e in index.merge(ri, wr):
# FIXME: shouldn't we remove deleted entries eventually? When?
if opt.fake_valid and opt.fake_invalid:
o.fatal('--fake-valid is incompatible with --fake-invalid')
+# FIXME: remove this once we account for timestamp races, i.e. index;
+# touch new-file; index. It's possible for this to happen quickly
+# enough that new-file ends up with the same timestamp as the first
+# index, and then bup will ignore it.
+tick_start = time.time()
+time.sleep(1 - (tick_start - int(tick_start)))
+
git.check_repo_or_die()
indexfile = opt.indexfile or git.repo('bupindex')