qclone: don't call reposetup manually
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 15 Feb 2007 08:44:08 -0200
changeset 4090 785ad8cd1d31
parent 4089 0ff50cc7acb4
child 4091 3d7480ada3e5
qclone: don't call reposetup manually
hgext/mq.py
tests/test-mq
tests/test-mq.out
--- a/hgext/mq.py	Thu Feb 15 08:14:03 2007 -0200
+++ b/hgext/mq.py	Thu Feb 15 08:44:08 2007 -0200
@@ -1501,7 +1501,6 @@
     sr = hg.repository(ui, ui.expandpath(source))
     qbase, destrev = None, None
     if sr.local():
-        reposetup(ui, sr)
         if sr.mq.applied:
             qbase = revlog.bin(sr.mq.applied[0].rev)
             if not hg.islocal(dest):
@@ -1521,7 +1520,6 @@
     if dr.local():
         if qbase:
             ui.note(_('stripping applied patches from destination repo\n'))
-            reposetup(ui, dr)
             dr.mq.strip(dr, qbase, update=False, backup=None)
         if not opts['noupdate']:
             ui.note(_('updating destination repo\n'))
--- a/tests/test-mq	Thu Feb 15 08:14:03 2007 -0200
+++ b/tests/test-mq	Thu Feb 15 08:44:08 2007 -0200
@@ -264,4 +264,42 @@
 hg log
 hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/'
 hg log
+cd ..
 
+echo '% qclone'
+qlog()
+{
+    echo 'main repo:'
+    hg log --template '    rev {rev}: {desc}\n'
+    echo 'patch repo:'
+    hg -R .hg/patches log --template '    rev {rev}: {desc}\n'
+}
+hg init qclonesource
+cd qclonesource
+echo foo > foo
+hg add foo
+hg ci -m 'add foo'
+hg qinit -c
+hg qnew patch1
+echo bar >> foo
+hg qrefresh -m 'change foo'
+hg qci -m checkpoint
+qlog
+cd ..
+
+# repo with patches applied
+hg qclone qclonesource qclonedest
+cd qclonedest
+qlog
+cd ..
+
+# repo with patches unapplied
+cd qclonesource
+hg qpop -a
+qlog
+cd ..
+hg qclone qclonesource qclonedest2
+cd qclonedest2
+qlog
+cd ..
+
--- a/tests/test-mq.out	Thu Feb 15 08:14:03 2007 -0200
+++ b/tests/test-mq.out	Thu Feb 15 08:44:08 2007 -0200
@@ -313,3 +313,26 @@
 date:        Thu Jan 01 00:00:00 1970 +0000
 summary:     add foo
 
+% qclone
+main repo:
+    rev 1: change foo
+    rev 0: add foo
+patch repo:
+    rev 0: checkpoint
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+main repo:
+    rev 0: add foo
+patch repo:
+    rev 0: checkpoint
+Patch queue now empty
+main repo:
+    rev 0: add foo
+patch repo:
+    rev 0: checkpoint
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+main repo:
+    rev 0: add foo
+patch repo:
+    rev 0: checkpoint