diff mercurial/cmdutil.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 6252852b4332
children 5ddde896a19d
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Mon Feb 08 10:23:44 2010 +0100
+++ b/mercurial/cmdutil.py	Mon Feb 08 10:50:00 2010 +0100
@@ -62,6 +62,14 @@
 
     raise error.UnknownCommand(cmd)
 
+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 bail_if_changed(repo):
     if repo.dirstate.parents()[1] != nullid:
         raise util.Abort(_('outstanding uncommitted merge'))