[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone: c15b473a71ade0d413cbb336fa
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone: c15b473a71ade0d413cbb336fa970370ec6cc180 |
Date: |
Fri, 18 Feb 2011 20:54:23 +0100 (CET) |
revision: c15b473a71ade0d413cbb336fa970370ec6cc180
date: 2011-02-10T17:57:01
author: Timothy Brownawell <address@hidden>
branch: net.venge.monotone
changelog:
merge of '1b4cb4095e19e42e7b3d16a25106fd28bf2b58d8'
and '1bba327c3ed582e0cf6d58910be0fc963a09b50c'
manifest:
format_version "1"
new_manifest [bafc38f19cd3216c546584934f37835164dc5706]
old_revision [1b4cb4095e19e42e7b3d16a25106fd28bf2b58d8]
patch "src/lcs.cc"
from [3b38a559cbf6ee3c32e8b5f7515afc8a092ca016]
to [fb4049733d44bc08b2961d9b1dda76084db4adad]
old_revision [1bba327c3ed582e0cf6d58910be0fc963a09b50c]
patch "contrib/extra-commands.lua"
from [bbc31f3f036d07ac810c500c4122847e1cc83683]
to [3d0fa49d06310886694ee438963439e673dcd406]
patch "contrib/lua-mode.el"
from [662aae14a3b91577fea5e950acdbadfe3584504a]
to [cc72a5b3d8a9909c4466f4b3718822f6208b5ede]
============================================================
--- src/lcs.cc 3b38a559cbf6ee3c32e8b5f7515afc8a092ca016
+++ src/lcs.cc fb4049733d44bc08b2961d9b1dda76084db4adad
@@ -161,38 +161,38 @@ struct jaffer_edit_calculator
// 'compare' here is the core myers, manber and miller algorithm.
static long compare(cost_vec & costs,
- subarray<A> const & a, long m,
- subarray<B> const & b, long n,
+ subarray<A> const & a, long len_a,
+ subarray<B> const & b, long len_b,
long p_lim,
bool full_scan = true)
{
- long lo = -(m+1), hi = (1+n);
+ long const delta = len_b - len_a;
+ long lo = -(len_a+1), hi = (1+len_b);
if (full_scan)
{
lo = -(p_lim + 1);
- hi = p_lim + 1 + (n-m);
+ hi = p_lim + 1 + delta;
}
work_vec fp(lo, hi);
long p = 0;
- long delta = n - m;
for (; p <= p_lim; ++p)
{
// lower sweep
for (long k = -p; k < delta; ++k)
- run(fp, k, a, m, b, n, costs, p);
+ run(fp, k, a, len_a, b, len_b, costs, p);
// upper sweep
for (long k = delta + p; k > delta; --k)
- run(fp, k, a, m, b, n, costs, p);
+ run(fp, k, a, len_a, b, len_b, costs, p);
// middle
- long fpval = run(fp, delta, a, m, b, n, costs, p);
+ long fpval = run(fp, delta, a, len_a, b, len_b, costs, p);
// we can bail early if not doing a full scan
- if (!full_scan && n <= fpval)
+ if (!full_scan && len_b <= fpval)
break;
}
@@ -352,26 +352,39 @@ struct jaffer_edit_calculator
I(end_a - start_a >= p_lim);
- long bsx, bdx, asx, adx;
+ // last, not end
+ long new_last_a = end_a - 1;
+ long new_last_b = end_b - 1;
+ while ((start_b <= new_last_b) &&
+ (start_a <= new_last_a) &&
+ (a[new_last_a] == b[new_last_b]))
+ {
+ --new_last_a;
+ --new_last_b;
+ }
- for (bdx = end_b - 1, adx = end_a - 1;
- (start_b <= bdx) && (start_a <= adx) && (a[adx] == b[bdx]);
- --bdx, --adx) ;
+ long new_start_a = start_a;
+ long new_start_b = start_b;
+ while((new_start_b < new_last_b) &&
+ (new_start_a < new_last_a) &&
+ (a[new_start_a] == b[new_start_b]))
+ {
+ ++new_start_a;
+ ++new_start_b;
+ }
- for (bsx = start_b, asx = start_a;
- (bsx < bdx) && (asx < adx) && (a[asx] == b[bsx]);
- ++bsx, ++asx) ;
-
// we've trimmed; now call diff_to_ez.
- long delta = (bdx - bsx) - (adx - asx);
+ // difference between length of (new) a and length of (new) b
+ long delta = (new_last_b - new_start_b) - (new_last_a - new_start_a);
+
if (delta < 0)
- return diff_to_ez (b, bsx, bdx+1,
- a, asx, adx+1,
+ return diff_to_ez (b, new_start_b, new_last_b+1,
+ a, new_start_a, new_last_a+1,
edits, edx, -polarity, delta + p_lim);
else
- return diff_to_ez (a, asx, adx+1,
- b, bsx, bdx+1,
+ return diff_to_ez (a, new_start_a, new_last_a+1,
+ b, new_start_b, new_last_b+1,
edits, edx, polarity, p_lim);
}
============================================================
--- contrib/lua-mode.el 662aae14a3b91577fea5e950acdbadfe3584504a
+++ contrib/lua-mode.el cc72a5b3d8a9909c4466f4b3718822f6208b5ede
@@ -1,7 +1,7 @@
;; Major mode for editing Lua files.
;; For info on Lua, see http://www.lua.org/
;;
-;; Copyright (C) 2007 Stephen Leake
+;; Copyright (C) 2007, 2011 Stephen Leake
;;
;; Author : Stephen Leake <address@hidden>
;; Web Site : http://www.stephe-leake.org/
@@ -130,7 +130,8 @@ Keybindings:
(line-beginning-position) (point)))))
;;; pages
-(defconst lua-page-marker "----------" ; exactly 10 dashes
+(defconst lua-page-marker
+ "\\(----------\\|^function\\)" ; exactly 10 dashes, or a function
"Lua page delimiter.")
(defun lua-prev-page ()
============================================================
--- contrib/extra-commands.lua bbc31f3f036d07ac810c500c4122847e1cc83683
+++ contrib/extra-commands.lua 3d0fa49d06310886694ee438963439e673dcd406
@@ -1,26 +1,9 @@
--- WARNING: this feature is not available in the mainline yet
--- you can find it in net.venge.monotone.ws_automate
-
--- include this in your monotonerc file to gain the extra commands.
-
--- Not all of the automate commands used by this lua code are committed
--- to trunk at present. As such this should currently be treated as
--- sample code, not working commands.
-
-if alias_command == nil then
- -- If we're using an older version of monotone that cannot handle lua commands
- -- then turn make sure we don't error.
- function alias_command(...) print("Warning: alias_command() not available in this version of Monotone.") end
-end
-
-if mtn_automate == nil or register_command == nil then
- function register_command(...) print("Warning: register_command() not available in this version of Monotone.") end
-end
-
alias_command("annotate", "blame")
alias_command("annotate", "praise")
function net_update(...)
+ -- could use 'mtn pull --update', or add --update to get_default_command_options for 'pull'
+
result, output = mtn_automate("get_option", "branch") -- make sure we have a valid workspace
if not result then
print("Error from mtn automate call to get_option: ", ouput)
@@ -94,6 +77,8 @@ function merge_update(...)
alias_command("net_commit", "nci")
function merge_update(...)
+ -- could use 'mtn merge --update', or add --update to get_default_command_options for 'merge'
+
result, output = mtn_automate("get_option", "branch") -- make sure we have a valid workspace
if not result then
print("Error from mtn_automate call to get_option: ", output)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone: c15b473a71ade0d413cbb336fa970370ec6cc180,
code <=