Patchwork [21,of,35,V2] context: move p1 from changectx

login
register
mail settings
Submitter Sean Farley
Date Aug. 7, 2013, 11:51 p.m.
Message ID <ce185ffb92b0ccb7abb9.1375919495@laptop.local>
Download mbox | patch
Permalink /patch/2074/
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 1375745175 18000
#      Mon Aug 05 18:26:15 2013 -0500
# Node ID ce185ffb92b0ccb7abb93d413744632efe7cd333
# Parent  ca49bea0b803d7f6f9973ebf2d6c25b12f7a0f2d
context: move p1 from changectx

Patch

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=''):
@@ -243,13 +246,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)