##// END OF EJS Templates
strip: use context manager for locking and transaction in stripcmd()
Martin von Zweigbergk -
r32920:8dbcb66a default
parent child Browse files
Show More
@@ -156,18 +156,12 b' def stripcmd(ui, repo, *revs, **opts):'
156 rsrevs = repair.stripbmrevset(repo, marks[0])
156 rsrevs = repair.stripbmrevset(repo, marks[0])
157 revs.update(set(rsrevs))
157 revs.update(set(rsrevs))
158 if not revs:
158 if not revs:
159 lock = tr = None
159 with repo.lock(), repo.transaction('bookmark') as tr:
160 try:
161 lock = repo.lock()
162 tr = repo.transaction('bookmark')
163 for bookmark in bookmarks:
160 for bookmark in bookmarks:
164 del repomarks[bookmark]
161 del repomarks[bookmark]
165 repomarks.recordchange(tr)
162 repomarks.recordchange(tr)
166 tr.close()
163 for bookmark in sorted(bookmarks):
167 for bookmark in sorted(bookmarks):
164 ui.write(_("bookmark '%s' deleted\n") % bookmark)
168 ui.write(_("bookmark '%s' deleted\n") % bookmark)
169 finally:
170 release(lock, tr)
171
165
172 if not revs:
166 if not revs:
173 raise error.Abort(_('empty revision set'))
167 raise error.Abort(_('empty revision set'))
General Comments 0
You need to be logged in to leave comments. Login now