annotate hgmerge @ 599:765182a4c843

[PATCH] Add RSS support to hgweb -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] Add RSS support to hgweb From: Goffredo Baroncelli <kreijack@libero.it> with the two small patches below, now hgweb can act as feed source. Two kinds ofobjects can be tracked: the changelong and the files. This can be useful if anyone would track the changes of a file ( and because git has it, mercurial have to has ). To check the changelog the url is http://127.0.0.1:8000/pippo.pluto?cmd=changelog;style=rss To check a file ( the mercurial/hgweb.py for examples ) the url is http://127.0.0.1:8000/?cmd=filelog;file=mercurial/hgweb.py;filenode=0;style=rss The first patch adds a new filter for the template: the filter is named rfc822date, and translates the date from the touple format to a rfc822 style date. The second patch adds the templates needed to create the rss pages. Tested with akgregator ( kde ). [tweaked by mpm: add Content-type: text/xml add support for URL to header() add header with link and content type add RSS links on the normal pages] manifest hash: 170c03d50490d7160097f59abdde1a5073d2ba82 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCyFmLywK+sNU5EO8RApkrAKCYF/vZ3DwdMXPBds2LxGEX8+tK5QCfTeOc ZhPN8Xjt2cD3wMbNXMcoNSo= =COlM -----END PGP SIGNATURE-----
author mpm@selenic.com
date Sun, 03 Jul 2005 13:32:59 -0800
parents 4fc63e22b1fe
children cd0ad12d9e42 8f5637f0a0c0 0902ffece4b4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
544
3d4d5f2aba9a Remove bashisms and use /bin/sh instead of /bin/bash.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 306
diff changeset
1 #!/bin/sh
240
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
2 #
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
3 # hgmerge - default merge helper for Mercurial
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
4 #
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
5 # This tries to find a way to do three-way merge on the current system.
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
6 # The result ought to end up in $1.
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
7
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
8 set -e # bail out quickly on failure
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
9
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
10 LOCAL=$1
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
11 BASE=$2
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
12 OTHER=$3
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
13
304
38fb7d23b78d Use vi if $EDITOR is unset.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 303
diff changeset
14 EDITOR="${EDITOR:-vi}"
38fb7d23b78d Use vi if $EDITOR is unset.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 303
diff changeset
15
240
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
16 # Back up our file
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
17 cp $LOCAL $LOCAL.orig
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
18
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
19 # Attempt to do a non-interactive merge
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
20 if which merge > /dev/null ; then
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
21 if merge $LOCAL $BASE $OTHER 2> /dev/null; then
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
22 # success!
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
23 exit 0
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
24 fi
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
25 cp $LOCAL.orig $LOCAL
242
a2edb4481f19 hgmerge: use diff3 if available
mpm@selenic.com
parents: 240
diff changeset
26 elif which diff3 > /dev/null ; then
a2edb4481f19 hgmerge: use diff3 if available
mpm@selenic.com
parents: 240
diff changeset
27 if diff3 -m $LOCAL.orig $BASE $OTHER > $LOCAL ; then
a2edb4481f19 hgmerge: use diff3 if available
mpm@selenic.com
parents: 240
diff changeset
28 # success
a2edb4481f19 hgmerge: use diff3 if available
mpm@selenic.com
parents: 240
diff changeset
29 exit 0
a2edb4481f19 hgmerge: use diff3 if available
mpm@selenic.com
parents: 240
diff changeset
30 fi
a2edb4481f19 hgmerge: use diff3 if available
mpm@selenic.com
parents: 240
diff changeset
31 cp $LOCAL.orig $LOCAL
240
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
32 fi
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
33
303
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
34 if [ -n "$DISPLAY" ]; then
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
35 # try using kdiff3, which is fairly nice
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
36 if which kdiff3 > /dev/null ; then
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
37 if kdiff3 --auto $BASE $LOCAL $OTHER -o $LOCAL ; then
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
38 exit 0
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
39 else
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
40 exit 1
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
41 fi
240
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
42 fi
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
43
303
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
44 # try using tkdiff, which is a bit less sophisticated
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
45 if which tkdiff > /dev/null ; then
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
46 if tkdiff $LOCAL $OTHER -a $BASE -o $LOCAL ; then
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
47 exit 0
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
48 else
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
49 exit 1
15a9e55e7ea5 Check if $DISPLAY is set before using tkdiff or kdiff3.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 280
diff changeset
50 fi
240
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
51 fi
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
52 fi
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
53
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
54 # Attempt to do a merge with $EDITOR
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
55 if which merge > /dev/null ; then
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
56 echo "conflicts detected in $LOCAL"
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
57 merge $LOCAL $BASE $OTHER 2>/dev/null || $EDITOR $LOCAL
242
a2edb4481f19 hgmerge: use diff3 if available
mpm@selenic.com
parents: 240
diff changeset
58 exit 0
a2edb4481f19 hgmerge: use diff3 if available
mpm@selenic.com
parents: 240
diff changeset
59 fi
a2edb4481f19 hgmerge: use diff3 if available
mpm@selenic.com
parents: 240
diff changeset
60
a2edb4481f19 hgmerge: use diff3 if available
mpm@selenic.com
parents: 240
diff changeset
61 if which diff3 > /dev/null ; then
a2edb4481f19 hgmerge: use diff3 if available
mpm@selenic.com
parents: 240
diff changeset
62 echo "conflicts detected in $LOCAL"
a2edb4481f19 hgmerge: use diff3 if available
mpm@selenic.com
parents: 240
diff changeset
63 diff3 -m $LOCAL.orig $BASE $OTHER > $LOCAL || $EDITOR $LOCAL
a2edb4481f19 hgmerge: use diff3 if available
mpm@selenic.com
parents: 240
diff changeset
64 exit 0
240
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
65 fi
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
66
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
67 # attempt to manually merge with diff and patch
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
68 if which diff > /dev/null ; then
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
69 if which patch > /dev/null ; then
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
70 T=`mktemp`
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
71 diff -u $BASE $OTHER > $T
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
72 if patch $LOCAL < $T ; then
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
73 exit 0
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
74 else
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
75 $EDITOR $LOCAL $LOCAL.rej
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
76 fi
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
77 rm $T
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
78 exit 1
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
79 fi
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
80 fi
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
81
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
82 echo "hgmerge: unable to find merge, tkdiff, kdiff3, or diff+patch!"
737c66b68290 Replace tkmerge with hgmerge
mpm@selenic.com
parents:
diff changeset
83 exit 1