mercurial/bookmarks.py
branchstable
changeset 18471 2096e025a728
parent 18363 c6e033a7dd38
child 18496 d1c13a4dc638
equal deleted inserted replaced
18470:28b3d669295e 18471:2096e025a728
   131         except OSError, inst:
   131         except OSError, inst:
   132             if inst.errno != errno.ENOENT:
   132             if inst.errno != errno.ENOENT:
   133                 raise
   133                 raise
   134     finally:
   134     finally:
   135         wlock.release()
   135         wlock.release()
       
   136 
       
   137 def iscurrent(repo, mark=None, parents=None):
       
   138     '''Tell whether the current bookmark is also active
       
   139 
       
   140     I.e., the bookmark listed in .hg/bookmarks.current also points to a
       
   141     parent of the working directory.
       
   142     '''
       
   143     if not mark:
       
   144         mark = repo._bookmarkcurrent
       
   145     if not parents:
       
   146         parents = [p.node() for p in repo[None].parents()]
       
   147     marks = repo._bookmarks
       
   148     return (mark in marks and marks[mark] in parents)
   136 
   149 
   137 def updatecurrentbookmark(repo, oldnode, curbranch):
   150 def updatecurrentbookmark(repo, oldnode, curbranch):
   138     try:
   151     try:
   139         return update(repo, oldnode, repo.branchtip(curbranch))
   152         return update(repo, oldnode, repo.branchtip(curbranch))
   140     except error.RepoLookupError:
   153     except error.RepoLookupError: