# HG changeset patch # User Vadim Gelfer # Date 1154196872 25200 # Node ID 8ce86d2c97371d17a5174c8cb46e4d24b1473fe0 # Parent 5d134f04060f791d858f9f469c0ef50395a2ae51 mq: add basic tests diff -r 5d134f04060f -r 8ce86d2c9737 tests/test-mq --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq Sat Jul 29 11:14:32 2006 -0700 @@ -0,0 +1,114 @@ +#!/bin/sh + +HGRCPATH=$HGTMP/.hgrc; export HGRCPATH +echo "[extensions]" >> $HGTMP/.hgrc +echo "mq=" >> $HGTMP/.hgrc + +echo % help +hg help mq + +hg init a +cd a +echo a > a +mkdir b +echo z > b/z +hg ci -Ama + +echo % qinit + +hg qinit + +cd .. +hg init b + +echo % -R qinit + +hg -R b qinit + +hg init c + +echo % qinit -c + +hg --cwd c qinit -c +hg -R c/.hg/patches st + +echo % qnew implies add + +hg -R c qnew test.patch +hg -R c/.hg/patches st + +cd a + +echo % qnew -m + +hg qnew -m 'foo bar' test.patch +cat .hg/patches/test.patch + +echo % qrefresh + +echo a >> a +hg qrefresh +sed -e "s/\(^diff -r \)\([a-f0-9]* \)/\1 x/" \ + -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ + -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch + +echo % qpop + +hg qpop + +echo % qpush + +hg qpush + +cd .. + +echo % pop/push outside repo + +hg -R a qpop +hg -R a qpush + +cd a +hg qnew test2.patch + +echo % qrefresh in subdir + +cd b +echo a > a +hg add a +hg qrefresh + +echo % pop/push -a in subdir + +hg qpop -a +hg --traceback qpush -a + +echo % qseries +hg qseries + +echo % qapplied +hg qapplied + +echo % qtop +hg qtop + +echo % qprev +hg qprev + +echo % qnext +hg qnext + +echo % pop, qnext, qprev, qapplied +hg qpop +hg qnext +hg qprev +hg qapplied + +echo % qunapplied +hg qunapplied + +echo % strip +cd ../../b +echo x>x +hg ci -Ama +hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/' +hg unbundle .hg/strip-backup/* diff -r 5d134f04060f -r 8ce86d2c9737 tests/test-mq.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq.out Sat Jul 29 11:14:32 2006 -0700 @@ -0,0 +1,111 @@ +% help +mq extension - patch management and development + +This extension lets you work with a stack of patches in a Mercurial +repository. It manages two stacks of patches - all known patches, and +applied patches (subset of known patches). + +Known patches are represented as patch files in the .hg/patches +directory. Applied patches are both patch files and changesets. + +Common tasks (use "hg help command" for more details): + +prepare repository to work with patches qinit +create new patch qnew +import existing patch qimport + +print patch series qseries +print applied patches qapplied +print name of top applied patch qtop + +add known patch to applied stack qpush +remove patch from applied stack qpop +refresh contents of top applied patch qrefresh + +list of commands (use "hg help -v mq" to show aliases and global options): + + qapplied print the patches already applied + qclone clone main and patch repository at same time + qcommit commit changes in the queue repository + qdelete remove a patch from the series file + qdiff diff of the current patch + qimport import a patch + qinit init a new queue repository + qnew create a new patch + qnext print the name of the next patch + qpop pop the current patch off the stack + qprev print the name of the previous patch + qpush push the next patch onto the stack + qrefresh update the current patch + qrestore restore the queue state saved by a rev + qsave save current queue state + qseries print the entire series file + qtop print the name of the current patch + qunapplied print the patches not yet applied + qversion print the version number + strip strip a revision and all later revs on the same branch +adding a +adding b/z +% qinit +% -R qinit +% qinit -c +A .hgignore +A series +% qnew implies add +A .hgignore +A series +A test.patch +% qnew -m +foo bar +% qrefresh +foo bar + +diff -r xa +--- a/a ++++ b/a +@@ -1,1 +1,2 @@ a + a ++a +% qpop +Patch queue now empty +% qpush +applying test.patch +Now at: test.patch +% pop/push outside repo +Patch queue now empty +applying test.patch +Now at: test.patch +% qrefresh in subdir +% pop/push -a in subdir +Patch queue now empty +applying test.patch +applying test2.patch +Now at: test2.patch +% qseries +test.patch +test2.patch +% qapplied +test.patch +test2.patch +% qtop +test2.patch +% qprev +test.patch +% qnext +All patches applied +% pop, qnext, qprev, qapplied +Now at: test.patch +test2.patch +Only one patch applied +test.patch +% qunapplied +test2.patch +% strip +adding x +0 files updated, 0 files merged, 1 files removed, 0 files unresolved +saving bundle to +adding changesets +adding manifests +adding file changes +added 1 changesets with 1 changes to 1 files +(run 'hg update' to get a working copy)