diff -r 6252852b4332 -r d216fa04e48a mercurial/cmdutil.py --- 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'))