* monotone: Require version 0.38 or greater, and stop using the mtnmergerc
option. (Brian May)master
parent
db0d6c5f01
commit
2fa9da9f16
|
@ -18,12 +18,30 @@ sub check_config() { #{{{
|
|||
error("Ikiwiki srcdir does not seem to be a Monotone workspace (or set the mtnrootdir)!");
|
||||
}
|
||||
|
||||
if (!defined($config{mtnmergerc})) {
|
||||
$config{mtnmergerc} = "$config{mtnrootdir}/_MTN/mergerc";
|
||||
}
|
||||
|
||||
chdir $config{srcdir}
|
||||
or error("Cannot chdir to $config{srcdir}: $!");
|
||||
|
||||
my $child = open(MTN, "-|");
|
||||
if (! $child) {
|
||||
open STDERR, ">/dev/null";
|
||||
exec("mtn", "version") || error("mtn version failed to run");
|
||||
}
|
||||
|
||||
my $version=undef;
|
||||
while (<MTN>) {
|
||||
if (/^monotone (\d+\.\d+) /) {
|
||||
$version=$1;
|
||||
}
|
||||
}
|
||||
|
||||
close MTN || debug("mtn version exited $?");
|
||||
|
||||
if (!defined($version)) {
|
||||
error("Cannot determine monotone version");
|
||||
}
|
||||
if ($version < 0.38) {
|
||||
error("Monotone version too old, is $version but required 0.38");
|
||||
}
|
||||
} #}}}
|
||||
|
||||
sub get_rev () { #{{{
|
||||
|
@ -59,13 +77,11 @@ sub mtn_merge ($$$$) { #{{{
|
|||
|
||||
my $mergeRev;
|
||||
|
||||
my $mergerc = $config{mtnmergerc};
|
||||
|
||||
my $child = open(MTNMERGE, "-|");
|
||||
if (! $child) {
|
||||
open STDERR, ">&STDOUT";
|
||||
exec("mtn", "--root=$config{mtnrootdir}", "--rcfile",
|
||||
$mergerc, "explicit_merge", $leftRev, $rightRev,
|
||||
exec("mtn", "--root=$config{mtnrootdir}",
|
||||
"explicit_merge", $leftRev, $rightRev,
|
||||
$branch, "--author", $author, "--key",
|
||||
$config{mtnkey}) || error("mtn merge failed to run");
|
||||
}
|
||||
|
@ -130,21 +146,6 @@ sub commit_file_to_new_rev($$$$$$$$) { #{{{
|
|||
return $newRevID;
|
||||
} #}}}
|
||||
|
||||
sub check_mergerc () { #{{{
|
||||
my $mergerc = $config{mtnmergerc};
|
||||
if (! -r $mergerc ) {
|
||||
debug("$mergerc doesn't exist. Creating file with default mergers.");
|
||||
open (my $out, ">", $mergerc) or error("can't open $mergerc: $!");
|
||||
print $out <DATA>;
|
||||
print $out <<"EOF";
|
||||
function note_netsync_revision_received(new_id, revision, certs, session_id)
|
||||
execute("$config{mtnrootdir}/_MTN/ikiwiki-netsync-hook", new_id)
|
||||
end
|
||||
EOF
|
||||
close $out;
|
||||
}
|
||||
} #}}}
|
||||
|
||||
sub read_certs ($$) { #{{{
|
||||
my $automator=shift;
|
||||
my $rev=shift;
|
||||
|
@ -280,8 +281,6 @@ sub rcs_commit ($$$;$$) { #{{{
|
|||
}
|
||||
debug("Divergence created! Attempting auto-merge.");
|
||||
|
||||
check_mergerc();
|
||||
|
||||
# see if it will merge cleanly
|
||||
$ENV{MTN_MERGE}="fail";
|
||||
my $mergeResult = mtn_merge($newRevID, $rev, $branch, $author);
|
||||
|
@ -304,9 +303,11 @@ sub rcs_commit ($$$;$$) { #{{{
|
|||
else {
|
||||
debug("Auto-merge failed. Using diff-merge to add conflict markers.");
|
||||
|
||||
$ENV{MTN_MERGE}="diffutils_force";
|
||||
$ENV{MTN_MERGE}="diffutils";
|
||||
$ENV{MTN_MERGE_DIFFUTILS}="partial=true";
|
||||
$mergeResult = mtn_merge($newRevID, $rev, $branch, $author);
|
||||
$ENV{MTN_MERGE}="";
|
||||
$ENV{MTN_MERGE_DIFFUTILS}="";
|
||||
|
||||
if (!defined($mergeResult)) {
|
||||
debug("Unable to insert conflict markers!");
|
||||
|
@ -531,55 +532,3 @@ sub rcs_getctime ($) { #{{{
|
|||
} #}}}
|
||||
|
||||
1
|
||||
|
||||
# default mergerc content
|
||||
__DATA__
|
||||
function local_execute_redirected(stdin, stdout, stderr, path, ...)
|
||||
local pid
|
||||
local ret = -1
|
||||
io.flush();
|
||||
pid = spawn_redirected(stdin, stdout, stderr, path, unpack(arg))
|
||||
if (pid ~= -1) then ret, pid = wait(pid) end
|
||||
return ret
|
||||
end
|
||||
if (not execute_redirected) then -- use standard function if available
|
||||
execute_redirected = local_execute_redirected
|
||||
end
|
||||
if (not mergers.fail) then -- use standard merger if available
|
||||
mergers.fail = {
|
||||
cmd = function (tbl) return false end,
|
||||
available = function () return true end,
|
||||
wanted = function () return true end
|
||||
}
|
||||
end
|
||||
mergers.diffutils_force = {
|
||||
cmd = function (tbl)
|
||||
local ret = execute_redirected(
|
||||
"",
|
||||
tbl.outfile,
|
||||
"",
|
||||
"diff3",
|
||||
"--merge",
|
||||
"--show-overlap",
|
||||
"--label", string.format("[Yours]", tbl.left_path ),
|
||||
"--label", string.format("[Original]", tbl.anc_path ),
|
||||
"--label", string.format("[Theirs]", tbl.right_path),
|
||||
tbl.lfile,
|
||||
tbl.afile,
|
||||
tbl.rfile
|
||||
)
|
||||
if (ret > 1) then
|
||||
io.write(gettext("Error running GNU diffutils 3-way difference tool 'diff3'"))
|
||||
return false
|
||||
end
|
||||
return tbl.outfile
|
||||
end,
|
||||
available =
|
||||
function ()
|
||||
return program_exists_in_path("diff3");
|
||||
end,
|
||||
wanted =
|
||||
function ()
|
||||
return true
|
||||
end
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@ ikiwiki (2.41) UNRELEASED; urgency=low
|
|||
correct, and it's certianly not correct now, since the wiki is locked
|
||||
before rcs_commit is ever called, and should not be unlocked by
|
||||
rcs_commit either.
|
||||
* monotone: Require version 0.38 or greater, and stop using the mtnmergerc
|
||||
option. (Brian May)
|
||||
|
||||
-- martin f. krafft <madduck@debian.org> Sun, 02 Mar 2008 17:46:38 +0100
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ Vcs-Browser: http://git.ikiwiki.info/?p=ikiwiki
|
|||
Package: ikiwiki
|
||||
Architecture: all
|
||||
Depends: ${perl:Depends}, markdown, libhtml-scrubber-perl, libhtml-template-perl, libhtml-parser-perl, liburi-perl
|
||||
Recommends: gcc | c-compiler, libc6-dev | libc-dev, subversion | git-core | tla | bzr (>= 0.91) | mercurial | monotone, libxml-simple-perl, libnet-openid-consumer-perl, liblwpx-paranoidagent-perl, libtimedate-perl, libcgi-formbuilder-perl (>= 3.05), libtime-duration-perl, libcgi-session-perl (>= 4.14-1), libmail-sendmail-perl
|
||||
Recommends: gcc | c-compiler, libc6-dev | libc-dev, subversion | git-core | tla | bzr (>= 0.91) | mercurial | monotone (>= 0.38), libxml-simple-perl, libnet-openid-consumer-perl, liblwpx-paranoidagent-perl, libtimedate-perl, libcgi-formbuilder-perl (>= 3.05), libtime-duration-perl, libcgi-session-perl (>= 4.14-1), libmail-sendmail-perl
|
||||
Suggests: viewvc | gitweb | viewcvs, hyperestraier, librpc-xml-perl, libtext-wikiformat-perl, python, python-docutils, polygen, tidy, libxml-feed-perl, libmailtools-perl, perlmagick, libfile-mimeinfo-perl, libcrypt-ssleay-perl, liblocale-gettext-perl (>= 1.05-1), libtext-typography-perl, libtext-csv-perl, libdigest-sha1-perl, graphviz
|
||||
Conflicts: ikiwiki-plugin-table
|
||||
Replaces: ikiwiki-plugin-table
|
||||
|
|
|
@ -57,12 +57,6 @@ use IkiWiki::Setup::Standard {
|
|||
# The path to your workspace (defaults to the srcdir itself)
|
||||
# e.g. use if your srcdir is a subdirectory of the workspace.
|
||||
#mtnrootdir => "path/to/root/of/workspace",
|
||||
# This is a monotone lua hook file used by ikiwiki for
|
||||
# inserting conflict markers. By default it will use
|
||||
# mtnrootdir/_MTN/mergerc. This hook will be populated with
|
||||
# default code the first time you use ikiwiki. You can
|
||||
# change it to alter how conflict markers are inserted.
|
||||
#mtnmergerc => "path/to/mergerc",
|
||||
|
||||
wrappers => [
|
||||
#{
|
||||
|
|
Loading…
Reference in New Issue