Show More
@@ -1235,8 +1235,14 b' class dirstate(object):' | |||||
1235 | # end of this transaction |
|
1235 | # end of this transaction | |
1236 | tr.registertmp(filename, location='plain') |
|
1236 | tr.registertmp(filename, location='plain') | |
1237 |
|
1237 | |||
1238 |
|
|
1238 | backupname = prefix + self._filename + suffix | |
1239 | self._opener.tryread(filename)) |
|
1239 | assert backupname != filename | |
|
1240 | if self._opener.exists(backupname): | |||
|
1241 | self._opener.unlink(backupname) | |||
|
1242 | # hardlink backup is okay because _writedirstate is always called | |||
|
1243 | # with an "atomictemp=True" file. | |||
|
1244 | util.copyfile(self._opener.join(filename), | |||
|
1245 | self._opener.join(backupname), hardlink=True) | |||
1240 |
|
1246 | |||
1241 | def restorebackup(self, tr, suffix='', prefix=''): |
|
1247 | def restorebackup(self, tr, suffix='', prefix=''): | |
1242 | '''Restore dirstate by backup file with suffix''' |
|
1248 | '''Restore dirstate by backup file with suffix''' |
@@ -5,7 +5,11 b' Test how largefiles abort in case the di' | |||||
5 | > from mercurial import util |
|
5 | > from mercurial import util | |
6 | > # |
|
6 | > # | |
7 | > # this makes the original largefiles code abort: |
|
7 | > # this makes the original largefiles code abort: | |
|
8 | > _origcopyfileobj = shutil.copyfileobj | |||
8 | > def copyfileobj(fsrc, fdst, length=16*1024): |
|
9 | > def copyfileobj(fsrc, fdst, length=16*1024): | |
|
10 | > # allow journal files (used by transaction) to be written | |||
|
11 | > if 'journal.' in fdst.name: | |||
|
12 | > return _origcopyfileobj(fsrc, fdst, length) | |||
9 | > fdst.write(fsrc.read(4)) |
|
13 | > fdst.write(fsrc.read(4)) | |
10 | > raise IOError(errno.ENOSPC, os.strerror(errno.ENOSPC)) |
|
14 | > raise IOError(errno.ENOSPC, os.strerror(errno.ENOSPC)) | |
11 | > shutil.copyfileobj = copyfileobj |
|
15 | > shutil.copyfileobj = copyfileobj |
General Comments 0
You need to be logged in to leave comments.
Login now