changeset 19539:79671c46bb46

changectx: if passing a basectx then exit __init__ immediately
author Sean Farley <sean.michael.farley@gmail.com>
date Tue, 06 Aug 2013 16:42:41 -0500
parents 049d6b5a4a59
children 7b864da00e21
files mercurial/context.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Tue Aug 06 15:50:28 2013 -0500
+++ b/mercurial/context.py	Tue Aug 06 16:42:41 2013 -0500
@@ -41,6 +41,12 @@
     the repo."""
     def __init__(self, repo, changeid=''):
         """changeid is a revision number, node, or tag"""
+
+        # since basectx.__new__ already took care of copying the object, we
+        # don't need to do anything in __init__, so we just exit here
+        if isinstance(changeid, basectx):
+            return
+
         if changeid == '':
             changeid = '.'
         self._repo = repo