##// END OF EJS Templates
transaction: always remove empty journal on abort...
Sune Foldager -
r9693:c40a1ee2 default
parent child Browse files
Show More
@@ -59,8 +59,7 b' class transaction(object):'
59
59
60 def __del__(self):
60 def __del__(self):
61 if self.journal:
61 if self.journal:
62 if self.entries: self._abort()
62 self._abort()
63 self.file.close()
64
63
65 @active
64 @active
66 def startgroup(self):
65 def startgroup(self):
@@ -126,7 +125,7 b' class transaction(object):'
126 self.entries = []
125 self.entries = []
127 if self.after:
126 if self.after:
128 self.after()
127 self.after()
129 else:
128 if os.path.isfile(self.journal):
130 os.unlink(self.journal)
129 os.unlink(self.journal)
131 self.journal = None
130 self.journal = None
132
131
@@ -141,7 +140,10 b' class transaction(object):'
141 self.count = 0
140 self.count = 0
142 self.file.close()
141 self.file.close()
143
142
144 if not self.entries: return
143 if not self.entries:
144 if self.journal:
145 os.unlink(self.journal)
146 return
145
147
146 self.report(_("transaction abort!\n"))
148 self.report(_("transaction abort!\n"))
147
149
@@ -3,6 +3,7 b''
3 hg init
3 hg init
4 echo a > a
4 echo a > a
5 hg ci -Am0
5 hg ci -Am0
6 hg -q clone . foo
6
7
7 touch .hg/store/journal
8 touch .hg/store/journal
8
9
@@ -10,3 +11,10 b' echo foo > a'
10 hg ci -Am0
11 hg ci -Am0
11
12
12 hg recover
13 hg recover
14
15 echo % check that zero-size journals are correctly aborted
16 hg bundle -qa repo.hg
17 chmod -w foo/.hg/store/00changelog.i
18 hg -R foo unbundle repo.hg 2>&1 | sed 's/\(abort: Permission denied\).*/\1/'
19 if test -f foo/.hg/store/journal; then echo 'journal exists :-('; fi
20 exit 0
@@ -6,3 +6,6 b' checking manifests'
6 crosschecking files in changesets and manifests
6 crosschecking files in changesets and manifests
7 checking files
7 checking files
8 1 files, 1 changesets, 1 total revisions
8 1 files, 1 changesets, 1 total revisions
9 % check that zero-size journals are correctly aborted
10 adding changesets
11 abort: Permission denied
General Comments 0
You need to be logged in to leave comments. Login now