diff mercurial/phases.py @ 23361:936b0ff34346

phases: read pending data when appropriate If we are called by a hook and pending data exists, read those.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 17 Oct 2014 22:23:06 -0700
parents e803186296ab
children b8260abfeb7d
line wrap: on
line diff
--- a/mercurial/phases.py	Sun Sep 28 21:27:48 2014 -0700
+++ b/mercurial/phases.py	Fri Oct 17 22:23:06 2014 -0700
@@ -100,6 +100,7 @@
 
 """
 
+import os
 import errno
 from node import nullid, nullrev, bin, hex, short
 from i18n import _
@@ -124,7 +125,15 @@
     dirty = False
     roots = [set() for i in allphases]
     try:
-        f = repo.sopener('phaseroots')
+        f = None
+        if 'HG_PENDING' in os.environ:
+            try:
+                f = repo.svfs('phaseroots.pending')
+            except IOError, inst:
+                if inst.errno != errno.ENOENT:
+                    raise
+        if f is None:
+            f = repo.sopener('phaseroots')
         try:
             for line in f:
                 phase, nh = line.split()