diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py --- a/hgext/bookmarks.py +++ b/hgext/bookmarks.py @@ -224,6 +224,7 @@ def reposetup(ui, repo): in the .hg/bookmarks file. Read the file and return a (name=>nodeid) dictionary ''' + self._loadingbookmarks = True try: bookmarks = {} for line in self.opener('bookmarks'): @@ -231,6 +232,7 @@ def reposetup(ui, repo): bookmarks[refspec] = super(bookmark_repo, self).lookup(sha) except: pass + self._loadingbookmarks = False return bookmarks @util.propertycache @@ -257,8 +259,9 @@ def reposetup(ui, repo): return super(bookmark_repo, self).rollback(*args) def lookup(self, key): - if key in self._bookmarks: - key = self._bookmarks[key] + if not getattr(self, '_loadingbookmarks', False): + if key in self._bookmarks: + key = self._bookmarks[key] return super(bookmark_repo, self).lookup(key) def _bookmarksupdate(self, parents, node): @@ -357,7 +360,8 @@ def reposetup(ui, repo): def _findtags(self): """Merge bookmarks with normal tags""" (tags, tagtypes) = super(bookmark_repo, self)._findtags() - tags.update(self._bookmarks) + if not getattr(self, '_loadingbookmarks', False): + tags.update(self._bookmarks) return (tags, tagtypes) if hasattr(repo, 'invalidate'): diff --git a/tests/test-bookmarks-strip b/tests/test-bookmarks-strip --- a/tests/test-bookmarks-strip +++ b/tests/test-bookmarks-strip @@ -43,3 +43,18 @@ hg strip 1 | hidebackup echo % list bookmarks hg book +echo '% test immediate rollback and reentrancy issue' +echo "mq=!" >> $HGRCPATH +hg init repo +cd repo +echo a > a +hg ci -Am adda +echo b > b +hg ci -Am addb +hg bookmarks markb +hg rollback +hg bookmarks +hg bookmarks markb +hg bookmarks +cd .. + diff --git a/tests/test-bookmarks-strip.out b/tests/test-bookmarks-strip.out --- a/tests/test-bookmarks-strip.out +++ b/tests/test-bookmarks-strip.out @@ -16,3 +16,9 @@ saved backup bundle to % list bookmarks * test 1:9f1b7e78eff8 * test2 1:9f1b7e78eff8 +% test immediate rollback and reentrancy issue +adding a +adding b +rolling back to revision 0 (undo commit) +no bookmarks set + * markb 0:07f494440405