changectx: if passing a basectx then exit __init__ immediately
authorSean Farley <sean.michael.farley@gmail.com>
Tue, 06 Aug 2013 16:42:41 -0500
changeset 19539 79671c46bb46
parent 19538 049d6b5a4a59
child 19540 7b864da00e21
changectx: if passing a basectx then exit __init__ immediately
mercurial/context.py
--- 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