diff mercurial/dispatch.py @ 10402:d216fa04e48a

mq: make init -Q do what qinit -c did
author Brendan Cully <brendan@kublai.com>
date Mon, 08 Feb 2010 10:50:00 +0100
parents de1e7099d100
children 6ded6243bde2
line wrap: on
line diff
--- a/mercurial/dispatch.py	Mon Feb 08 10:23:44 2010 +0100
+++ b/mercurial/dispatch.py	Mon Feb 08 10:50:00 2010 +0100
@@ -162,14 +162,6 @@
 
     return -1
 
-def _findrepo(p):
-    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 aliasargs(fn):
     if hasattr(fn, 'args'):
         return fn.args
@@ -360,7 +352,7 @@
         os.chdir(cwd[-1])
 
     # read the local repository .hgrc into a local ui object
-    path = _findrepo(os.getcwd()) or ""
+    path = cmdutil.findrepo(os.getcwd()) or ""
     if not path:
         lui = ui
     else:
@@ -459,7 +451,7 @@
         except error.RepoError:
             if cmd not in commands.optionalrepo.split():
                 if args and not path: # try to infer -R from command args
-                    repos = map(_findrepo, args)
+                    repos = map(cmdutil.findrepo, args)
                     guess = repos[0]
                     if guess and repos.count(guess) == len(repos):
                         return _dispatch(ui, ['--repository', guess] + fullargs)