mq: improve qclone error handling when patch directory is not a repository.
--- a/hgext/mq.py Mon Jul 09 22:35:10 2007 -0700
+++ b/hgext/mq.py Tue Jul 10 09:52:32 2007 -0700
@@ -1478,11 +1478,20 @@
Source patch repository is looked for in <src>/.hg/patches by
default. Use -p <url> to change.
+
+ The patch directory must be a nested mercurial repository, as
+ would be created by qinit -c.
'''
cmdutil.setremoteconfig(ui, opts)
if dest is None:
dest = hg.defaultdest(source)
sr = hg.repository(ui, ui.expandpath(source))
+ patchdir = opts['patches'] or (sr.url() + '/.hg/patches')
+ try:
+ pr = hg.repository(ui, patchdir)
+ except hg.RepoError:
+ raise util.Abort(_('versioned patch repository not found'
+ ' (see qinit -c)'))
qbase, destrev = None, None
if sr.local():
if sr.mq.applied:
--- a/tests/test-mq Mon Jul 09 22:35:10 2007 -0700
+++ b/tests/test-mq Tue Jul 10 09:52:32 2007 -0700
@@ -368,10 +368,17 @@
echo foo > foo
hg add foo
hg ci -m 'add foo'
-hg qinit -c
+hg qinit
hg qnew patch1
echo bar >> foo
hg qrefresh -m 'change foo'
+cd ..
+
+# repo with unversioned patch dir
+hg qclone qclonesource failure
+
+cd qclonesource
+hg qinit -c
hg qci -m checkpoint
qlog
cd ..
--- a/tests/test-mq.out Mon Jul 09 22:35:10 2007 -0700
+++ b/tests/test-mq.out Tue Jul 10 09:52:32 2007 -0700
@@ -407,6 +407,8 @@
summary: add foo
% qclone
+abort: versioned patch repository not found (see qinit -c)
+adding .hg/patches/patch1
main repo:
rev 1: change foo
rev 0: add foo