[PATCH 03 of 35 V2] changectx: if passing a context then exit __init__ immediately
Sean Farley
sean.michael.farley at gmail.com
Wed Aug 7 18:51:17 CDT 2013
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# 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):
More information about the Mercurial-devel
mailing list