bup-save was catching all IOErrors and treating them as data-read
failures, but some of them could be backup-write errors. Have git.py
and client.py raise distinctive errors when pack write raises IOError.
Signed-off-by: Brandon Low <lostlogic@lostlogicx.com>
sha,
struct.pack('!I', crc),
data))
sha,
struct.pack('!I', crc),
data))
- (self._bwcount, self._bwtime) = \
- _raw_write_bwlimit(self.file, outbuf, self._bwcount, self._bwtime)
+ try:
+ (self._bwcount, self._bwtime) = _raw_write_bwlimit(
+ self.file, outbuf, self._bwcount, self._bwtime)
+ except IOError, e:
+ raise ClientError, e, sys.exc_info()[2]
self.outbytes += len(data) - 20 - 4 # Don't count sha1+crc
self.count += 1
self.outbytes += len(data) - 20 - 4 # Don't count sha1+crc
self.count += 1
bup repositories are in Git format. This library allows us to
interact with the Git data structures.
"""
bup repositories are in Git format. This library allows us to
interact with the Git data structures.
"""
-import os, zlib, time, subprocess, struct, stat, re, tempfile, heapq
+import os, sys, zlib, time, subprocess, struct, stat, re, tempfile, heapq
from bup.helpers import *
from bup import _helpers
from bup.helpers import *
from bup import _helpers
# to our hashsplit algorithm.) f.write() does its own buffering,
# but that's okay because we'll flush it in _end().
oneblob = ''.join(datalist)
# to our hashsplit algorithm.) f.write() does its own buffering,
# but that's okay because we'll flush it in _end().
oneblob = ''.join(datalist)
+ try:
+ f.write(oneblob)
+ except IOError, e:
+ raise GitError, e, sys.exc_info()[2]
nw = len(oneblob)
crc = zlib.crc32(oneblob) & 0xffffffff
self._update_idx(sha, crc, nw)
nw = len(oneblob)
crc = zlib.crc32(oneblob) & 0xffffffff
self._update_idx(sha, crc, nw)