mercurial/bookmarks.py
changeset 24944 08ec11e3ae4c
parent 24832 5947a68fa271
child 24945 e0b0fbd47491
equal deleted inserted replaced
24943:3e39f67ef663 24944:08ec11e3ae4c
    82         self._writerepo(repo)
    82         self._writerepo(repo)
    83 
    83 
    84     def _writerepo(self, repo):
    84     def _writerepo(self, repo):
    85         """Factored out for extensibility"""
    85         """Factored out for extensibility"""
    86         if repo._bookmarkcurrent not in self:
    86         if repo._bookmarkcurrent not in self:
    87             unsetcurrent(repo)
    87             deactivate(repo)
    88 
    88 
    89         wlock = repo.wlock()
    89         wlock = repo.wlock()
    90         try:
    90         try:
    91 
    91 
    92             file = repo.vfs('bookmarks', 'w', atomictemp=True)
    92             file = repo.vfs('bookmarks', 'w', atomictemp=True)
   149         file.close()
   149         file.close()
   150     finally:
   150     finally:
   151         wlock.release()
   151         wlock.release()
   152     repo._bookmarkcurrent = mark
   152     repo._bookmarkcurrent = mark
   153 
   153 
   154 def unsetcurrent(repo):
   154 def deactivate(repo):
       
   155     """
       
   156     Unset the active bookmark in this reposiotry.
       
   157     """
   155     wlock = repo.wlock()
   158     wlock = repo.wlock()
   156     try:
   159     try:
   157         try:
   160         try:
   158             repo.vfs.unlink('bookmarks.current')
   161             repo.vfs.unlink('bookmarks.current')
   159             repo._bookmarkcurrent = None
   162             repo._bookmarkcurrent = None