[PATCH 1 of 5 V2] context: move importing patch into the diff method
Sean Farley
sean.michael.farley at gmail.com
Wed Aug 6 23:20:22 UTC 2014
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1407367046 18000
# Wed Aug 06 18:17:26 2014 -0500
# Node ID db7d8fec711c7d5469bd351628029dbd27d9a82a
# Parent ba5fc3f81f1588507a5a84ac2b43679705ceec7b
context: move importing patch into the diff method
This is needed to avoid an import cycle and being that 'diff' is the only
method that needs the patch module, we move importing it into the method.
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -5,11 +5,11 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from node import nullid, nullrev, short, hex, bin
from i18n import _
-import mdiff, error, util, scmutil, subrepo, patch, encoding, phases
+import mdiff, error, util, scmutil, subrepo, encoding, phases
import match as matchmod
import os, errno, stat
import obsolete as obsmod
import repoview
import fileset
@@ -260,10 +260,12 @@ class basectx(object):
include, exclude, default,
auditor=r.auditor, ctx=self)
def diff(self, ctx2=None, match=None, **opts):
"""Returns a diff generator for the given contexts and matcher"""
+ # need to break an import cycle
+ import patch
if ctx2 is None:
ctx2 = self.p1()
if ctx2 is not None:
ctx2 = self._repo[ctx2]
diffopts = patch.diffopts(self._repo.ui, opts)
More information about the Mercurial-devel
mailing list