[PATCH 22 of 36] context: move p2 from changectx

Sean Farley sean.michael.farley at gmail.com
Wed Aug 7 13:13:22 CDT 2013


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1375745214 18000
#      Mon Aug 05 18:26:54 2013 -0500
# Node ID feabce8ec27a139cabc122ec27141b3170067759
# Parent  02e9a78aa148940036c09266782e8866c4cecc96
context: move p2 from changectx

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -85,10 +85,15 @@
         return self._parents
 
     def p1(self):
         return self._parents[0]
 
+    def p2(self):
+        if len(self._parents) == 2:
+            return self._parents[1]
+        return changectx(self._repo, -1)
+
 class changectx(context):
     """A changecontext object makes access to data related to a particular
     changeset convenient. It represents a read-only context already presnt in
     the repo."""
     def __init__(self, repo, changeid=''):
@@ -240,15 +245,10 @@
     def phase(self):
         return self._repo._phasecache.phase(self._repo, self._rev)
     def hidden(self):
         return self._rev in repoview.filterrevs(self._repo, 'visible')
 
-    def p2(self):
-        if len(self._parents) == 2:
-            return self._parents[1]
-        return changectx(self._repo, -1)
-
     def children(self):
         """return contexts for each child changeset"""
         c = self._repo.changelog.children(self._node)
         return [changectx(self._repo, x) for x in c]
 


More information about the Mercurial-devel mailing list