mercurial/bookmarks.py
changeset 31052 0332b8fafd05
parent 30634 ad15646dc61c
child 31544 8a32d6352196
--- a/mercurial/bookmarks.py	Tue Feb 21 01:20:59 2017 +0900
+++ b/mercurial/bookmarks.py	Tue Feb 21 01:21:00 2017 +0900
@@ -19,6 +19,7 @@
     error,
     lock as lockmod,
     obsolete,
+    txnutil,
     util,
 )
 
@@ -29,17 +30,8 @@
     bookmarks or the committed ones. Other extensions (like share)
     may need to tweak this behavior further.
     """
-    bkfile = None
-    if 'HG_PENDING' in encoding.environ:
-        try:
-            bkfile = repo.vfs('bookmarks.pending')
-        except IOError as inst:
-            if inst.errno != errno.ENOENT:
-                raise
-    if bkfile is None:
-        bkfile = repo.vfs('bookmarks')
-    return bkfile
-
+    fp, pending = txnutil.trypending(repo.root, repo.vfs, 'bookmarks')
+    return fp
 
 class bmstore(dict):
     """Storage for bookmarks.