##// END OF EJS Templates
with: use context manager for transaction in strip
Bryan O'Sullivan -
r27873:60ea60fe default
parent child Browse files
Show More
@@ -160,10 +160,10 b' def strip(ui, repo, nodelist, backup=Tru'
160 160 msg = _('programming error: cannot strip from inside a transaction')
161 161 raise error.Abort(msg, hint=_('contact your extension maintainer'))
162 162
163 tr = repo.transaction("strip")
163 try:
164 with repo.transaction("strip") as tr:
164 165 offset = len(tr.entries)
165 166
166 try:
167 167 tr.startgroup()
168 168 cl.strip(striprev, tr)
169 169 mfst.strip(striprev, tr)
@@ -171,15 +171,11 b' def strip(ui, repo, nodelist, backup=Tru'
171 171 repo.file(fn).strip(striprev, tr)
172 172 tr.endgroup()
173 173
174 try:
175 174 for i in xrange(offset, len(tr.entries)):
176 175 file, troffset, ignore = tr.entries[i]
177 176 repo.svfs(file, 'a').truncate(troffset)
178 177 if troffset == 0:
179 178 repo.store.markremoved(file)
180 tr.close()
181 finally:
182 tr.release()
183 179
184 180 if saveheads or savebases:
185 181 ui.note(_("adding branch\n"))
General Comments 0
You need to be logged in to leave comments. Login now