[PATCH 21 of 36] context: move p1 from changectx

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


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

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -82,10 +82,13 @@
 
     def parents(self):
         """return contexts for each parent changeset"""
         return self._parents
 
+    def p1(self):
+        return self._parents[0]
+
 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=''):
@@ -237,13 +240,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 p1(self):
-        return self._parents[0]
-
     def p2(self):
         if len(self._parents) == 2:
             return self._parents[1]
         return changectx(self._repo, -1)
 


More information about the Mercurial-devel mailing list