[PATCH 05 of 13] Fix import cycle: cmdutil imports patch imports cmdutil
Alejandro Santos
alejolp at alejolp.com
Wed Aug 5 15:55:39 CDT 2009
# HG changeset patch
# User Alejandro Santos <alejolp at alejolp.com>
# Date 1249505587 10800
# Node ID 34cf98e3a0202becb3a8b986a714650f988b961a
# Parent 5190ff297043f89a3108d4a8ed10f4ea71358f4d
Fix import cycle: cmdutil imports patch imports cmdutil.
diff -r 5190ff297043 -r 34cf98e3a020 mercurial/patch.py
--- a/mercurial/patch.py Wed Aug 05 17:51:33 2009 -0300
+++ b/mercurial/patch.py Wed Aug 05 17:53:07 2009 -0300
@@ -8,7 +8,7 @@
from i18n import _
from node import hex, nullid, short
-import base85, cmdutil, mdiff, util, diffhelpers, copies
+import base85, mdiff, util, diffhelpers, copies
import cStringIO, email.Parser, os, re, math
import sys, tempfile, zlib
@@ -20,6 +20,18 @@
class NoHunks(PatchError):
pass
+# XXX: Fix import cycle:
+# >>> cmdutil imports patch imports cmdutil
+
+def addremove(repo, pats=[], opts={}, dry_run=None, similarity=None):
+ from cmdutil import addremove as fnaddremove
+ return fnaddremove(repo, pats, opts, dry_run, similarity)
+
+def make_file(repo, pat, node=None,
+ total=None, seqno=None, revwidth=None, mode='wb', pathname=None):
+ from cmdutil import make_file as fnmake_file
+ return make_file(repo, pat, node, total, seqno, revwidth, mode, pathname)
+
# helper functions
def copyfile(src, dst, basedir):
@@ -1083,7 +1095,7 @@
repo.wwrite(gp.path, '', flags)
elif gp.op != 'DELETE':
util.set_flags(dst, islink, isexec)
- cmdutil.addremove(repo, cfiles, similarity=similarity)
+ addremove(repo, cfiles, similarity=similarity)
files = patches.keys()
files.extend([r for r in removes if r not in files])
return sorted(files)
@@ -1361,7 +1373,7 @@
prev = (parents and parents[0]) or nullid
if not fp:
- fp = cmdutil.make_file(repo, template, node, total=total,
+ fp = make_file(repo, template, node, total=total,
seqno=seqno, revwidth=revwidth,
mode='ab')
if fp != sys.stdout and hasattr(fp, 'name'):
More information about the Mercurial-devel
mailing list