From patchwork Wed Aug 7 23:51:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [03, of, 35, V2] changectx: if passing a context then exit __init__ immediately From: Sean Farley X-Patchwork-Id: 2056 Message-Id: <93e23839fcc5b6c0eb22.1375919477@laptop.local> To: mercurial-devel@selenic.com Date: Wed, 07 Aug 2013 18:51:17 -0500 # HG changeset patch # User Sean Farley # Date 1375825361 18000 # Tue Aug 06 16:42:41 2013 -0500 # Node ID 93e23839fcc5b6c0eb22592f27b5abbe2c4c1321 # Parent 21cc2a972033673988500bb126c24e77f2ed37e1 changectx: if passing a context then exit __init__ immediately diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -39,10 +39,16 @@ """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=''): """changeid is a revision number, node, or tag""" + + # since context.__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, context): + return + if changeid == '': changeid = '.' self._repo = repo if isinstance(changeid, int):