##// END OF EJS Templates
bookmarks: fix _bookmarks/lookup() reentrancy issue (issue2016)...
Patrick Mezard -
r12392:74129048 stable
parent child Browse files
Show More
@@ -224,6 +224,7 b' def reposetup(ui, repo):'
224 in the .hg/bookmarks file.
224 in the .hg/bookmarks file.
225 Read the file and return a (name=>nodeid) dictionary
225 Read the file and return a (name=>nodeid) dictionary
226 '''
226 '''
227 self._loadingbookmarks = True
227 try:
228 try:
228 bookmarks = {}
229 bookmarks = {}
229 for line in self.opener('bookmarks'):
230 for line in self.opener('bookmarks'):
@@ -231,6 +232,7 b' def reposetup(ui, repo):'
231 bookmarks[refspec] = super(bookmark_repo, self).lookup(sha)
232 bookmarks[refspec] = super(bookmark_repo, self).lookup(sha)
232 except:
233 except:
233 pass
234 pass
235 self._loadingbookmarks = False
234 return bookmarks
236 return bookmarks
235
237
236 @util.propertycache
238 @util.propertycache
@@ -257,8 +259,9 b' def reposetup(ui, repo):'
257 return super(bookmark_repo, self).rollback(*args)
259 return super(bookmark_repo, self).rollback(*args)
258
260
259 def lookup(self, key):
261 def lookup(self, key):
260 if key in self._bookmarks:
262 if not getattr(self, '_loadingbookmarks', False):
261 key = self._bookmarks[key]
263 if key in self._bookmarks:
264 key = self._bookmarks[key]
262 return super(bookmark_repo, self).lookup(key)
265 return super(bookmark_repo, self).lookup(key)
263
266
264 def _bookmarksupdate(self, parents, node):
267 def _bookmarksupdate(self, parents, node):
@@ -357,7 +360,8 b' def reposetup(ui, repo):'
357 def _findtags(self):
360 def _findtags(self):
358 """Merge bookmarks with normal tags"""
361 """Merge bookmarks with normal tags"""
359 (tags, tagtypes) = super(bookmark_repo, self)._findtags()
362 (tags, tagtypes) = super(bookmark_repo, self)._findtags()
360 tags.update(self._bookmarks)
363 if not getattr(self, '_loadingbookmarks', False):
364 tags.update(self._bookmarks)
361 return (tags, tagtypes)
365 return (tags, tagtypes)
362
366
363 if hasattr(repo, 'invalidate'):
367 if hasattr(repo, 'invalidate'):
@@ -43,3 +43,18 b' hg strip 1 | hidebackup'
43 echo % list bookmarks
43 echo % list bookmarks
44 hg book
44 hg book
45
45
46 echo '% test immediate rollback and reentrancy issue'
47 echo "mq=!" >> $HGRCPATH
48 hg init repo
49 cd repo
50 echo a > a
51 hg ci -Am adda
52 echo b > b
53 hg ci -Am addb
54 hg bookmarks markb
55 hg rollback
56 hg bookmarks
57 hg bookmarks markb
58 hg bookmarks
59 cd ..
60
@@ -16,3 +16,9 b' saved backup bundle to'
16 % list bookmarks
16 % list bookmarks
17 * test 1:9f1b7e78eff8
17 * test 1:9f1b7e78eff8
18 * test2 1:9f1b7e78eff8
18 * test2 1:9f1b7e78eff8
19 % test immediate rollback and reentrancy issue
20 adding a
21 adding b
22 rolling back to revision 0 (undo commit)
23 no bookmarks set
24 * markb 0:07f494440405
General Comments 0
You need to be logged in to leave comments. Login now