mercurial/bookmarks.py
changeset 31072 0332b8fafd05
parent 30639 ad15646dc61c
child 31550 8a32d6352196
equal deleted inserted replaced
31071:96eaefd350ae 31072:0332b8fafd05
    17 from . import (
    17 from . import (
    18     encoding,
    18     encoding,
    19     error,
    19     error,
    20     lock as lockmod,
    20     lock as lockmod,
    21     obsolete,
    21     obsolete,
       
    22     txnutil,
    22     util,
    23     util,
    23 )
    24 )
    24 
    25 
    25 def _getbkfile(repo):
    26 def _getbkfile(repo):
    26     """Hook so that extensions that mess with the store can hook bm storage.
    27     """Hook so that extensions that mess with the store can hook bm storage.
    27 
    28 
    28     For core, this just handles wether we should see pending
    29     For core, this just handles wether we should see pending
    29     bookmarks or the committed ones. Other extensions (like share)
    30     bookmarks or the committed ones. Other extensions (like share)
    30     may need to tweak this behavior further.
    31     may need to tweak this behavior further.
    31     """
    32     """
    32     bkfile = None
    33     fp, pending = txnutil.trypending(repo.root, repo.vfs, 'bookmarks')
    33     if 'HG_PENDING' in encoding.environ:
    34     return fp
    34         try:
       
    35             bkfile = repo.vfs('bookmarks.pending')
       
    36         except IOError as inst:
       
    37             if inst.errno != errno.ENOENT:
       
    38                 raise
       
    39     if bkfile is None:
       
    40         bkfile = repo.vfs('bookmarks')
       
    41     return bkfile
       
    42 
       
    43 
    35 
    44 class bmstore(dict):
    36 class bmstore(dict):
    45     """Storage for bookmarks.
    37     """Storage for bookmarks.
    46 
    38 
    47     This object should do all bookmark-related reads and writes, so
    39     This object should do all bookmark-related reads and writes, so