Mercurial > hg
changeset 12325:5f6231861e09
merge with abuehl
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 20 Sep 2010 15:31:48 -0500 |
parents | f00953d9533c (current diff) b701610f6c56 (diff) |
children | 9d932e8e9546 |
files | tests/test-mq-git tests/test-mq-git.out tests/test-mq-merge tests/test-mq-merge.out tests/test-mq-missingfiles tests/test-mq-missingfiles.out tests/test-mq-pull-from-bundle tests/test-mq-pull-from-bundle.out tests/test-mq-qdelete tests/test-mq-qdelete.out tests/test-mq-qdiff tests/test-mq-qdiff.out tests/test-mq-qfold tests/test-mq-qfold.out tests/test-mq-qgoto tests/test-mq-qgoto.out tests/test-mq-qqueue tests/test-mq-qqueue.out tests/test-mq-qrefresh tests/test-mq-qrefresh.out tests/test-mq-qrename tests/test-mq-qrename.out tests/test-mq-qsave tests/test-mq-qsave.out |
diffstat | 36 files changed, 1934 insertions(+), 1865 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-mq-git Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -#!/bin/sh - -# Test the plumbing of mq.git option -# Automatic upgrade itself is tested elsewhere. - -echo "[extensions]" >> $HGRCPATH -echo "mq=" >> $HGRCPATH -echo "[diff]" >> $HGRCPATH -echo "nodates=1" >> $HGRCPATH - -hg init repo-auto -cd repo-auto -echo '% git=auto: regular patch creation' -echo a > a -hg add a -hg qnew -d '0 0' -f adda -cat .hg/patches/adda -echo '% git=auto: git patch creation with copy' -hg cp a b -hg qnew -d '0 0' -f copy -cat .hg/patches/copy -echo '% git=auto: git patch when using --git' -echo regular > regular -hg add regular -hg qnew -d '0 0' --git -f git -cat .hg/patches/git -echo '% git=auto: regular patch after qrefresh without --git' -hg qrefresh -d '0 0' -cat .hg/patches/git -cd .. - -hg init repo-keep -cd repo-keep -echo '[mq]' > .hg/hgrc -echo 'git = KEEP' >> .hg/hgrc -echo '% git=keep: git patch with --git' -echo a > a -hg add a -hg qnew -d '0 0' -f --git git -cat .hg/patches/git -echo '% git=keep: git patch after qrefresh without --git' -echo a >> a -hg qrefresh -d '0 0' -cat .hg/patches/git -cd .. - -hg init repo-yes -cd repo-yes -echo '[mq]' > .hg/hgrc -echo 'git = yes' >> .hg/hgrc -echo '% git=yes: git patch' -echo a > a -hg add a -hg qnew -d '0 0' -f git -cat .hg/patches/git -echo '% git=yes: git patch after qrefresh' -echo a >> a -hg qrefresh -d '0 0' -cat .hg/patches/git -cd .. - -hg init repo-no -cd repo-no -echo '[diff]' > .hg/hgrc -echo 'git = True' >> .hg/hgrc -echo '[mq]' > .hg/hgrc -echo 'git = False' >> .hg/hgrc -echo '% git=no: regular patch with copy' -echo a > a -hg add a -hg qnew -d '0 0' -f adda -hg cp a b -hg qnew -d '0 0' -f regular -cat .hg/patches/regular -echo '% git=no: regular patch after qrefresh with copy' -hg cp a c -hg qrefresh -d '0 0' -cat .hg/patches/regular -cd ..
--- a/tests/test-mq-git.out Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -% git=auto: regular patch creation -# HG changeset patch -# Parent 0000000000000000000000000000000000000000 -# Date 0 0 - -diff -r 000000000000 -r ef8dafc9fa4c a ---- /dev/null -+++ b/a -@@ -0,0 +1,1 @@ -+a -% git=auto: git patch creation with copy -# HG changeset patch -# Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4 -# Date 0 0 - -diff --git a/a b/b -copy from a -copy to b -% git=auto: git patch when using --git -# HG changeset patch -# Parent 99586d5f048c399e20f81cee41fbb3809c0e735d -# Date 0 0 - -diff --git a/regular b/regular -new file mode 100644 ---- /dev/null -+++ b/regular -@@ -0,0 +1,1 @@ -+regular -% git=auto: regular patch after qrefresh without --git -# HG changeset patch -# Parent 99586d5f048c399e20f81cee41fbb3809c0e735d -# Date 0 0 - -diff -r 99586d5f048c regular ---- /dev/null -+++ b/regular -@@ -0,0 +1,1 @@ -+regular -% git=keep: git patch with --git -# HG changeset patch -# Parent 0000000000000000000000000000000000000000 -# Date 0 0 - -diff --git a/a b/a -new file mode 100644 ---- /dev/null -+++ b/a -@@ -0,0 +1,1 @@ -+a -% git=keep: git patch after qrefresh without --git -# HG changeset patch -# Parent 0000000000000000000000000000000000000000 -# Date 0 0 - -diff --git a/a b/a -new file mode 100644 ---- /dev/null -+++ b/a -@@ -0,0 +1,2 @@ -+a -+a -% git=yes: git patch -# HG changeset patch -# Parent 0000000000000000000000000000000000000000 -# Date 0 0 - -diff --git a/a b/a -new file mode 100644 ---- /dev/null -+++ b/a -@@ -0,0 +1,1 @@ -+a -% git=yes: git patch after qrefresh -# HG changeset patch -# Parent 0000000000000000000000000000000000000000 -# Date 0 0 - -diff --git a/a b/a -new file mode 100644 ---- /dev/null -+++ b/a -@@ -0,0 +1,2 @@ -+a -+a -% git=no: regular patch with copy -# HG changeset patch -# Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4 -# Date 0 0 - -diff -r ef8dafc9fa4c -r a70404f79ba3 b ---- /dev/null -+++ b/b -@@ -0,0 +1,1 @@ -+a -% git=no: regular patch after qrefresh with copy -# HG changeset patch -# Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4 -# Date 0 0 - -diff -r ef8dafc9fa4c b ---- /dev/null -+++ b/b -@@ -0,0 +1,1 @@ -+a -diff -r ef8dafc9fa4c c ---- /dev/null -+++ b/c -@@ -0,0 +1,1 @@ -+a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-git.t Mon Sep 20 15:31:48 2010 -0500 @@ -0,0 +1,210 @@ +# Test the plumbing of mq.git option +# Automatic upgrade itself is tested elsewhere. + + $ echo "[extensions]" >> $HGRCPATH + $ echo "mq=" >> $HGRCPATH + $ echo "[diff]" >> $HGRCPATH + $ echo "nodates=1" >> $HGRCPATH + + $ hg init repo-auto + $ cd repo-auto + +git=auto: regular patch creation: + + $ echo a > a + $ hg add a + $ hg qnew -d '0 0' -f adda + + $ cat .hg/patches/adda + # HG changeset patch + # Parent 0000000000000000000000000000000000000000 + # Date 0 0 + + diff -r 000000000000 -r ef8dafc9fa4c a + --- /dev/null + +++ b/a + @@ -0,0 +1,1 @@ + +a + +git=auto: git patch creation with copy: + + $ hg cp a b + $ hg qnew -d '0 0' -f copy + + $ cat .hg/patches/copy + # HG changeset patch + # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4 + # Date 0 0 + + diff --git a/a b/b + copy from a + copy to b + +git=auto: git patch when using --git: + + $ echo regular > regular + $ hg add regular + $ hg qnew -d '0 0' --git -f git + + $ cat .hg/patches/git + # HG changeset patch + # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d + # Date 0 0 + + diff --git a/regular b/regular + new file mode 100644 + --- /dev/null + +++ b/regular + @@ -0,0 +1,1 @@ + +regular + +git=auto: regular patch after qrefresh without --git: + + $ hg qrefresh -d '0 0' + + $ cat .hg/patches/git + # HG changeset patch + # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d + # Date 0 0 + + diff -r 99586d5f048c regular + --- /dev/null + +++ b/regular + @@ -0,0 +1,1 @@ + +regular + + $ cd .. + + $ hg init repo-keep + $ cd repo-keep + $ echo '[mq]' > .hg/hgrc + $ echo 'git = KEEP' >> .hg/hgrc + +git=keep: git patch with --git: + + $ echo a > a + $ hg add a + $ hg qnew -d '0 0' -f --git git + + $ cat .hg/patches/git + # HG changeset patch + # Parent 0000000000000000000000000000000000000000 + # Date 0 0 + + diff --git a/a b/a + new file mode 100644 + --- /dev/null + +++ b/a + @@ -0,0 +1,1 @@ + +a + +git=keep: git patch after qrefresh without --git: + + $ echo a >> a + $ hg qrefresh -d '0 0' + + $ cat .hg/patches/git + # HG changeset patch + # Parent 0000000000000000000000000000000000000000 + # Date 0 0 + + diff --git a/a b/a + new file mode 100644 + --- /dev/null + +++ b/a + @@ -0,0 +1,2 @@ + +a + +a + $ cd .. + + $ hg init repo-yes + $ cd repo-yes + $ echo '[mq]' > .hg/hgrc + $ echo 'git = yes' >> .hg/hgrc + +git=yes: git patch: + + $ echo a > a + $ hg add a + $ hg qnew -d '0 0' -f git + + $ cat .hg/patches/git + # HG changeset patch + # Parent 0000000000000000000000000000000000000000 + # Date 0 0 + + diff --git a/a b/a + new file mode 100644 + --- /dev/null + +++ b/a + @@ -0,0 +1,1 @@ + +a + +git=yes: git patch after qrefresh: + + $ echo a >> a + $ hg qrefresh -d '0 0' + + $ cat .hg/patches/git + # HG changeset patch + # Parent 0000000000000000000000000000000000000000 + # Date 0 0 + + diff --git a/a b/a + new file mode 100644 + --- /dev/null + +++ b/a + @@ -0,0 +1,2 @@ + +a + +a + $ cd .. + + $ hg init repo-no + $ cd repo-no + $ echo '[diff]' > .hg/hgrc + $ echo 'git = True' >> .hg/hgrc + $ echo '[mq]' > .hg/hgrc + $ echo 'git = False' >> .hg/hgrc + +git=no: regular patch with copy: + + $ echo a > a + $ hg add a + $ hg qnew -d '0 0' -f adda + $ hg cp a b + $ hg qnew -d '0 0' -f regular + + $ cat .hg/patches/regular + # HG changeset patch + # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4 + # Date 0 0 + + diff -r ef8dafc9fa4c -r a70404f79ba3 b + --- /dev/null + +++ b/b + @@ -0,0 +1,1 @@ + +a + +git=no: regular patch after qrefresh with copy: + + $ hg cp a c + $ hg qrefresh -d '0 0' + + $ cat .hg/patches/regular + # HG changeset patch + # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4 + # Date 0 0 + + diff -r ef8dafc9fa4c b + --- /dev/null + +++ b/b + @@ -0,0 +1,1 @@ + +a + diff -r ef8dafc9fa4c c + --- /dev/null + +++ b/c + @@ -0,0 +1,1 @@ + +a + + $ cd .. +
--- a/tests/test-mq-merge Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -#!/bin/sh - -# Test issue 529 - mq aborts when merging patch deleting files - -checkundo() -{ - if [ -f .hg/store/undo ]; then - echo ".hg/store/undo still exists after $1" - fi -} - -echo "[extensions]" >> $HGRCPATH -echo "mq =" >> $HGRCPATH -echo "[mq]" >> $HGRCPATH -echo "git = keep" >> $HGRCPATH - -# Commit two dummy files in "init" changeset -hg init t -cd t -echo a > a -echo b > b -hg ci -Am init -hg tag -l init - -# Create a patch removing a -hg qnew rm_a -hg rm a -hg qrefresh -m "rm a" - -# Save the patch queue so we can merge it later -hg qsave -c -e 2>&1 | grep -v '^copy' -checkundo qsave - -# Update b and commit in an "update" changeset -hg up -C init -echo b >> b -hg st -hg ci -m update - -# Here, qpush used to abort with : -# The system cannot find the file specified => a -hg manifest -hg qpush -a -m 2>&1 | grep -v '^merging' -checkundo 'qpush -m' -hg manifest - -# ensure status is correct after merge -hg qpop -a -cd .. - -# Classic MQ merge sequence *with an explicit named queue* -echo -echo % init t2 -hg init t2 -cd t2 -echo '[diff]' > .hg/hgrc -echo 'nodates = 1' >> .hg/hgrc -echo a > a -hg ci -Am init -echo b > a -hg ci -m changea -hg up -C 0 -hg cp a aa -echo c >> a -hg qnew --git -f -e patcha -echo d >> a -hg qnew -d '0 0' -f -e patcha2 -echo % create the reference queue -hg qsave -c -e -n refqueue 2> /dev/null -hg up -C 1 -echo % merge -HGMERGE=internal:other hg qpush -a -m -n refqueue 2>&1 | \ - sed 's/merging with queue at.*refqueue/merging with queue at refqueue/' -echo % check patcha is still a git patch -cat .hg/patches/patcha -echo % check patcha2 is still a regular patch -grep git .hg/patches/patcha2 && echo 'git patch found!' -cd .. -
--- a/tests/test-mq-merge.out Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -adding a -adding b -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -M b -created new head -a -b -applying rm_a -now at: rm_a -b -popping rm_a -popping .hg.patches.merge.marker -patch queue now empty - -% init t2 -adding a -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -% create the reference queue -1 files updated, 0 files merged, 1 files removed, 0 files unresolved -% merge -merging with queue at refqueue -applying patcha -patching file a -Hunk #1 FAILED at 0 -1 out of 1 hunks FAILED -- saving rejects to file a.rej -patch failed, unable to continue (try -v) -patch failed, rejects left in working dir -patch didn't work out, merging patcha -1 files updated, 0 files merged, 1 files removed, 0 files unresolved -0 files updated, 2 files merged, 0 files removed, 0 files unresolved -(branch merge, don't forget to commit) -applying patcha2 -now at: patcha2 -% check patcha is still a git patch -# HG changeset patch -# Parent d3873e73d99ef67873dac33fbcc66268d5d2b6f4 - -diff --git a/a b/a ---- a/a -+++ b/a -@@ -1,1 +1,2 @@ --b -+a -+c -diff --git a/a b/aa -copy from a -copy to aa ---- a/a -+++ b/aa -@@ -1,1 +1,1 @@ --b -+a -% check patcha2 is still a regular patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-merge.t Mon Sep 20 15:31:48 2010 -0500 @@ -0,0 +1,153 @@ +# Test issue 529 - mq aborts when merging patch deleting files + + $ checkundo() + > { + > if [ -f .hg/store/undo ]; then + > echo ".hg/store/undo still exists" + > fi + > } + + $ echo "[extensions]" >> $HGRCPATH + $ echo "mq =" >> $HGRCPATH + $ echo "[mq]" >> $HGRCPATH + $ echo "git = keep" >> $HGRCPATH + +Commit two dummy files in "init" changeset: + + $ hg init t + $ cd t + $ echo a > a + $ echo b > b + $ hg ci -Am init + adding a + adding b + $ hg tag -l init + +Create a patch removing a: + + $ hg qnew rm_a + $ hg rm a + $ hg qrefresh -m "rm a" + +Save the patch queue so we can merge it later: + + $ hg qsave -c -e + copy .*/t/.hg/patches to .*/t/.hg/patches.1 + $ checkundo + +Update b and commit in an "update" changeset: + + $ hg up -C init + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo b >> b + $ hg st + M b + $ hg ci -m update + created new head + +# Here, qpush used to abort with : +# The system cannot find the file specified => a + $ hg manifest + a + b + + $ hg qpush -a -m + merging with queue at: .*/t/.hg/patches.1 + applying rm_a + now at: rm_a + + $ checkundo + $ hg manifest + b + +Ensure status is correct after merge: + + $ hg qpop -a + popping rm_a + popping .hg.patches.merge.marker + patch queue now empty + + $ cd .. + +Classic MQ merge sequence *with an explicit named queue*: + + $ hg init t2 + $ cd t2 + $ echo '[diff]' > .hg/hgrc + $ echo 'nodates = 1' >> .hg/hgrc + $ echo a > a + $ hg ci -Am init + adding a + $ echo b > a + $ hg ci -m changea + $ hg up -C 0 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg cp a aa + $ echo c >> a + $ hg qnew --git -f -e patcha + $ echo d >> a + $ hg qnew -d '0 0' -f -e patcha2 + +Create the reference queue: + + $ hg qsave -c -e -n refqueue + copy .*/t2/.hg/patches to .*/t2/.hg/refqueue + $ hg up -C 1 + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + +Merge: + + $ HGMERGE=internal:other hg qpush -a -m -n refqueue + merging with queue at: .*/t2/.hg/refqueue + applying patcha + patching file a + Hunk #1 FAILED at 0 + 1 out of 1 hunks FAILED -- saving rejects to file a.rej + patch failed, unable to continue (try -v) + patch failed, rejects left in working dir + patch didn't work out, merging patcha + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + 0 files updated, 2 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + applying patcha2 + now at: patcha2 + +Check patcha is still a git patch: + + $ cat .hg/patches/patcha + # HG changeset patch + # Parent d3873e73d99ef67873dac33fbcc66268d5d2b6f4 + + diff --git a/a b/a + --- a/a + +++ b/a + @@ -1,1 +1,2 @@ + -b + +a + +c + diff --git a/a b/aa + copy from a + copy to aa + --- a/a + +++ b/aa + @@ -1,1 +1,1 @@ + -b + +a + +Check patcha2 is still a regular patch: + + $ cat .hg/patches/patcha2 + # HG changeset patch + # Parent ........................................ + # Date 0 0 + + diff -r ............ -r ............ a + --- a/a + +++ b/a + @@ -1,2 +1,3 @@ + a + c + +d + + $ cd .. +
--- a/tests/test-mq-missingfiles Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -#!/bin/sh - -# Test issue835: -# qpush fails immediately when patching a missing file, but -# remaining added files are still created empty which will -# trick a future qrefresh. - -cat > writelines.py <<EOF -import sys -path = sys.argv[1] -args = sys.argv[2:] -assert (len(args) % 2) == 0 - -f = file(path, 'wb') -for i in xrange(len(args)/2): - count, s = args[2*i:2*i+2] - count = int(count) - s = s.decode('string_escape') - f.write(s*count) -f.close() - -EOF - -echo "[extensions]" >> $HGRCPATH -echo "mq=" >> $HGRCPATH - -hg init normal -cd normal -python ../writelines.py b 10 'a\n' -hg ci -Am addb -echo a > a -python ../writelines.py b 2 'b\n' 10 'a\n' 2 'c\n' -echo c > c -hg add a c -hg qnew -f changeb -hg qpop -hg rm b -hg ci -Am rmb -echo % push patch with missing target -hg qpush -echo % display added files -cat a -cat c -echo % display rejections -cat b.rej -cd .. - - -echo "[diff]" >> $HGRCPATH -echo "git=1" >> $HGRCPATH - -hg init git -cd git -python ../writelines.py b 1 '\x00' -hg ci -Am addb -echo a > a -python ../writelines.py b 1 '\x01' 1 '\x00' -echo c > c -hg add a c -hg qnew -f changeb -hg qpop -hg rm b -hg ci -Am rmb -echo % push git patch with missing target -hg qpush 2>&1 | sed -e 's/b:.*/b: No such file or directory/' -hg st -echo % display added files -cat a -cat c -echo % display rejections -cat b.rej -cd .. - -echo % test push creating directory during git copy or rename -hg init missingdir -cd missingdir -echo a > a -hg ci -Am adda -mkdir d -hg copy a d/a2 -hg mv a d/a -hg qnew -g -f patch -hg qpop -hg qpush -cd ..
--- a/tests/test-mq-missingfiles.out Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -adding b -popping changeb -patch queue now empty -% push patch with missing target -applying changeb -unable to find 'b' for patching -2 out of 2 hunks FAILED -- saving rejects to file b.rej -patch failed, unable to continue (try -v) -patch failed, rejects left in working dir -errors during apply, please fix and refresh changeb -% display added files -a -c -% display rejections ---- b -+++ b -@@ -1,3 +1,5 @@ -+b -+b - a - a - a -@@ -8,3 +10,5 @@ - a - a - a -+c -+c -adding b -popping changeb -patch queue now empty -% push git patch with missing target -applying changeb -unable to find 'b' for patching -1 out of 1 hunks FAILED -- saving rejects to file b.rej -patch failed, unable to continue (try -v) -b: No such file or directory -patch failed, rejects left in working dir -errors during apply, please fix and refresh changeb -? b.rej -% display added files -a -c -% display rejections ---- b -+++ b -GIT binary patch -literal 2 -Jc${No0000400IC2 - -% test push creating directory during git copy or rename -adding a -popping patch -patch queue now empty -applying patch -now at: patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-missingfiles.t Mon Sep 20 15:31:48 2010 -0500 @@ -0,0 +1,150 @@ + +# Test issue835: +# qpush fails immediately when patching a missing file, but +# remaining added files are still created empty which will +# trick a future qrefresh. + + $ cat > writelines.py <<EOF + > import sys + > path = sys.argv[1] + > args = sys.argv[2:] + > assert (len(args) % 2) == 0 + > + > f = file(path, 'wb') + > for i in xrange(len(args)/2): + > count, s = args[2*i:2*i+2] + > count = int(count) + > s = s.decode('string_escape') + > f.write(s*count) + > f.close() + > EOF + + $ echo "[extensions]" >> $HGRCPATH + $ echo "mq=" >> $HGRCPATH + + $ hg init normal + $ cd normal + $ python ../writelines.py b 10 'a\n' + $ hg ci -Am addb + adding b + $ echo a > a + $ python ../writelines.py b 2 'b\n' 10 'a\n' 2 'c\n' + $ echo c > c + $ hg add a c + $ hg qnew -f changeb + $ hg qpop + popping changeb + patch queue now empty + $ hg rm b + $ hg ci -Am rmb + +Push patch with missing target: + + $ hg qpush + applying changeb + unable to find 'b' for patching + 2 out of 2 hunks FAILED -- saving rejects to file b.rej + patch failed, unable to continue (try -v) + patch failed, rejects left in working dir + errors during apply, please fix and refresh changeb + [2] + +Display added files: + + $ cat a + a + $ cat c + c + +Display rejections: + + $ cat b.rej + --- b + +++ b + @@ -1,3 +1,5 @@ + +b + +b + a + a + a + @@ -8,3 +10,5 @@ + a + a + a + +c + +c + + $ cd .. + + + $ echo "[diff]" >> $HGRCPATH + $ echo "git=1" >> $HGRCPATH + + $ hg init git + $ cd git + $ python ../writelines.py b 1 '\x00' + $ hg ci -Am addb + adding b + $ echo a > a + $ python ../writelines.py b 1 '\x01' 1 '\x00' + $ echo c > c + $ hg add a c + $ hg qnew -f changeb + $ hg qpop + popping changeb + patch queue now empty + $ hg rm b + $ hg ci -Am rmb + +Push git patch with missing target: + + $ hg qpush + applying changeb + unable to find 'b' for patching + 1 out of 1 hunks FAILED -- saving rejects to file b.rej + patch failed, unable to continue (try -v) + b: No such file or directory + patch failed, rejects left in working dir + errors during apply, please fix and refresh changeb + [2] + $ hg st + ? b.rej + +Display added files: + + $ cat a + a + $ cat c + c + +Display rejections: + + $ cat b.rej + --- b + +++ b + GIT binary patch + literal 2 + Jc${No0000400IC2 + + $ cd .. + +Test push creating directory during git copy or rename: + + $ hg init missingdir + $ cd missingdir + $ echo a > a + $ hg ci -Am adda + adding a + $ mkdir d + $ hg copy a d/a2 + $ hg mv a d/a + $ hg qnew -g -f patch + $ hg qpop + popping patch + patch queue now empty + $ hg qpush + applying patch + now at: patch + + $ cd .. +
--- a/tests/test-mq-pull-from-bundle Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -#!/bin/sh - -cat <<EOF >> $HGRCPATH -[extensions] -mq= -[defaults] -log = --template "{rev}: {desc}\\n" -heads = --template "{rev}: {desc}\\n" -incoming = --template "{rev}: {desc}\\n" -EOF - -echo "====== Setup main" -hg init base -cd base -echo "One" > one -hg add -hg ci -m "main: one added." -echo "++" >> one -hg ci -m "main: one updated." - -echo "====== Bundle main" -hg bundle --base=null ../main.hg -cd .. - -echo "====== Incoming to fresh repo" -hg init fresh -echo ">> hg -R fresh incoming main.hg" -hg -R fresh incoming main.hg -echo ">> hg -R fresh incoming bundle:fresh+main.hg" -hg -R fresh incoming bundle:fresh+main.hg - - -echo "====== Setup queue" -cd base -hg qinit -c -hg qnew -m "patch: two added." two.patch -echo two > two -hg add -hg qrefresh -hg qcommit -m "queue: two.patch added." -hg qpop -a - -echo "====== Bundle queue" -hg -R .hg/patches bundle --base=null ../queue.hgq -cd .. - - -echo "====== Clone base" -hg clone base copy -cd copy -hg qinit -c - -echo "====== Incoming queue bundle" -echo ">> hg -R .hg/patches incoming ../queue.hgq" -hg -R .hg/patches incoming ../queue.hgq - -echo "====== Pull queue bundle" -echo ">> hg -R .hg/patches pull --update ../queue.hgq" -hg -R .hg/patches pull --update ../queue.hgq -echo ">> hg -R .hg/patches heads" -hg -R .hg/patches heads -echo ">> hg -R .hg/patches log" -hg -R .hg/patches log -echo ">> hg qseries" -hg qseries -cd .. - - -echo "====== Clone base again" -hg clone base copy2 -cd copy2 -hg qinit -c - -echo "====== Unbundle queue bundle" -echo ">> hg -R .hg/patches unbundle --update ../queue.hgq" -hg -R .hg/patches unbundle --update ../queue.hgq -echo ">> hg -R .hg/patches heads" -hg -R .hg/patches heads -echo ">> hg -R .hg/patches log" -hg -R .hg/patches log -echo ">> hg qseries" -hg qseries -cd ..
--- a/tests/test-mq-pull-from-bundle.out Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -====== Setup main -adding one -====== Bundle main -2 changesets found -====== Incoming to fresh repo ->> hg -R fresh incoming main.hg -comparing with main.hg -0: main: one added. -1: main: one updated. ->> hg -R fresh incoming bundle:fresh+main.hg -comparing with bundle:fresh+main.hg -0: main: one added. -1: main: one updated. -====== Setup queue -adding two -popping two.patch -patch queue now empty -====== Bundle queue -1 changesets found -====== Clone base -updating to branch default -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -====== Incoming queue bundle ->> hg -R .hg/patches incoming ../queue.hgq -comparing with ../queue.hgq -0: queue: two.patch added. -====== Pull queue bundle ->> hg -R .hg/patches pull --update ../queue.hgq -pulling from ../queue.hgq -requesting all changes -adding changesets -adding manifests -adding file changes -added 1 changesets with 3 changes to 3 files -merging series -2 files updated, 1 files merged, 0 files removed, 0 files unresolved ->> hg -R .hg/patches heads -0: queue: two.patch added. ->> hg -R .hg/patches log -0: queue: two.patch added. ->> hg qseries -two.patch -====== Clone base again -updating to branch default -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -====== Unbundle queue bundle ->> hg -R .hg/patches unbundle --update ../queue.hgq -adding changesets -adding manifests -adding file changes -added 1 changesets with 3 changes to 3 files -merging series -2 files updated, 1 files merged, 0 files removed, 0 files unresolved ->> hg -R .hg/patches heads -0: queue: two.patch added. ->> hg -R .hg/patches log -0: queue: two.patch added. ->> hg qseries -two.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-pull-from-bundle.t Mon Sep 20 15:31:48 2010 -0500 @@ -0,0 +1,131 @@ + $ cat <<EOF >> $HGRCPATH + > [extensions] + > mq= + > [alias] + > tlog = log --template "{rev}: {desc}\\n" + > theads = heads --template "{rev}: {desc}\\n" + > tincoming = incoming --template "{rev}: {desc}\\n" + > EOF + +Setup main: + + $ hg init base + $ cd base + $ echo "One" > one + $ hg add + adding one + $ hg ci -m "main: one added" + $ echo "++" >> one + $ hg ci -m "main: one updated" + +Bundle main: + + $ hg bundle --base=null ../main.hg + 2 changesets found + + $ cd .. + +Incoming to fresh repo: + + $ hg init fresh + + $ hg -R fresh tincoming main.hg + comparing with main.hg + 0: main: one added + 1: main: one updated + + $ hg -R fresh tincoming bundle:fresh+main.hg + comparing with bundle:fresh+main.hg + 0: main: one added + 1: main: one updated + + +Setup queue: + + $ cd base + $ hg qinit -c + $ hg qnew -m "patch: two added" two.patch + $ echo two > two + $ hg add + adding two + $ hg qrefresh + $ hg qcommit -m "queue: two.patch added" + $ hg qpop -a + popping two.patch + patch queue now empty + +Bundle queue: + + $ hg -R .hg/patches bundle --base=null ../queue.hgq + 1 changesets found + + $ cd .. + + +Clone base: + + $ hg clone base copy + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd copy + $ hg qinit -c + +Incoming queue bundle: + + $ hg -R .hg/patches tincoming ../queue.hgq + comparing with ../queue.hgq + 0: queue: two.patch added + +Pull queue bundle: + + $ hg -R .hg/patches pull --update ../queue.hgq + pulling from ../queue.hgq + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 3 changes to 3 files + merging series + 2 files updated, 1 files merged, 0 files removed, 0 files unresolved + + $ hg -R .hg/patches theads + 0: queue: two.patch added + + $ hg -R .hg/patches tlog + 0: queue: two.patch added + + $ hg qseries + two.patch + + $ cd .. + + +Clone base again: + + $ hg clone base copy2 + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd copy2 + $ hg qinit -c + +Unbundle queue bundle: + + $ hg -R .hg/patches unbundle --update ../queue.hgq + adding changesets + adding manifests + adding file changes + added 1 changesets with 3 changes to 3 files + merging series + 2 files updated, 1 files merged, 0 files removed, 0 files unresolved + + $ hg -R .hg/patches theads + 0: queue: two.patch added + + $ hg -R .hg/patches tlog + 0: queue: two.patch added + + $ hg qseries + two.patch + + $ cd .. +
--- a/tests/test-mq-qdelete Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -#!/bin/sh - -echo "[extensions]" >> $HGRCPATH -echo "mq=" >> $HGRCPATH - -hg init a -cd a - -echo 'base' > base -hg ci -Ambase -d '1 0' - -hg qnew -d '1 0' a -hg qnew -d '1 0' b -hg qnew -d '1 0' c - -hg qdel - -hg qdel c -hg qpop -hg qdel c -hg qseries -ls .hg/patches -hg qpop -hg qdel -k 1 -ls .hg/patches -hg qdel -r a -hg qapplied -hg log --template '{rev} {desc}\n' - -hg qnew d -hg qnew e -hg qnew f - -hg qdel -r e -hg qdel -r qbase:e -hg qapplied -hg log --template '{rev} {desc}\n' - -cd .. -hg init b -cd b - -echo 'base' > base -hg ci -Ambase -d '1 0' - -hg qfinish -hg qfinish -a - -hg qnew -d '1 0' a -hg qnew -d '1 0' b -hg qnew c # XXX fails to apply by /usr/bin/patch if we put a date - -hg qfinish 0 -hg qfinish b - -hg qpop -hg qfinish -a c -hg qpush - -hg qfinish qbase:b -hg qapplied -hg log --template '{rev} {desc}\n' - -hg qfinish -a c -hg qapplied -hg log --template '{rev} {desc}\n' -ls .hg/patches
--- a/tests/test-mq-qdelete.out Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -adding base -abort: qdelete requires at least one revision or patch name -abort: cannot delete applied patch c -popping c -now at: b -a -b -a -b -series -status -popping b -now at: a -a -b -series -status -patch a finalized without changeset message -1 [mq]: a -0 base -abort: cannot delete revision 3 above applied patches -patch d finalized without changeset message -patch e finalized without changeset message -f -4 [mq]: f -3 [mq]: e -2 [mq]: d -1 [mq]: a -0 base -adding base -abort: no revisions specified -no patches applied -abort: revision 0 is not managed -abort: cannot delete revision 2 above applied patches -popping c -now at: b -abort: unknown revision 'c'! -applying c -patch c is empty -now at: c -patch a finalized without changeset message -patch b finalized without changeset message -c -3 imported patch c -2 [mq]: b -1 [mq]: a -0 base -patch c finalized without changeset message -3 imported patch c -2 [mq]: b -1 [mq]: a -0 base -series -status
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-qdelete.t Mon Sep 20 15:31:48 2010 -0500 @@ -0,0 +1,150 @@ + $ echo "[extensions]" >> $HGRCPATH + $ echo "mq=" >> $HGRCPATH + + $ hg init a + $ cd a + + $ echo 'base' > base + $ hg ci -Ambase -d '1 0' + adding base + + $ hg qnew -d '1 0' a + $ hg qnew -d '1 0' b + $ hg qnew -d '1 0' c + + $ hg qdel + abort: qdelete requires at least one revision or patch name + [255] + + $ hg qdel c + abort: cannot delete applied patch c + [255] + + $ hg qpop + popping c + now at: b + + $ hg qdel c + + $ hg qseries + a + b + + $ ls .hg/patches + a + b + series + status + + $ hg qpop + popping b + now at: a + + $ hg qdel -k 1 + + $ ls .hg/patches + a + b + series + status + + $ hg qdel -r a + patch a finalized without changeset message + + $ hg qapplied + + $ hg log --template '{rev} {desc}\n' + 1 [mq]: a + 0 base + + $ hg qnew d + $ hg qnew e + $ hg qnew f + + $ hg qdel -r e + abort: cannot delete revision 3 above applied patches + [255] + + $ hg qdel -r qbase:e + patch d finalized without changeset message + patch e finalized without changeset message + + $ hg qapplied + f + + $ hg log --template '{rev} {desc}\n' + 4 [mq]: f + 3 [mq]: e + 2 [mq]: d + 1 [mq]: a + 0 base + + $ cd .. + + $ hg init b + $ cd b + + $ echo 'base' > base + $ hg ci -Ambase -d '1 0' + adding base + + $ hg qfinish + abort: no revisions specified + [255] + + $ hg qfinish -a + no patches applied + + $ hg qnew -d '1 0' a + $ hg qnew -d '1 0' b + $ hg qnew c # XXX fails to apply by /usr/bin/patch if we put a date + + $ hg qfinish 0 + abort: revision 0 is not managed + [255] + + $ hg qfinish b + abort: cannot delete revision 2 above applied patches + [255] + + $ hg qpop + popping c + now at: b + + $ hg qfinish -a c + abort: unknown revision 'c'! + [255] + + $ hg qpush + applying c + patch c is empty + now at: c + + $ hg qfinish qbase:b + patch a finalized without changeset message + patch b finalized without changeset message + + $ hg qapplied + c + + $ hg log --template '{rev} {desc}\n' + 3 imported patch c + 2 [mq]: b + 1 [mq]: a + 0 base + + $ hg qfinish -a c + patch c finalized without changeset message + + $ hg qapplied + + $ hg log --template '{rev} {desc}\n' + 3 imported patch c + 2 [mq]: b + 1 [mq]: a + 0 base + + $ ls .hg/patches + series + status +
--- a/tests/test-mq-qdiff Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -#!/bin/sh - -echo "[extensions]" >> $HGRCPATH -echo "mq=" >> $HGRCPATH -echo "[mq]" >> $HGRCPATH -echo "git=keep" >> $HGRCPATH - -echo % init -hg init a -cd a - -echo % commit -echo 'base' > base -hg ci -Ambase -d '1 0' - -echo % qnew mqbase -hg qnew -mmqbase mqbase - -echo % qrefresh -echo 'patched' > base -hg qrefresh - -echo % qdiff -hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo % qdiff dirname -hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo % qdiff filename -hg qdiff --nodates base - -echo % revert -hg revert -a - -echo % qpop -hg qpop - -echo % qdelete mqbase -hg qdelete mqbase - -echo % commit 2 -printf '1\n2\n3\n4\nhello world\ngoodbye world\n7\n8\n9\n' > lines -hg ci -Amlines -d '2 0' - -echo % qnew 2 -hg qnew -mmqbase2 mqbase2 -printf '\n\n1\n2\n3\n4\nhello world\n goodbye world\n7\n8\n9\n' > lines - -echo % qdiff -U 1 -hg qdiff --nodates -U 1 - -echo % qdiff -b -hg qdiff --nodates -b - -echo % qdiff -U 1 -B -hg qdiff --nodates -U 1 -B - -echo % qdiff -w -hg qdiff --nodates -w - -echo % qdiff --reverse -hg qdiff --nodates --reverse - -echo % qdiff preserve existing git flag -hg qrefresh --git -echo a >> lines -hg qdiff - -echo % qdiff --stat -hg qdiff --stat
--- a/tests/test-mq-qdiff.out Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -% init -% commit -adding base -% qnew mqbase -% qrefresh -% qdiff -diff -r 67e992f2c4f3 base ---- a/base -+++ b/base -@@ -1,1 +1,1 @@ --base -+patched -% qdiff dirname -diff -r 67e992f2c4f3 base ---- a/base -+++ b/base -@@ -1,1 +1,1 @@ --base -+patched -% qdiff filename -diff -r 67e992f2c4f3 base ---- a/base -+++ b/base -@@ -1,1 +1,1 @@ --base -+patched -% revert -% qpop -popping mqbase -patch queue now empty -% qdelete mqbase -% commit 2 -adding lines -% qnew 2 -% qdiff -U 1 -diff -r 35fb829491c1 lines ---- a/lines -+++ b/lines -@@ -1,1 +1,3 @@ -+ -+ - 1 -@@ -4,4 +6,4 @@ - 4 --hello world --goodbye world -+hello world -+ goodbye world - 7 -% qdiff -b -diff -r 35fb829491c1 lines ---- a/lines -+++ b/lines -@@ -1,9 +1,11 @@ -+ -+ - 1 - 2 - 3 - 4 - hello world --goodbye world -+ goodbye world - 7 - 8 - 9 -% qdiff -U 1 -B -diff -r 35fb829491c1 lines ---- a/lines -+++ b/lines -@@ -4,4 +6,4 @@ - 4 --hello world --goodbye world -+hello world -+ goodbye world - 7 -% qdiff -w -diff -r 35fb829491c1 lines ---- a/lines -+++ b/lines -@@ -1,3 +1,5 @@ -+ -+ - 1 - 2 - 3 -% qdiff --reverse -diff -r 35fb829491c1 lines ---- a/lines -+++ b/lines -@@ -1,11 +1,9 @@ -- -- - 1 - 2 - 3 - 4 --hello world -- goodbye world -+hello world -+goodbye world - 7 - 8 - 9 -% qdiff preserve existing git flag -diff --git a/lines b/lines ---- a/lines -+++ b/lines -@@ -1,9 +1,12 @@ -+ -+ - 1 - 2 - 3 - 4 --hello world --goodbye world -+hello world -+ goodbye world - 7 - 8 - 9 -+a -% qdiff --stat - lines | 7 +++++-- - 1 files changed, 5 insertions(+), 2 deletions(-)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-qdiff.t Mon Sep 20 15:31:48 2010 -0500 @@ -0,0 +1,166 @@ + $ echo "[extensions]" >> $HGRCPATH + $ echo "mq=" >> $HGRCPATH + $ echo "[mq]" >> $HGRCPATH + $ echo "git=keep" >> $HGRCPATH + + $ hg init a + $ cd a + + $ echo 'base' > base + $ hg ci -Ambase + adding base + + $ hg qnew -mmqbase mqbase + + $ echo 'patched' > base + $ hg qrefresh + +qdiff: + + $ hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" + diff -r d20a80d4def3 base + --- a/base Thu Jan 01 00:00:00 1970 +0000 + +++ b/base + @@ -1,1 +1,1 @@ + -base + +patched + +qdiff dirname: + + $ hg qdiff --nodates . + diff -r d20a80d4def3 base + --- a/base + +++ b/base + @@ -1,1 +1,1 @@ + -base + +patched + +qdiff filename: + + $ hg qdiff --nodates base + diff -r d20a80d4def3 base + --- a/base + +++ b/base + @@ -1,1 +1,1 @@ + -base + +patched + + $ hg revert -a + + $ hg qpop + popping mqbase + patch queue now empty + + $ hg qdelete mqbase + + $ printf '1\n2\n3\n4\nhello world\ngoodbye world\n7\n8\n9\n' > lines + $ hg ci -Amlines -d '2 0' + adding lines + + $ hg qnew -mmqbase2 mqbase2 + $ printf '\n\n1\n2\n3\n4\nhello world\n goodbye world\n7\n8\n9\n' > lines + + $ hg qdiff --nodates -U 1 + diff -r b0c220e1cf43 lines + --- a/lines + +++ b/lines + @@ -1,1 +1,3 @@ + + + + + 1 + @@ -4,4 +6,4 @@ + 4 + -hello world + -goodbye world + +hello world + + goodbye world + 7 + + $ hg qdiff --nodates -b + diff -r b0c220e1cf43 lines + --- a/lines + +++ b/lines + @@ -1,9 +1,11 @@ + + + + + 1 + 2 + 3 + 4 + hello world + -goodbye world + + goodbye world + 7 + 8 + 9 + + $ hg qdiff --nodates -U 1 -B + diff -r b0c220e1cf43 lines + --- a/lines + +++ b/lines + @@ -4,4 +6,4 @@ + 4 + -hello world + -goodbye world + +hello world + + goodbye world + 7 + + $ hg qdiff --nodates -w + diff -r b0c220e1cf43 lines + --- a/lines + +++ b/lines + @@ -1,3 +1,5 @@ + + + + + 1 + 2 + 3 + + $ hg qdiff --nodates --reverse + diff -r b0c220e1cf43 lines + --- a/lines + +++ b/lines + @@ -1,11 +1,9 @@ + - + - + 1 + 2 + 3 + 4 + -hello world + - goodbye world + +hello world + +goodbye world + 7 + 8 + 9 + +qdiff preserve existing git flag: + + $ hg qrefresh --git + $ echo a >> lines + $ hg qdiff + diff --git a/lines b/lines + --- a/lines + +++ b/lines + @@ -1,9 +1,12 @@ + + + + + 1 + 2 + 3 + 4 + -hello world + -goodbye world + +hello world + + goodbye world + 7 + 8 + 9 + +a + + $ hg qdiff --stat + lines | 7 +++++-- + 1 files changed, 5 insertions(+), 2 deletions(-) +
--- a/tests/test-mq-qfold Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -#!/bin/sh - -echo "[extensions]" >> $HGRCPATH -echo "mq=" >> $HGRCPATH -echo "[mq]" >> $HGRCPATH -echo "git=keep" >> $HGRCPATH - -filterdiff() -{ - grep -v diff | \ - sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" -} - -filterpatch() -{ - sed -e "s/\(# Parent \).*/\1/" -} - -echo '% init' -hg init repo -cd repo -echo a > a -hg ci -Am adda -echo a >> a -hg qnew -f p1 -echo b >> a -hg qnew -f p2 -echo c >> a -hg qnew -f p3 -echo '% fold in the middle of the queue' -hg qpop p1 -hg qdiff | filterdiff -hg qfold p2 -grep git .hg/patches/p1 && echo 'git patch found!' -hg qser -hg qdiff | filterdiff -echo '% fold with local changes' -echo d >> a -hg qfold p3 -hg diff -c . | filterdiff -hg revert -a --no-backup - -echo '% fold git patch into a regular patch, expect git patch' -echo a >> a -hg qnew -f regular -hg cp a aa -hg qnew --git -f git -hg qpop -hg qfold git -cat .hg/patches/regular | filterpatch -hg qpop -hg qdel regular - -echo '% fold regular patch into a git patch, expect git patch' -hg cp a aa -hg qnew --git -f git -echo b >> aa -hg qnew -f regular -hg qpop -hg qfold regular -cat .hg/patches/git | filterpatch - -cd .. - -
--- a/tests/test-mq-qfold.out Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -% init -adding a -% fold in the middle of the queue -popping p3 -popping p2 -now at: p1 ---- a/a -+++ b/a -@@ -1,1 +1,2 @@ - a -+a -p1 -p3 ---- a/a -+++ b/a -@@ -1,1 +1,3 @@ - a -+a -+b -% fold with local changes -abort: local changes found, refresh first ---- a/a -+++ b/a -@@ -1,1 +1,3 @@ - a -+a -+b -reverting a -% fold git patch into a regular patch, expect git patch -popping git -now at: regular -# HG changeset patch -# Parent - -diff --git a/a b/a ---- a/a -+++ b/a -@@ -1,3 +1,4 @@ - a - a - b -+a -diff --git a/a b/aa -copy from a -copy to aa ---- a/a -+++ b/aa -@@ -1,3 +1,4 @@ - a - a - b -+a -popping regular -now at: p1 -% fold regular patch into a git patch, expect git patch -popping regular -now at: git -# HG changeset patch -# Parent - -diff --git a/a b/aa -copy from a -copy to aa ---- a/a -+++ b/aa -@@ -1,3 +1,4 @@ - a - a - b -+b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-qfold.t Mon Sep 20 15:31:48 2010 -0500 @@ -0,0 +1,144 @@ + $ echo "[extensions]" >> $HGRCPATH + $ echo "mq=" >> $HGRCPATH + $ echo "[mq]" >> $HGRCPATH + $ echo "git=keep" >> $HGRCPATH + $ echo "[diff]" >> $HGRCPATH + $ echo "nodates=1" >> $HGRCPATH + +init: + + $ hg init repo + $ cd repo + $ echo a > a + $ hg ci -Am adda + adding a + $ echo a >> a + $ hg qnew -f p1 + $ echo b >> a + $ hg qnew -f p2 + $ echo c >> a + $ hg qnew -f p3 + +Fold in the middle of the queue: + + $ hg qpop p1 + popping p3 + popping p2 + now at: p1 + + $ hg qdiff + diff -r 07f494440405 a + --- a/a + +++ b/a + @@ -1,1 +1,2 @@ + a + +a + + $ hg qfold p2 + $ grep git .hg/patches/p1 && echo 'git patch found!' + [1] + + $ hg qser + p1 + p3 + + $ hg qdiff + diff -r 07f494440405 a + --- a/a + +++ b/a + @@ -1,1 +1,3 @@ + a + +a + +b + +Fold with local changes: + + $ echo d >> a + $ hg qfold p3 + abort: local changes found, refresh first + [255] + + $ hg diff -c . + diff -r 07f494440405 -r ............ a + --- a/a + +++ b/a + @@ -1,1 +1,3 @@ + a + +a + +b + + $ hg revert -a --no-backup + reverting a + +Fold git patch into a regular patch, expect git patch: + + $ echo a >> a + $ hg qnew -f regular + $ hg cp a aa + $ hg qnew --git -f git + + $ hg qpop + popping git + now at: regular + + $ hg qfold git + + $ cat .hg/patches/regular + # HG changeset patch + # Parent ........................................ + + diff --git a/a b/a + --- a/a + +++ b/a + @@ -1,3 +1,4 @@ + a + a + b + +a + diff --git a/a b/aa + copy from a + copy to aa + --- a/a + +++ b/aa + @@ -1,3 +1,4 @@ + a + a + b + +a + + $ hg qpop + popping regular + now at: p1 + + $ hg qdel regular + +Fold regular patch into a git patch, expect git patch: + + $ hg cp a aa + $ hg qnew --git -f git + $ echo b >> aa + $ hg qnew -f regular + + $ hg qpop + popping regular + now at: git + + $ hg qfold regular + + $ cat .hg/patches/git + # HG changeset patch + # Parent ........................................ + + diff --git a/a b/aa + copy from a + copy to aa + --- a/a + +++ b/aa + @@ -1,3 +1,4 @@ + a + a + b + +b + + $ cd .. +
--- a/tests/test-mq-qgoto Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -#!/bin/sh - -echo "[extensions]" >> $HGRCPATH -echo "mq=" >> $HGRCPATH - -hg init a -cd a -echo a > a -hg ci -Ama - -hg qnew a.patch -echo a >> a -hg qrefresh - -hg qnew b.patch -echo b > b -hg add b -hg qrefresh - -hg qnew c.patch -echo c > c -hg add c -hg qrefresh - -hg qgoto a.patch -hg qgoto c.patch -hg qgoto b.patch - -echo -echo % Using index -hg qgoto 0 -hg qgoto 2 - -echo -echo % No warnings when using index -hg qnew bug314159 -echo d >> c -hg qrefresh -hg qnew bug141421 -echo e >> c -hg qrefresh -hg qgoto 1 -hg qgoto 3 - -echo -echo % Detect ambiguous non-index -hg qgoto 14 - -exit 0
--- a/tests/test-mq-qgoto.out Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -adding a -popping c.patch -popping b.patch -now at: a.patch -applying b.patch -applying c.patch -now at: c.patch -popping c.patch -now at: b.patch - -% Using index -popping b.patch -now at: a.patch -applying b.patch -applying c.patch -now at: c.patch - -% No warnings when using index -popping bug141421 -popping bug314159 -popping c.patch -now at: b.patch -applying c.patch -applying bug314159 -now at: bug314159 - -% Detect ambiguous non-index -patch name "14" is ambiguous: - bug314159 - bug141421 -abort: patch 14 not in series
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-qgoto.t Mon Sep 20 15:31:48 2010 -0500 @@ -0,0 +1,77 @@ + $ echo "[extensions]" >> $HGRCPATH + $ echo "mq=" >> $HGRCPATH + + $ hg init a + $ cd a + $ echo a > a + $ hg ci -Ama + adding a + + $ hg qnew a.patch + $ echo a >> a + $ hg qrefresh + + $ hg qnew b.patch + $ echo b > b + $ hg add b + $ hg qrefresh + + $ hg qnew c.patch + $ echo c > c + $ hg add c + $ hg qrefresh + + $ hg qgoto a.patch + popping c.patch + popping b.patch + now at: a.patch + + $ hg qgoto c.patch + applying b.patch + applying c.patch + now at: c.patch + + $ hg qgoto b.patch + popping c.patch + now at: b.patch + +Using index: + + $ hg qgoto 0 + popping b.patch + now at: a.patch + + $ hg qgoto 2 + applying b.patch + applying c.patch + now at: c.patch + +No warnings when using index: + + $ hg qnew bug314159 + $ echo d >> c + $ hg qrefresh + $ hg qnew bug141421 + $ echo e >> c + $ hg qrefresh + + $ hg qgoto 1 + popping bug141421 + popping bug314159 + popping c.patch + now at: b.patch + + $ hg qgoto 3 + applying c.patch + applying bug314159 + now at: bug314159 + +Detect ambiguous non-index: + + $ hg qgoto 14 + patch name "14" is ambiguous: + bug314159 + bug141421 + abort: patch 14 not in series + [255] +
--- a/tests/test-mq-qqueue Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -#!/bin/sh - -echo "[extensions]" >> $HGRCPATH -echo "mq=" >> $HGRCPATH - -hg init foo -cd foo -echo a > a -hg ci -qAm a - -echo %% default queue -hg qqueue - -echo b > a -hg qnew -fgDU somestuff - -echo %% applied patches in default queue -hg qap - -echo %% try to change patch \(create succeeds, switch fails\) -hg qqueue foo --create -hg qqueue - -echo %% empty default queue -hg qpop - -echo %% switch queue -hg qqueue foo -hg qqueue - -echo %% list queues, quiet -hg qqueue --quiet - -echo %% fail creating queue with already existing name -hg qqueue --create foo -hg qqueue - -echo %% create new queue for rename -hg qqueue --create bar -hg qqueue - -echo %% rename queue, same name -hg qqueue --rename bar - -echo %% rename queue to existing -hg qqueue --rename foo - -echo %% rename queue -hg qqueue --rename buz -hg qqueue - -echo %% switch back to previous queue -hg qqueue foo -hg qqueue --delete buz -hg qqueue - -echo %% create queue for purge -hg qqueue --create purge-me -hg qqueue - -echo %% create patch for purge -hg qnew patch-purge-me -ls -1d .hg/patches-purge-me 2>/dev/null || true -hg qpop -a - -echo %% purge queue -hg qqueue foo -hg qqueue --purge purge-me -hg qqueue -ls -1d .hg/patches-purge-me 2>/dev/null || true - -echo %% unapplied patches -hg qun -echo c > a -hg qnew -fgDU otherstuff - -echo %% fail switching back -hg qqueue patches - -echo %% fail deleting current -hg qqueue foo --delete - -echo %% switch back and delete foo -hg qpop -a -hg qqueue patches -hg qqueue foo --delete -hg qqueue - -echo %% tricky cases -hg qqueue store --create -hg qnew journal -hg qqueue -hg qpop -a -hg qqueue patches -hg qun - -echo %% invalid names -hg qqueue test/../../bar --create -hg qqueue . --create - -cd ..
--- a/tests/test-mq-qqueue.out Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -%% default queue -patches (active) -%% applied patches in default queue -somestuff -%% try to change patch (create succeeds, switch fails) -abort: patches applied - cannot set new queue active -foo -patches (active) -%% empty default queue -popping somestuff -patch queue now empty -%% switch queue -foo (active) -patches -%% list queues, quiet -foo -patches -%% fail creating queue with already existing name -abort: queue "foo" already exists -foo (active) -patches -%% create new queue for rename -bar (active) -foo -patches -%% rename queue, same name -abort: can't rename "bar" to its current name -%% rename queue to existing -abort: queue "foo" already exists -%% rename queue -buz (active) -foo -patches -%% switch back to previous queue -foo (active) -patches -%% create queue for purge -foo -patches -purge-me (active) -%% create patch for purge -.hg/patches-purge-me -popping patch-purge-me -patch queue now empty -%% purge queue -foo (active) -patches -%% unapplied patches -%% fail switching back -abort: patches applied - cannot set new queue active -%% fail deleting current -abort: cannot delete currently active queue -%% switch back and delete foo -popping otherstuff -patch queue now empty -patches (active) -%% tricky cases -patches -store (active) -popping journal -patch queue now empty -somestuff -%% invalid names -abort: invalid queue name, may not contain the characters ":\/." -abort: invalid queue name, may not contain the characters ":\/."
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-qqueue.t Mon Sep 20 15:31:48 2010 -0500 @@ -0,0 +1,188 @@ + $ echo "[extensions]" >> $HGRCPATH + $ echo "mq=" >> $HGRCPATH + + $ hg init foo + $ cd foo + $ echo a > a + $ hg ci -qAm a + +Default queue: + + $ hg qqueue + patches (active) + + $ echo b > a + $ hg qnew -fgDU somestuff + +Applied patches in default queue: + + $ hg qap + somestuff + +Try to change patch (create succeeds, switch fails): + + $ hg qqueue foo --create + abort: patches applied - cannot set new queue active + [255] + + $ hg qqueue + foo + patches (active) + +Empty default queue: + + $ hg qpop + popping somestuff + patch queue now empty + +Switch queue: + + $ hg qqueue foo + $ hg qqueue + foo (active) + patches + +List queues, quiet: + + $ hg qqueue --quiet + foo + patches + +Fail creating queue with already existing name: + + $ hg qqueue --create foo + abort: queue "foo" already exists + [255] + + $ hg qqueue + foo (active) + patches + +Create new queue for rename: + + $ hg qqueue --create bar + + $ hg qqueue + bar (active) + foo + patches + +Rename queue, same name: + + $ hg qqueue --rename bar + abort: can't rename "bar" to its current name + [255] + +Rename queue to existing: + + $ hg qqueue --rename foo + abort: queue "foo" already exists + [255] + +Rename queue: + + $ hg qqueue --rename buz + + $ hg qqueue + buz (active) + foo + patches + +Switch back to previous queue: + + $ hg qqueue foo + $ hg qqueue --delete buz + + $ hg qqueue + foo (active) + patches + +Create queue for purge: + + $ hg qqueue --create purge-me + + $ hg qqueue + foo + patches + purge-me (active) + +Create patch for purge: + + $ hg qnew patch-purge-me + + $ ls -1d .hg/patches-purge-me 2>/dev/null || true + .hg/patches-purge-me + + $ hg qpop -a + popping patch-purge-me + patch queue now empty + +Purge queue: + + $ hg qqueue foo + $ hg qqueue --purge purge-me + + $ hg qqueue + foo (active) + patches + + $ ls -1d .hg/patches-purge-me 2>/dev/null || true + +Unapplied patches: + + $ hg qun + $ echo c > a + $ hg qnew -fgDU otherstuff + +Fail switching back: + + $ hg qqueue patches + abort: patches applied - cannot set new queue active + [255] + +Fail deleting current: + + $ hg qqueue foo --delete + abort: cannot delete currently active queue + [255] + +Switch back and delete foo: + + $ hg qpop -a + popping otherstuff + patch queue now empty + + $ hg qqueue patches + $ hg qqueue foo --delete + $ hg qqueue + patches (active) + +Tricky cases: + + $ hg qqueue store --create + $ hg qnew journal + + $ hg qqueue + patches + store (active) + + $ hg qpop -a + popping journal + patch queue now empty + + $ hg qqueue patches + $ hg qun + somestuff + +Invalid names: + + $ hg qqueue test/../../bar --create + abort: invalid queue name, may not contain the characters ":\/." + [255] + + $ hg qqueue . --create + abort: invalid queue name, may not contain the characters ":\/." + [255] + + $ cd .. +
--- a/tests/test-mq-qrefresh Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,198 +0,0 @@ -#!/bin/sh - -echo "[extensions]" >> $HGRCPATH -echo "mq=" >> $HGRCPATH - -catpatch() { - cat $1 | sed -e "s/^\(# Parent \).*/\1/" -} - -echo % init -hg init a -cd a - -echo % commit -mkdir 1 2 -echo 'base' > 1/base -echo 'base' > 2/base -hg ci -Ambase -d '1 0' - -echo % qnew mqbase -hg qnew -mmqbase mqbase - -echo % qrefresh -echo 'patched' > 1/base -echo 'patched' > 2/base -hg qrefresh - -echo % qdiff -hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo % qdiff dirname -hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo % patch file contents -catpatch .hg/patches/mqbase | \ -sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo % qrefresh 1 -echo 'patched again' > base -hg qrefresh 1 - -echo % qdiff -hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo % qdiff dirname -hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo % patch file contents -catpatch .hg/patches/mqbase | \ -sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo % qrefresh . in subdir -( cd 1 ; hg qrefresh . ) - -echo % qdiff -hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo % qdiff dirname -hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo % patch file contents -catpatch .hg/patches/mqbase | \ -sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo % qrefresh in hg-root again -hg qrefresh - -echo % qdiff -hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo % qdiff dirname -hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo % patch file contents -catpatch .hg/patches/mqbase | \ -sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo -echo % qrefresh --short tests: -echo 'orphan' > orphanchild -hg add orphanchild - -echo % - add 1/base and 2/base one by one -hg qrefresh nonexistingfilename # clear patch -hg qrefresh --short 1/base -hg qrefresh --short 2/base - -echo % -- qdiff output -hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" - -echo % -- patch file content -catpatch .hg/patches/mqbase | \ -sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" -hg st - -echo % -- diff shows what is not in patch -hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" \ - -e "s/^\(diff\).*/\1/" -echo % - before starting exclusive tests -sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase -echo % - exclude 2/base -hg qref -s -X 2/base -sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase -echo % -- status shows 2/base as dirty -hg st -echo % - remove 1/base and add 2/base again but not orphanchild -hg qref -s -X orphanchild -X 1/base 2/base orphanchild -sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase -echo % - add 1/base with include filter - and thus remove 2/base from patch -hg qref -s -I 1/ o* */* -sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase -echo -cd .. - -# Test qrefresh --git losing copy metadata -echo % create test repo -hg init repo -cd repo -echo "[diff]" >> .hg/hgrc -echo "git=True" >> .hg/hgrc -echo a > a -hg ci -Am adda -hg copy a ab -echo b >> ab -hg copy a ac -echo c >> ac -echo % capture changes -hg qnew -f p1 -hg qdiff -echo % refresh and check changes again -hg qref -hg qdiff -cd .. - -# Test issue 1441: qrefresh confused after hg rename -echo % issue1441 without git patches -hg init repo-1441 -cd repo-1441 -echo a > a -hg add a -hg qnew -f p -hg mv a b -hg qrefresh -hg qdiff --nodates -cd .. - -echo '% issue2025: qrefresh does not honor filtering options when tip != qtip' -hg init repo-2025 -cd repo-2025 -echo a > a -echo b > b -hg ci -qAm addab -echo a >> a -echo b >> b -hg qnew -f patch -hg up -qC 0 -echo c > c -hg ci -qAm addc -hg up -qC 1 -echo '% refresh with tip != qtip' -hg --config diff.nodates=1 qrefresh -I b 2>&1 \ - | sed 's/saving bundle.*/saving bundle.../g' -echo '% status after refresh' -hg st -echo '% b after refresh' -cat b -echo '% patch file after refresh' -catpatch .hg/patches/patch -cd .. - - -echo % issue1441 with git patches -hg init repo-1441-git -cd repo-1441-git -echo "[diff]" >> .hg/hgrc -echo "git=True" >> .hg/hgrc -echo a > a -hg add a -hg qnew -f p -hg mv a b -hg qrefresh -hg qdiff --nodates -cd ..
--- a/tests/test-mq-qrefresh.out Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,295 +0,0 @@ -% init -% commit -adding 1/base -adding 2/base -% qnew mqbase -% qrefresh -% qdiff -diff -r b55ecdccb5cf 1/base ---- a/1/base -+++ b/1/base -@@ -1,1 +1,1 @@ --base -+patched -diff -r b55ecdccb5cf 2/base ---- a/2/base -+++ b/2/base -@@ -1,1 +1,1 @@ --base -+patched -% qdiff dirname -diff -r b55ecdccb5cf 1/base ---- a/1/base -+++ b/1/base -@@ -1,1 +1,1 @@ --base -+patched -diff -r b55ecdccb5cf 2/base ---- a/2/base -+++ b/2/base -@@ -1,1 +1,1 @@ --base -+patched -% patch file contents -# HG changeset patch -# Parent -mqbase - -diff -r b55ecdccb5cf 1/base ---- a/1/base -+++ b/1/base -@@ -1,1 +1,1 @@ --base -+patched -diff -r b55ecdccb5cf 2/base ---- a/2/base -+++ b/2/base -@@ -1,1 +1,1 @@ --base -+patched -% qrefresh 1 -% qdiff -diff -r b55ecdccb5cf 1/base ---- a/1/base -+++ b/1/base -@@ -1,1 +1,1 @@ --base -+patched -diff -r b55ecdccb5cf 2/base ---- a/2/base -+++ b/2/base -@@ -1,1 +1,1 @@ --base -+patched -% qdiff dirname -diff -r b55ecdccb5cf 1/base ---- a/1/base -+++ b/1/base -@@ -1,1 +1,1 @@ --base -+patched -diff -r b55ecdccb5cf 2/base ---- a/2/base -+++ b/2/base -@@ -1,1 +1,1 @@ --base -+patched -% patch file contents -# HG changeset patch -# Parent -mqbase - -diff -r b55ecdccb5cf 1/base ---- a/1/base -+++ b/1/base -@@ -1,1 +1,1 @@ --base -+patched -% qrefresh . in subdir -% qdiff -diff -r b55ecdccb5cf 1/base ---- a/1/base -+++ b/1/base -@@ -1,1 +1,1 @@ --base -+patched -diff -r b55ecdccb5cf 2/base ---- a/2/base -+++ b/2/base -@@ -1,1 +1,1 @@ --base -+patched -% qdiff dirname -diff -r b55ecdccb5cf 1/base ---- a/1/base -+++ b/1/base -@@ -1,1 +1,1 @@ --base -+patched -diff -r b55ecdccb5cf 2/base ---- a/2/base -+++ b/2/base -@@ -1,1 +1,1 @@ --base -+patched -% patch file contents -# HG changeset patch -# Parent -mqbase - -diff -r b55ecdccb5cf 1/base ---- a/1/base -+++ b/1/base -@@ -1,1 +1,1 @@ --base -+patched -% qrefresh in hg-root again -% qdiff -diff -r b55ecdccb5cf 1/base ---- a/1/base -+++ b/1/base -@@ -1,1 +1,1 @@ --base -+patched -diff -r b55ecdccb5cf 2/base ---- a/2/base -+++ b/2/base -@@ -1,1 +1,1 @@ --base -+patched -% qdiff dirname -diff -r b55ecdccb5cf 1/base ---- a/1/base -+++ b/1/base -@@ -1,1 +1,1 @@ --base -+patched -diff -r b55ecdccb5cf 2/base ---- a/2/base -+++ b/2/base -@@ -1,1 +1,1 @@ --base -+patched -% patch file contents -# HG changeset patch -# Parent -mqbase - -diff -r b55ecdccb5cf 1/base ---- a/1/base -+++ b/1/base -@@ -1,1 +1,1 @@ --base -+patched -diff -r b55ecdccb5cf 2/base ---- a/2/base -+++ b/2/base -@@ -1,1 +1,1 @@ --base -+patched - -% qrefresh --short tests: -% - add 1/base and 2/base one by one -% -- qdiff output -diff -r b55ecdccb5cf 1/base ---- a/1/base -+++ b/1/base -@@ -1,1 +1,1 @@ --base -+patched -diff -r b55ecdccb5cf 2/base ---- a/2/base -+++ b/2/base -@@ -1,1 +1,1 @@ --base -+patched -diff -r b55ecdccb5cf orphanchild ---- /dev/null -+++ b/orphanchild -@@ -0,0 +1,1 @@ -+orphan -% -- patch file content -# HG changeset patch -# Parent -mqbase - -diff -r b55ecdccb5cf 1/base ---- a/1/base -+++ b/1/base -@@ -1,1 +1,1 @@ --base -+patched -diff -r b55ecdccb5cf 2/base ---- a/2/base -+++ b/2/base -@@ -1,1 +1,1 @@ --base -+patched -A orphanchild -? base -% -- diff shows what is not in patch -diff ---- /dev/null -+++ b/orphanchild -@@ -0,0 +1,1 @@ -+orphan -% - before starting exclusive tests -1/base -2/base -% - exclude 2/base -1/base -% -- status shows 2/base as dirty -M 2/base -A orphanchild -? base -% - remove 1/base and add 2/base again but not orphanchild -2/base -% - add 1/base with include filter - and thus remove 2/base from patch -1/base - -% create test repo -adding a -% capture changes -diff --git a/a b/ab -copy from a -copy to ab ---- a/a -+++ b/ab -@@ -1,1 +1,2 @@ - a -+b -diff --git a/a b/ac -copy from a -copy to ac ---- a/a -+++ b/ac -@@ -1,1 +1,2 @@ - a -+c -% refresh and check changes again -diff --git a/a b/ab -copy from a -copy to ab ---- a/a -+++ b/ab -@@ -1,1 +1,2 @@ - a -+b -diff --git a/a b/ac -copy from a -copy to ac ---- a/a -+++ b/ac -@@ -1,1 +1,2 @@ - a -+c -% issue1441 without git patches -diff -r 000000000000 b ---- /dev/null -+++ b/b -@@ -0,0 +1,1 @@ -+a -% issue2025: qrefresh does not honor filtering options when tip != qtip -% refresh with tip != qtip -% status after refresh -M a -% b after refresh -b -b -% patch file after refresh -# HG changeset patch -# Parent - -diff -r 1a60229be7ac b ---- a/b -+++ b/b -@@ -1,1 +1,2 @@ - b -+b -% issue1441 with git patches -diff --git a/b b/b -new file mode 100644 ---- /dev/null -+++ b/b -@@ -0,0 +1,1 @@ -+a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-qrefresh.t Mon Sep 20 15:31:48 2010 -0500 @@ -0,0 +1,488 @@ + $ echo "[extensions]" >> $HGRCPATH + $ echo "mq=" >> $HGRCPATH + $ echo "[diff]" >> $HGRCPATH + $ echo "nodates=1" >> $HGRCPATH + + $ hg init a + $ cd a + + $ mkdir 1 2 + $ echo 'base' > 1/base + $ echo 'base' > 2/base + $ hg ci -Ambase + adding 1/base + adding 2/base + + $ hg qnew -mmqbase mqbase + + $ echo 'patched' > 1/base + $ echo 'patched' > 2/base + $ hg qrefresh + + $ hg qdiff + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + diff -r e7af5904b465 2/base + --- a/2/base + +++ b/2/base + @@ -1,1 +1,1 @@ + -base + +patched + + $ hg qdiff . + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + diff -r e7af5904b465 2/base + --- a/2/base + +++ b/2/base + @@ -1,1 +1,1 @@ + -base + +patched + + $ cat .hg/patches/mqbase + # HG changeset patch + # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa + mqbase + + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + diff -r e7af5904b465 2/base + --- a/2/base + +++ b/2/base + @@ -1,1 +1,1 @@ + -base + +patched + + $ echo 'patched again' > base + $ hg qrefresh 1 + + $ hg qdiff + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + diff -r e7af5904b465 2/base + --- a/2/base + +++ b/2/base + @@ -1,1 +1,1 @@ + -base + +patched + + $ hg qdiff . + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + diff -r e7af5904b465 2/base + --- a/2/base + +++ b/2/base + @@ -1,1 +1,1 @@ + -base + +patched + + $ cat .hg/patches/mqbase + # HG changeset patch + # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa + mqbase + + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + +qrefresh . in subdir: + + $ ( cd 1 ; hg qrefresh . ) + + $ hg qdiff + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + diff -r e7af5904b465 2/base + --- a/2/base + +++ b/2/base + @@ -1,1 +1,1 @@ + -base + +patched + + $ hg qdiff . + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + diff -r e7af5904b465 2/base + --- a/2/base + +++ b/2/base + @@ -1,1 +1,1 @@ + -base + +patched + + $ cat .hg/patches/mqbase + # HG changeset patch + # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa + mqbase + + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + +qrefresh in hg-root again: + + $ hg qrefresh + + $ hg qdiff + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + diff -r e7af5904b465 2/base + --- a/2/base + +++ b/2/base + @@ -1,1 +1,1 @@ + -base + +patched + + $ hg qdiff . + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + diff -r e7af5904b465 2/base + --- a/2/base + +++ b/2/base + @@ -1,1 +1,1 @@ + -base + +patched + + $ cat .hg/patches/mqbase + # HG changeset patch + # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa + mqbase + + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + diff -r e7af5904b465 2/base + --- a/2/base + +++ b/2/base + @@ -1,1 +1,1 @@ + -base + +patched + + +qrefresh --short tests: + + $ echo 'orphan' > orphanchild + $ hg add orphanchild + $ hg qrefresh nonexistingfilename # clear patch + $ hg qrefresh --short 1/base + $ hg qrefresh --short 2/base + + $ hg qdiff + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + diff -r e7af5904b465 2/base + --- a/2/base + +++ b/2/base + @@ -1,1 +1,1 @@ + -base + +patched + diff -r e7af5904b465 orphanchild + --- /dev/null + +++ b/orphanchild + @@ -0,0 +1,1 @@ + +orphan + + $ cat .hg/patches/mqbase + # HG changeset patch + # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa + mqbase + + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + diff -r e7af5904b465 2/base + --- a/2/base + +++ b/2/base + @@ -1,1 +1,1 @@ + -base + +patched + + $ hg st + A orphanchild + ? base + +diff shows what is not in patch: + + $ hg diff + diff -r ............ orphanchild + --- /dev/null + +++ b/orphanchild + @@ -0,0 +1,1 @@ + +orphan + +Before starting exclusive tests: + + $ cat .hg/patches/mqbase + # HG changeset patch + # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa + mqbase + + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + diff -r e7af5904b465 2/base + --- a/2/base + +++ b/2/base + @@ -1,1 +1,1 @@ + -base + +patched + +Exclude 2/base: + + $ hg qref -s -X 2/base + + $ cat .hg/patches/mqbase + # HG changeset patch + # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa + mqbase + + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + +status shows 2/base as dirty: + + $ hg status + M 2/base + A orphanchild + ? base + +Remove 1/base and add 2/base again but not orphanchild: + + $ hg qref -s -X orphanchild -X 1/base 2/base orphanchild + + $ cat .hg/patches/mqbase + # HG changeset patch + # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa + mqbase + + diff -r e7af5904b465 2/base + --- a/2/base + +++ b/2/base + @@ -1,1 +1,1 @@ + -base + +patched + +Add 1/base with include filter - and thus remove 2/base from patch: + + $ hg qref -s -I 1/ o* */* + + $ cat .hg/patches/mqbase + # HG changeset patch + # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa + mqbase + + diff -r e7af5904b465 1/base + --- a/1/base + +++ b/1/base + @@ -1,1 +1,1 @@ + -base + +patched + + $ cd .. + + +Test qrefresh --git losing copy metadata: + + $ hg init repo + $ cd repo + + $ echo "[diff]" >> .hg/hgrc + $ echo "git=True" >> .hg/hgrc + $ echo a > a + + $ hg ci -Am adda + adding a + $ hg copy a ab + $ echo b >> ab + $ hg copy a ac + $ echo c >> ac + +Capture changes: + + $ hg qnew -f p1 + + $ hg qdiff + diff --git a/a b/ab + copy from a + copy to ab + --- a/a + +++ b/ab + @@ -1,1 +1,2 @@ + a + +b + diff --git a/a b/ac + copy from a + copy to ac + --- a/a + +++ b/ac + @@ -1,1 +1,2 @@ + a + +c + +Refresh and check changes again: + + $ hg qrefresh + + $ hg qdiff + diff --git a/a b/ab + copy from a + copy to ab + --- a/a + +++ b/ab + @@ -1,1 +1,2 @@ + a + +b + diff --git a/a b/ac + copy from a + copy to ac + --- a/a + +++ b/ac + @@ -1,1 +1,2 @@ + a + +c + + $ cd .. + + +Test issue 1441: qrefresh confused after hg rename: + + $ hg init repo-1441 + $ cd repo-1441 + $ echo a > a + $ hg add a + $ hg qnew -f p + $ hg mv a b + $ hg qrefresh + + $ hg qdiff + diff -r 000000000000 b + --- /dev/null + +++ b/b + @@ -0,0 +1,1 @@ + +a + + $ cd .. + + +Issue2025: qrefresh does not honor filtering options when tip != qtip: + + $ hg init repo-2025 + $ cd repo-2025 + $ echo a > a + $ echo b > b + $ hg ci -qAm addab + $ echo a >> a + $ echo b >> b + $ hg qnew -f patch + $ hg up -qC 0 + $ echo c > c + $ hg ci -qAm addc + $ hg up -qC 1 + +refresh with tip != qtip: + + $ hg --config diff.nodates=1 qrefresh -I b + + $ hg st + M a + + $ cat b + b + b + + $ cat .hg/patches/patch + # HG changeset patch + # Parent 1a60229be7ac3e4a7f647508e99b87bef1f03593 + + diff -r 1a60229be7ac b + --- a/b + +++ b/b + @@ -1,1 +1,2 @@ + b + +b + + $ cd .. + + +Issue1441 with git patches: + + $ hg init repo-1441-git + $ cd repo-1441-git + + $ echo "[diff]" >> .hg/hgrc + $ echo "git=True" >> .hg/hgrc + + $ echo a > a + $ hg add a + $ hg qnew -f p + $ hg mv a b + $ hg qrefresh + + $ hg qdiff --nodates + diff --git a/b b/b + new file mode 100644 + --- /dev/null + +++ b/b + @@ -0,0 +1,1 @@ + +a + + $ cd .. +
--- a/tests/test-mq-qrename Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -#!/bin/sh - -echo "[extensions]" >> $HGRCPATH -echo "mq=" >> $HGRCPATH - -hg init a -cd a - -echo 'base' > base -hg ci -Ambase -d '1 0' - -hg qnew -mmqbase mqbase -hg qrename mqbase renamed -mkdir .hg/patches/foo -hg qrename renamed foo -hg qseries -ls .hg/patches/foo -mkdir .hg/patches/bar -hg qrename foo/renamed bar -hg qseries -ls .hg/patches/bar -hg qrename bar/renamed baz -hg qseries -ls .hg/patches/baz -hg qrename baz new/dir -hg qseries -ls .hg/patches/new/dir -cd .. - -echo % test patch being renamed before committed -hg init b -cd b -hg qinit -c -hg qnew x -hg qrename y -hg qcommit -m rename -cd .. - -
--- a/tests/test-mq-qrename.out Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -adding base -foo/renamed -renamed -bar/renamed -renamed -baz -.hg/patches/baz -new/dir -.hg/patches/new/dir -% test patch being renamed before committed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-qrename.t Mon Sep 20 15:31:48 2010 -0500 @@ -0,0 +1,62 @@ + + $ echo "[extensions]" >> $HGRCPATH + $ echo "mq=" >> $HGRCPATH + + $ hg init a + $ cd a + + $ echo 'base' > base + $ hg ci -Ambase + adding base + + $ hg qnew -mmqbase mqbase + + $ hg qrename mqbase renamed + $ mkdir .hg/patches/foo + $ hg qrename renamed foo + + $ hg qseries + foo/renamed + + $ ls .hg/patches/foo + renamed + + $ mkdir .hg/patches/bar + $ hg qrename foo/renamed bar + + $ hg qseries + bar/renamed + + $ ls .hg/patches/bar + renamed + + $ hg qrename bar/renamed baz + + $ hg qseries + baz + + $ ls .hg/patches/baz + .hg/patches/baz + + $ hg qrename baz new/dir + + $ hg qseries + new/dir + + $ ls .hg/patches/new/dir + .hg/patches/new/dir + + $ cd .. + +Test patch being renamed before committed: + + $ hg init b + $ cd b + $ hg qinit -c + $ hg qnew x + $ hg qrename y + $ hg qcommit -m rename + + $ cd .. + +
--- a/tests/test-mq-qsave Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -#!/bin/sh - -echo "[extensions]" >> $HGRCPATH -echo "mq=" >> $HGRCPATH - -hg init a -cd a - -echo 'base' > base -hg ci -Ambase -d '1 0' - -hg qnew -mmqbase mqbase - -hg qsave -hg qrestore 2
--- a/tests/test-mq-qsave.out Mon Sep 20 15:46:17 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -adding base -restoring status: hg patches saved state
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-mq-qsave.t Mon Sep 20 15:31:48 2010 -0500 @@ -0,0 +1,15 @@ + $ echo "[extensions]" >> $HGRCPATH + $ echo "mq=" >> $HGRCPATH + + $ hg init + + $ echo 'base' > base + $ hg ci -Ambase + adding base + + $ hg qnew -mmqbase mqbase + + $ hg qsave + $ hg qrestore 2 + restoring status: hg patches saved state +