Mercurial > hg
changeset 1783:35a05f177267
merge with matt
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 22 Feb 2006 05:21:09 +0100 |
parents | b9671b41e360 (current diff) 8a1f2eae2832 (diff) |
children | 2e0a288ca93e |
files | |
diffstat | 9 files changed, 247 insertions(+), 191 deletions(-) [+] |
line wrap: on
line diff
--- a/hgmerge Tue Feb 21 16:46:38 2006 +0100 +++ b/hgmerge Wed Feb 22 05:21:09 2006 +0100 @@ -17,31 +17,35 @@ # find decent versions of our utilities, insisting on the GNU versions where we # need to -MERGE=merge -DIFF3=gdiff3 -DIFF=gdiff -PATCH=gpatch +MERGE="merge" +DIFF3="gdiff3" +DIFF="gdiff" +PATCH="gpatch" -type $MERGE >/dev/null 2>&1 || MERGE= -type $DIFF3 >/dev/null 2>&1 || DIFF3=diff3 -type $DIFF >/dev/null 2>&1 || DIFF=diff -type $PATCH >/dev/null 2>&1 || PATCH=patch +type "$MERGE" >/dev/null 2>&1 || MERGE= +type "$DIFF3" >/dev/null 2>&1 || DIFF3="diff3" $DIFF3 --version >/dev/null 2>&1 || DIFF3= +type "$DIFF" >/dev/null 2>&1 || DIFF="diff" +type "$DIFF" >/dev/null 2>&1 || DIFF= +type "$PATCH" >/dev/null 2>&1 || PATCH="patch" +type "$PATCH" >/dev/null 2>&1 || PATCH= # find optional visual utilities -FILEMERGE='/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge' -KDIFF3=kdiff3 -TKDIFF=tkdiff +FILEMERGE="/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge" +KDIFF3="kdiff3" +TKDIFF="tkdiff" +MELD="meld" -type $FILEMERGE >/dev/null 2>&1 || FILEMERGE= -type $KDIFF3 >/dev/null 2>&1 || KDIFF3= -type $TKDIFF >/dev/null 2>&1 || TKDIFF= +type "$FILEMERGE" >/dev/null 2>&1 || FILEMERGE= +type "$KDIFF3" >/dev/null 2>&1 || KDIFF3= +type "$TKDIFF" >/dev/null 2>&1 || TKDIFF= +type "$MELD" >/dev/null 2>&1 || MELD= # random part of names -RAND="$RANDOM.$RANDOM.$RANDOM.$$" +RAND="$RANDOM$RANDOM" # temporary directory for diff+patch merge -HGTMP="${TMPDIR-/tmp}/hgmerge.$RAND" +HGTMP="${TMPDIR-'/tmp'}/hgmerge.$RAND" # backup file BACKUP="$LOCAL.orig.$RAND" @@ -68,6 +72,18 @@ exit 1 } +# Ask if the merge was successful +ask_if_merged() { + while 1; do + echo "$LOCAL seems unchanged. Was the merge successful? [y/n]" + read answer + case answer in + y*|Y*) success;; + n*|N*) failure;; + esac + done +} + # Clean up when interrupted trap "failure" 1 2 3 6 15 # HUP INT QUIT ABRT TERM @@ -76,18 +92,16 @@ cp "$BACKUP" "$LOCAL" # Attempt to do a non-interactive merge -if [ -n "$MERGE" ]; then - $MERGE "$LOCAL" "$BASE" "$OTHER" 2> /dev/null && success - cp "$BACKUP" "$LOCAL" -elif [ -n "$DIFF3" ]; then - echo $DIFF3 -m "$BACKUP" "$BASE" "$OTHER" - $DIFF3 -m "$BACKUP" "$BASE" "$OTHER" > "$LOCAL" && success - if [ $? -eq 2 ]; then - echo "$DIFF3 failed! Exiting." 1>&2 - cp "$BACKUP" "$LOCAL" +if [ -n "$MERGE" -o -n "$DIFF3" ]; then + if [ -n "$MERGE" ]; then + $MERGE "$LOCAL" "$BASE" "$OTHER" 2> /dev/null && success + elif [ -n "$DIFF3" ]; then + $DIFF3 -m "$BACKUP" "$BASE" "$OTHER" > "$LOCAL" && success + fi + if [ $? -gt 1 ]; then + echo "automatic merge failed! Exiting." 1>&2 failure fi - cp "$BACKUP" "$LOCAL" fi # on MacOS X try FileMerge.app, shipped with Apple's developer tools @@ -97,71 +111,66 @@ # filemerge prefers the right by default $FILEMERGE -left "$OTHER" -right "$LOCAL" -ancestor "$BASE" -merge "$LOCAL" [ $? -ne 0 ] && echo "FileMerge failed to launch" && failure - if test "$LOCAL" -nt "$CHGTEST" - then - success - else - echo "$LOCAL seems unchanged. Was the merge successful?" - select answer in yes no - do - test "$answer" == "yes" && success || failure - done - fi - failure + test "$LOCAL" -nt "$CHGTEST" && success || ask_if_merged fi if [ -n "$DISPLAY" ]; then # try using kdiff3, which is fairly nice if [ -n "$KDIFF3" ]; then - $KDIFF3 --auto "$BASE" "$LOCAL" "$OTHER" -o "$LOCAL" || failure - success + $KDIFF3 --auto "$BASE" "$LOCAL" "$OTHER" -o "$LOCAL" || failure + success fi # try using tkdiff, which is a bit less sophisticated if [ -n "$TKDIFF" ]; then - $TKDIFF "$LOCAL" "$OTHER" -a "$BASE" -o "$LOCAL" || failure - success + $TKDIFF "$LOCAL" "$OTHER" -a "$BASE" -o "$LOCAL" || failure + success + fi + + if [ -n "$MELD" ]; then + cp "$BACKUP" "$CHGTEST" + # protect our feet - meld allows us to save to the left file + cp "$BACKUP" "$LOCAL.tmp.$RAND" + # Meld doesn't have automatic merging, so to reduce intervention + # use the file with conflicts + $MELD "$LOCAL.tmp.$RAND" "$LOCAL" "$OTHER" || failure + # Also it doesn't return good error code + test "$LOCAL" -nt "$CHGTEST" && success || ask_if_merged fi fi # Attempt to do a merge with $EDITOR -if [ -n "$MERGE" ]; then - echo "conflicts detected in $LOCAL" - $MERGE "$LOCAL" "$BASE" "$OTHER" 2>/dev/null || $EDITOR "$LOCAL" - success -fi - -if [ -n "$DIFF3" ]; then +if [ -n "$MERGE" -o -n "$DIFF3" ]; then echo "conflicts detected in $LOCAL" - $DIFF3 -m "$BACKUP" "$BASE" "$OTHER" > "$LOCAL" || { - case $? in - 1) - $EDITOR "$LOCAL" ;; - 2) echo "$DIFF3 failed! Exiting." 1>&2 - cp "$BACKUP" "$LOCAL" - failure ;; - esac - success - } + cp "$BACKUP" "$CHGTEST" + $EDITOR "$LOCAL" || failure + # Some editors do not return meaningful error codes + # Do not take any chances + test "$LOCAL" -nt "$CHGTEST" && success || ask_if_merged fi # attempt to manually merge with diff and patch if [ -n "$DIFF" -a -n "$PATCH" ]; then (umask 077 && mkdir "$HGTMP") || { - echo "Could not create temporary directory $HGTMP" 1>&2 - failure + echo "Could not create temporary directory $HGTMP" 1>&2 + failure } $DIFF -u "$BASE" "$OTHER" > "$HGTMP/diff" || : if $PATCH "$LOCAL" < "$HGTMP/diff"; then - success + success else - # If rejects are empty after using the editor, merge was ok - $EDITOR "$LOCAL" "$LOCAL.rej" && test -s "$LOCAL.rej" || success + # If rejects are empty after using the editor, merge was ok + $EDITOR "$LOCAL" "$LOCAL.rej" || failure + test -s "$LOCAL.rej" || success fi failure fi -echo "hgmerge: unable to find merge, tkdiff, kdiff3, or diff+patch!" +echo +echo "hgmerge: unable to find any merge utility!" +echo "supported programs:" +echo "merge, FileMerge, tkdiff, kdiff3, meld, diff+patch" +echo failure
--- a/mercurial/bdiff.c Tue Feb 21 16:46:38 2006 +0100 +++ b/mercurial/bdiff.c Wed Feb 22 05:21:09 2006 +0100 @@ -17,6 +17,10 @@ #define inline #endif +#ifdef __SUNPRO_C +# define inline +#endif + #ifdef _WIN32 #ifdef _MSC_VER #define inline __inline
--- a/mercurial/hgweb.py Tue Feb 21 16:46:38 2006 +0100 +++ b/mercurial/hgweb.py Wed Feb 22 05:21:09 2006 +0100 @@ -7,6 +7,7 @@ # of the GNU General Public License, incorporated herein by reference. import os, cgi, sys, urllib +import mimetypes from demandload import demandload demandload(globals(), "mdiff time re socket zlib errno ui hg ConfigParser") demandload(globals(), "zipfile tempfile StringIO tarfile BaseHTTPServer util") @@ -845,6 +846,7 @@ 'ca': [('cmd', ['archive']), ('node', None)], 'tags': [('cmd', ['tags'])], 'tip': [('cmd', ['changeset']), ('node', ['tip'])], + 'static': [('cmd', ['static']), ('file', None)] } for k in shortcuts.iterkeys(): @@ -860,6 +862,7 @@ expand_form(req.form) t = self.repo.ui.config("web", "templates", templatepath()) + static = self.repo.ui.config("web", "static", os.path.join(t,"static")) m = os.path.join(t, "map") style = self.repo.ui.config("web", "style", "") if req.form.has_key('style'): @@ -983,6 +986,38 @@ req.write(self.t("error")) + elif req.form['cmd'][0] == 'static': + fname = req.form['file'][0] + + fname = os.path.realpath(os.path.join(static, fname)) + + try: + # the static dir should be a substring in the real + # file path, if it is not, we have something strange + # going on => security breach attempt? + # + # This will either: + # 1) find the `static' path at index 0 = success + # 2) find the `static' path at other index = error + # 3) not find the `static' path = ValueError generated + if fname.index(static) != 0: + # generate ValueError manually + raise ValueError() + + os.stat(fname) + + ct = mimetypes.guess_type(fname)[0] + if ct == None: + ct = "text/plain" + + req.write("Content-type: " + ct + "\n\n" + file(fname).read()) + except ValueError: + # security breach attempt + req.write(self.t("error")) + except OSError, e: + if e.errno == errno.ENOENT: + req.write(self.t("error")) + else: req.write(self.t("error"))
--- a/setup.py Tue Feb 21 16:46:38 2006 +0100 +++ b/setup.py Wed Feb 22 05:21:09 2006 +0100 @@ -89,7 +89,9 @@ data_files=[('mercurial/templates', ['templates/map'] + glob.glob('templates/map-*') + - glob.glob('templates/*.tmpl'))], + glob.glob('templates/*.tmpl')), + ('mercurial/templates/static', + glob.glob('templates/static/*'))], cmdclass=cmdclass, scripts=['hg', 'hgmerge'], options=dict(bdist_mpkg=dict(zipdist=True,
--- a/templates/error-gitweb.tmpl Tue Feb 21 16:46:38 2006 +0100 +++ b/templates/error-gitweb.tmpl Wed Feb 22 05:21:09 2006 +0100 @@ -1,11 +1,21 @@ #header# +<title>#repo|escape#: Error</title> +<link rel="alternate" type="application/rss+xml" + href="?cmd=changelog;style=rss" title="RSS feed for #repo|escape#"> +</head> +<body> + +<div class="page_header"> +<a href="http://www.selenic.com/mercurial/" title="Mercurial"><div style="float:right;">Mercurial</div></a><a href="?cmd=summary;style=gitweb">#repo|escape#</a> / error +</div> + <div class="page_nav"> -<a href="?cmd=summary;style=gitweb">summary</a> | <a href="?cmd=changelog;style=gitweb">log</a> | <a href="?cmd=tags;style=gitweb">tags</a> | <a href="?cmd=manifest;manifest=#manifest#;path=/;style=gitweb">manifest</a><br/> +<a href="?cmd=summary;style=gitweb">summary</a> | <a href="?cmd=changelog;style=gitweb">changelog</a> | <a href="?cmd=tags;style=gitweb">tags</a> | <a href="?cmd=manifest;manifest=#manifest#;path=/;style=gitweb">manifest</a><br/> </div> <div> <br/> -<i>Error parsing query string</i><br/> +<i>An error occured while processing your request</i><br/> <br/> </div>
--- a/templates/header-gitweb.tmpl Tue Feb 21 16:46:38 2006 +0100 +++ b/templates/header-gitweb.tmpl Wed Feb 22 05:21:09 2006 +0100 @@ -6,54 +6,5 @@ <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="robots" content="index, nofollow"/> -<style type="text/css"> -body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid #d9d8d1; border-width:1px; margin:10px; } -a { color:#0000cc; } -a:hover, a:visited, a:active { color:#880000; } -div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; } -div.page_header a:visited { color:#0000cc; } -div.page_header a:hover { color:#880000; } -div.page_nav { padding:8px; } -div.page_nav a:visited { color:#0000cc; } -div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px} -div.page_footer { height:17px; padding:4px 8px; background-color: #d9d8d1; } -div.page_footer_text { float:left; color:#555555; font-style:italic; } -div.page_body { padding:8px; } -div.title, a.title { - display:block; padding:6px 8px; - font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000; -} -a.title:hover { background-color: #d9d8d1; } -div.title_text { padding:6px 0px; border: solid #d9d8d1; border-width:0px 0px 1px; } -div.log_body { padding:8px 8px 8px 150px; } -span.age { position:relative; float:left; width:142px; font-style:italic; } -div.log_link { - padding:0px 8px; - font-size:10px; font-family:sans-serif; font-style:normal; - position:relative; float:left; width:136px; -} -div.list_head { padding:6px 8px 4px; border:solid #d9d8d1; border-width:1px 0px 0px; font-style:italic; } -a.list { text-decoration:none; color:#000000; } -a.list:hover { text-decoration:underline; color:#880000; } -table { padding:8px 4px; } -th { padding:2px 5px; font-size:12px; text-align:left; } -tr.light:hover, .parity0:hover { background-color:#edece6; } -tr.dark, .parity1 { background-color:#f6f6f0; } -tr.dark:hover, .parity1:hover { background-color:#edece6; } -td { padding:2px 5px; font-size:12px; vertical-align:top; } -td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; } -div.pre { font-family:monospace; font-size:12px; white-space:pre; } -div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; } -div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; } -div.search { margin:4px 8px; position:absolute; top:56px; right:12px } -.linenr { color:#999999; text-decoration:none } -a.rss_logo { - float:right; padding:3px 0px; width:35px; line-height:10px; - border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e; - color:#ffffff; background-color:#ff6600; - font-weight:bold; font-family:sans-serif; font-size:10px; - text-align:center; text-decoration:none; -} -a.rss_logo:hover { background-color:#ee5500; } -</style> +<style type="text/css">/*<![CDATA[*/ @import "?static=style-gitweb.css"; /*]]>*/</style>
--- a/templates/header.tmpl Tue Feb 21 16:46:38 2006 +0100 +++ b/templates/header.tmpl Wed Feb 22 05:21:09 2006 +0100 @@ -4,77 +4,4 @@ <html> <head> <meta name="robots" content="index, nofollow" /> -<style type="text/css"> -<!-- -a { text-decoration:none; } -.parity0 { background-color: #dddddd; } -.parity1 { background-color: #eeeeee; } -.lineno { width: 60px; color: #aaaaaa; font-size: smaller; - text-align: right; padding-right:1em; } -.plusline { color: green; } -.minusline { color: red; } -.atline { color: purple; } -.annotate { font-size: smaller; text-align: right; padding-right: 1em; } -.buttons a { - background-color: #666666; - padding: 2pt; - color: white; - font-family: sans; - font-weight: bold; -} -.navigate a { - background-color: #ccc; - padding: 2pt; - font-family: sans; - color: black; -} - -.metatag { - background-color: #888888; - color: white; - text-align: right; -} - -/* Common */ -pre { margin: 0; } - -.logo { - background-color: #333; - padding: 4pt; - margin: 8pt 0 8pt 8pt; - font-family: sans; - font-size: 60%; - color: white; - float: right; - clear: right; - text-align: left; -} - -.logo a { - font-weight: bold; - font-size: 150%; - color: #999; -} - -/* Changelog entries */ -.changelogEntry { width: 100%; } -.changelogEntry th { font-weight: normal; text-align: right; vertical-align: top; } -.changelogEntry th.age, .changelogEntry th.firstline { font-weight: bold; } -.changelogEntry th.firstline { text-align: left; width: inherit; } - -/* Tag entries */ -#tagEntries { list-style: none; margin: 0; padding: 0; } -#tagEntries .tagEntry { list-style: none; margin: 0; padding: 0; } -#tagEntries .tagEntry span.node { font-family: monospace; } - -/* Changeset entry */ -#changesetEntry { } -#changesetEntry th { font-weight: normal; background-color: #888; color: #fff; text-align: right; } -#changesetEntry th.files, #changesetEntry th.description { vertical-align: top; } - -/* File diff view */ -#filediffEntry { } -#filediffEntry th { font-weight: normal; background-color: #888; color: #fff; text-align: right; } - ---> -</style> +<style type="text/css">/*<![CDATA[*/ @import "?static=style.css"; /*]]>*/</style>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/static/style-gitweb.css Wed Feb 22 05:21:09 2006 +0100 @@ -0,0 +1,48 @@ +body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid #d9d8d1; border-width:1px; margin:10px; } +a { color:#0000cc; } +a:hover, a:visited, a:active { color:#880000; } +div.page_header { height:25px; padding:8px; font-size:18px; font-weight:bold; background-color:#d9d8d1; } +div.page_header a:visited { color:#0000cc; } +div.page_header a:hover { color:#880000; } +div.page_nav { padding:8px; } +div.page_nav a:visited { color:#0000cc; } +div.page_path { padding:8px; border:solid #d9d8d1; border-width:0px 0px 1px} +div.page_footer { height:17px; padding:4px 8px; background-color: #d9d8d1; } +div.page_footer_text { float:left; color:#555555; font-style:italic; } +div.page_body { padding:8px; } +div.title, a.title { + display:block; padding:6px 8px; + font-weight:bold; background-color:#edece6; text-decoration:none; color:#000000; +} +a.title:hover { background-color: #d9d8d1; } +div.title_text { padding:6px 0px; border: solid #d9d8d1; border-width:0px 0px 1px; } +div.log_body { padding:8px 8px 8px 150px; } +span.age { position:relative; float:left; width:142px; font-style:italic; } +div.log_link { + padding:0px 8px; + font-size:10px; font-family:sans-serif; font-style:normal; + position:relative; float:left; width:136px; +} +div.list_head { padding:6px 8px 4px; border:solid #d9d8d1; border-width:1px 0px 0px; font-style:italic; } +a.list { text-decoration:none; color:#000000; } +a.list:hover { text-decoration:underline; color:#880000; } +table { padding:8px 4px; } +th { padding:2px 5px; font-size:12px; text-align:left; } +tr.light:hover, .parity0:hover { background-color:#edece6; } +tr.dark, .parity1 { background-color:#f6f6f0; } +tr.dark:hover, .parity1:hover { background-color:#edece6; } +td { padding:2px 5px; font-size:12px; vertical-align:top; } +td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; } +div.pre { font-family:monospace; font-size:12px; white-space:pre; } +div.diff_info { font-family:monospace; color:#000099; background-color:#edece6; font-style:italic; } +div.index_include { border:solid #d9d8d1; border-width:0px 0px 1px; padding:12px 8px; } +div.search { margin:4px 8px; position:absolute; top:56px; right:12px } +.linenr { color:#999999; text-decoration:none } +a.rss_logo { + float:right; padding:3px 0px; width:35px; line-height:10px; + border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e; + color:#ffffff; background-color:#ff6600; + font-weight:bold; font-family:sans-serif; font-size:10px; + text-align:center; text-decoration:none; +} +a.rss_logo:hover { background-color:#ee5500; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/static/style.css Wed Feb 22 05:21:09 2006 +0100 @@ -0,0 +1,70 @@ +a { text-decoration:none; } +.parity0 { background-color: #dddddd; } +.parity1 { background-color: #eeeeee; } +.lineno { width: 60px; color: #aaaaaa; font-size: smaller; + text-align: right; padding-right:1em; } +.plusline { color: green; } +.minusline { color: red; } +.atline { color: purple; } +.annotate { font-size: smaller; text-align: right; padding-right: 1em; } +.buttons a { + background-color: #666666; + padding: 2pt; + color: white; + font-family: sans; + font-weight: bold; +} +.navigate a { + background-color: #ccc; + padding: 2pt; + font-family: sans; + color: black; +} + +.metatag { + background-color: #888888; + color: white; + text-align: right; +} + +/* Common */ +pre { margin: 0; } + +.logo { + background-color: #333; + padding: 4pt; + margin: 8pt 0 8pt 8pt; + font-family: sans; + font-size: 60%; + color: white; + float: right; + clear: right; + text-align: left; +} + +.logo a { + font-weight: bold; + font-size: 150%; + color: #999; +} + +/* Changelog entries */ +.changelogEntry { width: 100%; } +.changelogEntry th { font-weight: normal; text-align: right; vertical-align: top; } +.changelogEntry th.age, .changelogEntry th.firstline { font-weight: bold; } +.changelogEntry th.firstline { text-align: left; width: inherit; } + +/* Tag entries */ +#tagEntries { list-style: none; margin: 0; padding: 0; } +#tagEntries .tagEntry { list-style: none; margin: 0; padding: 0; } +#tagEntries .tagEntry span.node { font-family: monospace; } + +/* Changeset entry */ +#changesetEntry { } +#changesetEntry th { font-weight: normal; background-color: #888; color: #fff; text-align: right; } +#changesetEntry th.files, #changesetEntry th.description { vertical-align: top; } + +/* File diff view */ +#filediffEntry { } +#filediffEntry th { font-weight: normal; background-color: #888; color: #fff; text-align: right; } +