Mercurial > hg-stable
changeset 10691:a778a367c20b stable
mq: fix init with nonexistent or non-local repository
author | Cédric Duval <cedricduval@free.fr> |
---|---|
date | Sun, 14 Mar 2010 18:46:38 +0100 |
parents | ea85c01c7835 |
children | 2a6c34b14ace b4b16e90712f |
files | hgext/mq.py tests/test-mq tests/test-mq.out |
diffstat | 3 files changed, 29 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Sun Mar 14 19:21:24 2010 +0100 +++ b/hgext/mq.py Sun Mar 14 18:46:38 2010 +0100 @@ -2633,7 +2633,16 @@ if not mq: return orig(ui, *args, **kwargs) - repopath = cmdutil.findrepo(os.getcwd()) + if args: + repopath = args[0] + if not hg.islocal(repopath): + raise util.Abort(_('only a local queue repository ' + 'may be initialized')) + else: + repopath = cmdutil.findrepo(os.getcwd()) + if not repopath: + raise util.Abort(_('There is no Mercurial repository here ' + '(.hg not found)')) repo = hg.repository(ui, repopath) return qinit(ui, repo, True)
--- a/tests/test-mq Sun Mar 14 19:21:24 2010 +0100 +++ b/tests/test-mq Sun Mar 14 18:46:38 2010 +0100 @@ -80,6 +80,19 @@ cat .hg/patches/series cd .. +echo '% init --mq without repo' +mkdir f +cd f +hg init --mq +cd .. + +echo '% init --mq with nonexistent directory' +hg init --mq nonexistentdir + +echo '% init --mq with bundle (non "local")' +hg -R a bundle --all a.bundle >/dev/null +hg init --mq a.bundle + cd a hg qnew -m 'foo bar' test.patch
--- a/tests/test-mq.out Sun Mar 14 19:21:24 2010 +0100 +++ b/tests/test-mq.out Sun Mar 14 18:46:38 2010 +0100 @@ -89,6 +89,12 @@ series: A B +% init --mq without repo +abort: There is no Mercurial repository here (.hg not found) +% init --mq with nonexistent directory +abort: repository nonexistentdir not found! +% init --mq with bundle (non "local") +abort: only a local queue repository may be initialized % qrefresh foo bar