Patchwork [1,of,4] phase: rename getphaserevs to loadphaserevs

login
register
mail settings
Submitter Pierre-Yves David
Date June 17, 2015, 2:09 a.m.
Message ID <377bef13cfb90601c15f.1434506958@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/9686/
State Accepted
Headers show

Comments

Pierre-Yves David - June 17, 2015, 2:09 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1434409454 25200
#      Mon Jun 15 16:04:14 2015 -0700
# Node ID 377bef13cfb90601c15f19d0109449c5922a3526
# Parent  695b93a79d171bbcc4ac47b1229918ce809a5d65
phase: rename getphaserevs to loadphaserevs

This function is:
- already loading the data in place,
- used once in the code.

So we drop the return value and change the name to make this obvious. We keep
the function public because we'll have to use it in revset.

Patch

diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -192,22 +192,22 @@  class phasecache(object):
                 for rev in roots:
                     revs[rev] = phase
                 for rev in repo.changelog.descendants(roots):
                     revs[rev] = phase
 
-    def getphaserevs(self, repo):
+    def loadphaserevs(self, repo):
+        """ensure phase information is loaded in the object"""
         if self._phaserevs is None:
             try:
                 if repo.ui.configbool('experimental',
                                       'nativephaseskillswitch'):
                     self._computephaserevspure(repo)
                 else:
                     res = self._getphaserevsnative(repo)
                     self._phaserevs, self._phasesets = res
             except AttributeError:
                 self._computephaserevspure(repo)
-        return self._phaserevs
 
     def invalidate(self):
         self._phaserevs = None
         self._phasesets = None
 
@@ -231,11 +231,11 @@  class phasecache(object):
             return public
         if rev < nullrev:
             raise ValueError(_('cannot lookup negative revision'))
         if self._phaserevs is None or rev >= len(self._phaserevs):
             self.invalidate()
-            self._phaserevs = self.getphaserevs(repo)
+            self.loadphaserevs(repo)
         return self._phaserevs[rev]
 
     def write(self):
         if not self.dirty:
             return