import stat
from bup.helpers import *
+import bup.xstat as xstat
try:
O_LARGEFILE = os.O_LARGEFILE
os.fchdir(self.fd)
def stat(self):
- return os.fstat(self.fd)
+ return xstat.fstat(self.fd)
_IFMT = stat.S_IFMT(0xffffffff) # avoid function call in inner loop
l = []
for n in os.listdir('.'):
try:
- st = os.lstat(n)
+ st = xstat.lstat(n)
except OSError, e:
add_error(Exception('%s: %s' % (realpath(n), str(e))))
continue
assert(type(paths) != type(''))
for path in paths:
try:
- pst = os.lstat(path)
+ pst = xstat.lstat(path)
if stat.S_ISLNK(pst.st_mode):
yield (path, pst)
continue
def from_stat(self, st, tstart):
old = (self.dev, self.ctime, self.mtime,
self.uid, self.gid, self.size, self.flags & IX_EXISTS)
- new = (st.st_dev, int(st.st_ctime), int(st.st_mtime),
+ new = (st.st_dev,
+ int(st.st_ctime.approx_secs()),
+ int(st.st_mtime.approx_secs()),
st.st_uid, st.st_gid, st.st_size, IX_EXISTS)
self.dev = st.st_dev
- self.ctime = int(st.st_ctime)
- self.mtime = int(st.st_mtime)
+ self.ctime = int(st.st_ctime.approx_secs())
+ self.mtime = int(st.st_mtime.approx_secs())
self.uid = st.st_uid
self.gid = st.st_gid
self.size = st.st_size
self.mode = st.st_mode
self.flags |= IX_EXISTS
- if int(st.st_ctime) >= tstart or old != new \
+ if int(st.st_ctime.approx_secs()) >= tstart or old != new \
or self.sha == EMPTY_SHA or not self.gitmode:
self.invalidate()
self._fixup()
if st:
isdir = stat.S_ISDIR(st.st_mode)
assert(isdir == endswith)
- e = NewEntry(basename, name, st.st_dev, int(st.st_ctime),
- int(st.st_mtime), st.st_uid, st.st_gid,
+ e = NewEntry(basename, name, st.st_dev,
+ int(st.st_ctime.approx_secs()),
+ int(st.st_mtime.approx_secs()),
+ st.st_uid, st.st_gid,
st.st_size, st.st_mode, gitmode, sha, flags,
0, 0)
else:
import os
from bup import index
from bup.helpers import *
+import bup.xstat as xstat
from wvtest import *
@wvtest
@wvtest
def index_writer():
unlink('index.tmp')
- ds = os.stat('.')
- fs = os.stat('tindex.py')
+ ds = xstat.stat('.')
+ fs = xstat.stat('tindex.py')
w = index.Writer('index.tmp')
w.add('/var/tmp/sporky', fs)
w.add('/etc/passwd', fs)
def index_dirty():
unlink('index.tmp')
unlink('index2.tmp')
- ds = os.stat('.')
- fs = os.stat('tindex.py')
+ ds = xstat.stat('.')
+ fs = xstat.stat('tindex.py')
w1 = index.Writer('index.tmp')
w1.add('/a/b/x', fs)