changeset 4556:30bc57094bfc

dispatch: move findrepo to cmdutil
author Matt Mackall <mpm@selenic.com>
date Mon, 11 Jun 2007 21:09:24 -0500
parents 1843d31bfdbf
children 050fa240db9c
files mercurial/cmdutil.py mercurial/localrepo.py
diffstat 2 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Mon Jun 11 21:09:24 2007 -0500
+++ b/mercurial/cmdutil.py	Mon Jun 11 21:09:24 2007 -0500
@@ -9,7 +9,7 @@
 from i18n import _
 import os, sys, mdiff, bdiff, util, templater, patch, commands
 import atexit, signal, pdb, hg, lock, fancyopts, traceback
-import socket, revlog, version, extensions, errno, localrepo
+import socket, revlog, version, extensions, errno
 
 revrangesep = ':'
 
@@ -186,6 +186,15 @@
 
     raise UnknownCommand(cmd)
 
+def findrepo():
+    p = os.getcwd()
+    while not os.path.isdir(os.path.join(p, ".hg")):
+        oldp, p = p, os.path.dirname(p)
+        if p == oldp:
+            return None
+
+    return p
+
 def parse(ui, args):
     options = {}
     cmdoptions = {}
@@ -259,7 +268,7 @@
     # this will trigger its extensions to load
     path = earlygetopt(["-R", "--repository"], args)
     if not path:
-        path = localrepo.findrepo() or ""
+        path = findrepo() or ""
     if path:
         try:
             lui = commands.ui.ui(parentui=ui)
--- a/mercurial/localrepo.py	Mon Jun 11 21:09:24 2007 -0500
+++ b/mercurial/localrepo.py	Mon Jun 11 21:09:24 2007 -0500
@@ -12,15 +12,6 @@
 import re, lock, transaction, tempfile, stat, mdiff, errno, ui
 import os, revlog, time, util
 
-def findrepo():
-    p = os.getcwd()
-    while not os.path.isdir(os.path.join(p, ".hg")):
-        oldp, p = p, os.path.dirname(p)
-        if p == oldp:
-            return None
-
-    return p
-
 class localrepository(repo.repository):
     capabilities = ('lookup', 'changegroupsubset')
     supported = ('revlogv1', 'store')