Patchwork [22,of,35,V2] context: move p2 from changectx

login
register
mail settings
Submitter Sean Farley
Date Aug. 7, 2013, 11:51 p.m.
Message ID <07c7989088bd9a2d5de1.1375919496@laptop.local>
Download mbox | patch
Permalink /patch/2075/
State Accepted
Headers show

Comments

Sean Farley - Aug. 7, 2013, 11:51 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1375745214 18000
#      Mon Aug 05 18:26:54 2013 -0500
# Node ID 07c7989088bd9a2d5de1edfa3fedccdf931100f4
# Parent  ce185ffb92b0ccb7abb93d413744632efe7cd333
context: move p2 from changectx

Patch

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=''):
@@ -246,15 +251,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]