##// END OF EJS Templates
diffstat: fix parsing of filenames with spaces...
diffstat: fix parsing of filenames with spaces The patch changes the output of "hg diff --stat" when one file whose filename has spaces has changed, making it get the full filename instead of just the substring between the last space and the end of the filename. It also changes the diffstat generated by "hg email -d" when one of the commit messages starts with "diff". Because of the regex used to parse the filename, the diffstat generated by "hg email -d" will still be not correct if a commit message starts with "diff -r ". Before the patch Mercurial has the following behavior: $ echo "foobar">"file with spaces" $ hg add "file with spaces" $ hg diff --stat spaces | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) $ hg diff --git --stat file with spaces | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) After the patch: $ echo "foobar">"file with spaces" $ hg add "file with spaces" $ hg diff --stat file with spaces | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) $ hg diff --git --stat file with spaces | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) Before the patch: $ hg add mercurial/patch.py tests/tests-diffstat.t $ hg commit -m "diffstat: fix parsing of filenames" $ hg email -d --test tip This patch series consists of 1 patches. diffstat: fix parsing of filenames [...] filenames | 0 mercurial/patch.py | 6 ++++-- tests/test-diffstat.t | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) [...] After the patch: $ hg email -d --test tip This patch series consists of 1 patches. diffstat: fix parsing of filenames [...] mercurial/patch.py | 6 ++++-- tests/test-diffstat.t | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) [...]

File last commit:

r10275:3a1f29b6 stable
r13395:104c9ed9 default
Show More
test-convert-p4-filetypes
104 lines | 2.7 KiB | text/plain | TextLexer
/ tests / test-convert-p4-filetypes
#!/bin/sh
"$TESTDIR/hghave" p4 execbit symlink || exit 80
echo "[extensions]" >> $HGRCPATH
echo "convert = " >> $HGRCPATH
echo % create p4 depot
P4ROOT=`pwd`/depot; export P4ROOT
P4AUDIT=$P4ROOT/audit; export P4AUDIT
P4JOURNAL=$P4ROOT/journal; export P4JOURNAL
P4LOG=$P4ROOT/log; export P4LOG
P4PORT=localhost:16661; export P4PORT
P4DEBUG=1; export P4DEBUG
P4CHARSET=utf8; export P4CHARSET
echo % start the p4 server
[ ! -d $P4ROOT ] && mkdir $P4ROOT
p4d -f -J off -xi >$P4ROOT/stdout 2>$P4ROOT/stderr
p4d -f -J off >$P4ROOT/stdout 2>$P4ROOT/stderr &
trap "echo % stop the p4 server ; p4 admin stop" EXIT
# wait for the server to initialize
while ! p4 ; do
sleep 1
done >/dev/null 2>/dev/null
echo % create a client spec
P4CLIENT=hg-p4-import; export P4CLIENT
DEPOTPATH=//depot/test-mercurial-import/...
p4 client -o | sed '/^View:/,$ d' >p4client
echo View: >>p4client
echo " $DEPOTPATH //$P4CLIENT/..." >>p4client
p4 client -i <p4client
echo % populate the depot
TYPES="text binary symlink"
TYPES="$TYPES text+m text+w text+x text+k text+kx text+ko text+l text+C text+D text+F text+S text+S2"
TYPES="$TYPES binary+k binary+x binary+kx symlink+k"
TYPES="$TYPES ctext cxtext ktext kxtext ltext tempobj ubinary uxbinary xbinary xltext xtempobj xtext"
# not testing these
#TYPES="$TYPES apple resource unicode utf16 uresource xunicode xutf16"
for T in $TYPES ; do
T2=`echo $T | tr [:upper:] [:lower:]`
case $T in
apple)
;;
symlink*)
echo "this is target $T" >target_$T2
ln -s target_$T file_$T2
p4 add target_$T2
p4 add -t $T file_$T2
;;
binary*)
python -c "file('file_$T2', 'wb').write('this is $T')"
p4 add -t $T file_$T2
;;
*)
echo "this is $T" >file_$T2
p4 add -t $T file_$T2
;;
esac
done
p4 submit -d initial
echo % test keyword expansion
p4 edit file_* target_*
for T in $TYPES ; do
T2=`echo $T | tr [:upper:] [:lower:]`
echo '$Id$' >>file_$T2
echo '$Header$' >>file_$T2
echo '$Date$' >>file_$T2
echo '$DateTime$' >>file_$T2
echo '$Change$' >>file_$T2
echo '$File$' >>file_$T2
echo '$Revision$' >>file_$T2
echo '$Header$$Header$Header$' >>file_$T2
done
ln -s 'target_$Header$' crazy_symlink+k
p4 add -t symlink+k crazy_symlink+k
p4 submit -d keywords
echo % check keywords in p4
grep -H Header file_*
echo % convert
hg convert -s p4 $DEPOTPATH dst
hg -R dst log --template 'rev={rev} desc="{desc}" tags="{tags}" files="{files}"\n'g
echo % revision 0
hg -R dst update 0
head dst/file_* | cat -v
echo
echo % revision 1
hg -R dst update 1
head dst/file_* | cat -v
echo
echo % crazy_symlink
readlink crazy_symlink+k
readlink dst/crazy_symlink+k