mercurial/phases.py
changeset 31073 6afd8a87a657
parent 31036 bf81d3b7b2ba
child 31162 b7cef987356d
--- a/mercurial/phases.py	Tue Feb 21 01:21:00 2017 +0900
+++ b/mercurial/phases.py	Tue Feb 21 01:21:00 2017 +0900
@@ -113,9 +113,9 @@
     short,
 )
 from . import (
-    encoding,
     error,
     smartset,
+    txnutil,
 )
 
 allphases = public, draft, secret = range(3)
@@ -137,15 +137,7 @@
     dirty = False
     roots = [set() for i in allphases]
     try:
-        f = None
-        if 'HG_PENDING' in encoding.environ:
-            try:
-                f = repo.svfs('phaseroots.pending')
-            except IOError as inst:
-                if inst.errno != errno.ENOENT:
-                    raise
-        if f is None:
-            f = repo.svfs('phaseroots')
+        f, pending = txnutil.trypending(repo.root, repo.svfs, 'phaseroots')
         try:
             for line in f:
                 phase, nh = line.split()