view tests/test-mq-qrefresh @ 5403:477136fa6571

Always copy the necessary files before applying a git patch This patch removes the "copymod" attribute from the gitpatch class. AFAICS, that attribute was only used to delay the copying of renamed/copied files if there are no other changes to the target, but in this case, if there are changes to the source, we'll end up copying the wrong version. This should fix issue762.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 06 Oct 2007 15:30:15 -0300
parents f01efb4bc258
children
line wrap: on
line source

#!/bin/sh

echo "[extensions]" >> $HGRCPATH
echo "mq=" >> $HGRCPATH

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
cat .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
cat .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
cat .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
cat .hg/patches/mqbase | \
sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
    -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"