##// END OF EJS Templates
make transactions work on non-refcounted python implementations
Ronny Pfannschmidt -
r11230:5116a077 default
parent child Browse files
Show More
@@ -613,8 +613,7 b' class queue(object):'
613 613 repo.dirstate.invalidate()
614 614 raise
615 615 finally:
616 del tr
617 release(lock, wlock)
616 release(tr, lock, wlock)
618 617 self.removeundo(repo)
619 618
620 619 def _apply(self, repo, series, list=False, update_status=True,
@@ -971,7 +971,8 b' class localrepository(repo.repository):'
971 971 self.branchtags()
972 972 return n
973 973 finally:
974 del tr
974 if tr:
975 tr.release()
975 976 lock.release()
976 977
977 978 def destroyed(self):
@@ -2194,7 +2195,7 b' class localrepository(repo.repository):'
2194 2195
2195 2196 tr.close()
2196 2197 finally:
2197 del tr
2198 tr.release()
2198 2199
2199 2200 if changesets > 0:
2200 2201 # forcefully update the on-disk branch cache
@@ -43,6 +43,7 b' def _playback(journal, report, opener, e'
43 43 class transaction(object):
44 44 def __init__(self, report, opener, journal, after=None, createmode=None):
45 45 self.count = 1
46 self.usages = 1
46 47 self.report = report
47 48 self.opener = opener
48 49 self.after = after
@@ -108,8 +109,16 b' class transaction(object):'
108 109 @active
109 110 def nest(self):
110 111 self.count += 1
112 self.usages += 1
111 113 return self
112 114
115 def release(self):
116 if self.count > 0:
117 self.usages -= 1
118 # of the transaction scopes are left without being closed, fail
119 if self.count > 0 and self.usages == 0:
120 self._abort()
121
113 122 def running(self):
114 123 return self.count > 0
115 124
@@ -136,6 +145,7 b' class transaction(object):'
136 145
137 146 def _abort(self):
138 147 self.count = 0
148 self.usages = 0
139 149 self.file.close()
140 150
141 151 try:
General Comments 0
You need to be logged in to leave comments. Login now