##// END OF EJS Templates
actually port simplemerge to hg...
actually port simplemerge to hg - use bdiff instead of patiencediff; this is a larger change, since bdiff works on 2 multi-line strings, while patiencediff works on 2 lists; - rename the main class from Merge3 to Merge3Text and add a Merge3 class that derives from Merge3Text. This new Merge3 class has the same interface from the original class, so that the tests still work; - Merge3 uses util.binary to detect binary data and raises util.Abort instead of a specific exception; - don't use the @decorator syntax, to keep python2.3 compatibility; - the test uses unittest, which likes to print how long it took to run. This obviously doesn't play too well with hg's test suite, so we override time.time to fool unittest; - one test has a different (but still valid) output because of the different diff algorithm used; - the TestCase class used by bzr has some extras to help debugging. test-merge3.py used 2 of them: - log method to log some data - assertEqualDiff method to ease viewing diffs of diffs We add a dummy log method and use regular assertEquals instead of assertEqualDiff. - make simplemerge executable and add "#!/usr/bin/env python" header

File last commit:

r564:ced5f5ce default
r4363:2e3c54fb default
Show More
buildrpm
49 lines | 1.3 KiB | text/plain | TextLexer
#!/bin/sh
#
# Build a Mercurial RPM in place.
#
# Bryan O'Sullivan <bos@serpentine.com>
root="`hg root 2>/dev/null`"
specfile=contrib/mercurial.spec
if [ -z "$root" ]; then
echo 'You are not inside a Mercurial repository!' 1>&2
exit 1
fi
rpmdir=/tmp/"`basename $root | sed 's/ /_/'`"-rpm
cd "$root"
rm -rf $rpmdir
mkdir -p $rpmdir/RPMS
hg clone "$root" $rpmdir/BUILD
if [ ! -f $specfile ]; then
echo "Cannot find $specfile!" 1>&2
exit 1
fi
tmpspec=/tmp/`basename "$specfile"`.$$
# Use the most recent tag as the version.
version=`hg tags | perl -e 'while(<STDIN>){if(/^(\d\S+)/){print$1;exit}}'`
# Compute the release number as the difference in revision numbers
# between the tip and the most recent tag.
release=`hg tags | perl -e 'while(<STDIN>){/^(\S+)\s+(\d+)/;if($1eq"tip"){$t=$2}else{print$t-$2+1;exit}}'`
tip=`hg -q tip`
# Beat up the spec file
sed -e 's,^Source:.*,Source: /dev/null,' \
-e "s,^Version:.*,Version: $version," \
-e "s,^Release:.*,Release: $release," \
-e "s,^%prep.*,Changeset: $tip\n\0," \
-e 's,^%setup.*,,' \
$specfile > $tmpspec
rpmbuild --define "_topdir $rpmdir" -bb $tmpspec
if [ $? = 0 ]; then
rm -rf $tmpspec $rpmdir/BUILD
mv $rpmdir/RPMS/*/* $rpmdir && rm -r $rpmdir/RPMS
echo
echo "Packages are in $rpmdir"
fi