mercurial/phases.py
changeset 15922 23921c17299a
parent 15902 4252d9f08d7e
child 15946 b9c7ac405757
equal deleted inserted replaced
15921:92e455f2866c 15922:23921c17299a
   107 phasenames = ['public', 'draft', 'secret']
   107 phasenames = ['public', 'draft', 'secret']
   108 
   108 
   109 def readroots(repo):
   109 def readroots(repo):
   110     """Read phase roots from disk"""
   110     """Read phase roots from disk"""
   111     roots = [set() for i in allphases]
   111     roots = [set() for i in allphases]
   112     roots[0].add(nullid)
       
   113     try:
   112     try:
   114         f = repo.sopener('phaseroots')
   113         f = repo.sopener('phaseroots')
   115         try:
   114         try:
   116             for line in f:
   115             for line in f:
   117                 phase, nh = line.strip().split()
   116                 phase, nh = line.strip().split()
   119         finally:
   118         finally:
   120             f.close()
   119             f.close()
   121     except IOError, inst:
   120     except IOError, inst:
   122         if inst.errno != errno.ENOENT:
   121         if inst.errno != errno.ENOENT:
   123             raise
   122             raise
       
   123         for f in repo._phasedefaults:
       
   124             roots = f(repo, roots)
   124     return roots
   125     return roots
   125 
   126 
   126 def writeroots(repo):
   127 def writeroots(repo):
   127     """Write phase roots from disk"""
   128     """Write phase roots from disk"""
   128     f = repo.sopener('phaseroots', 'w', atomictemp=True)
   129     f = repo.sopener('phaseroots', 'w', atomictemp=True)