--- a/hgext/mq.py Sun Mar 14 19:09:55 2010 +0100
+++ b/hgext/mq.py Sun Mar 14 22:21:48 2010 +0100
@@ -16,7 +16,6 @@
Common tasks (use "hg help command" for more details)::
- prepare repository to work with patches qinit
create new patch qnew
import existing patch qimport
@@ -1850,7 +1849,7 @@
default. Use -p <url> to change.
The patch directory must be a nested Mercurial repository, as
- would be created by qinit -c.
+ would be created by init --mq.
'''
def patchdir(repo):
url = repo.url()
@@ -1868,7 +1867,7 @@
hg.repository(ui, patchespath)
except error.RepoError:
raise util.Abort(_('versioned patch repository not found'
- ' (see qinit -c)'))
+ ' (see init --mq)'))
qbase, destrev = None, None
if sr.local():
if sr.mq.applied:
@@ -2604,7 +2603,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:09:55 2010 +0100
+++ b/tests/test-mq Sun Mar 14 22:21:48 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:09:55 2010 +0100
+++ b/tests/test-mq.out Sun Mar 14 22:21:48 2010 +0100
@@ -10,7 +10,6 @@
Common tasks (use "hg help command" for more details):
- prepare repository to work with patches qinit
create new patch qnew
import existing patch qimport
@@ -90,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
@@ -513,7 +518,7 @@
summary: add foo
% qclone
-abort: versioned patch repository not found (see qinit -c)
+abort: versioned patch repository not found (see init --mq)
adding .hg/patches/patch1
main repo:
rev 1: change foo