[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone: 46d59b9242bfcc6d14769816861
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone: 46d59b9242bfcc6d147698168611cfa416ac62ea |
Date: |
Fri, 2 Mar 2012 20:53:32 +0100 (CET) |
revision: 46d59b9242bfcc6d147698168611cfa416ac62ea
date: 2012-03-02T19:53:06
author: Richard Levitte <address@hidden>
branch: net.venge.monotone
changelog:
merge of '872cbbe65c64dd0e036dca178ea2e62242cf126c'
and 'bdc0199b02f8fb61fc4c08db7228134cd3c4202f'
manifest:
format_version "1"
new_manifest [5c9ac6322746d0d83161b23909ff415014d5458e]
old_revision [872cbbe65c64dd0e036dca178ea2e62242cf126c]
patch "Makefile.am"
from [e7645a0138a74106e628aeb82399e1adad0fbc90]
to [e601735ae7a62b55743bef936b8acf1f2ff490fb]
old_revision [bdc0199b02f8fb61fc4c08db7228134cd3c4202f]
add_dir "test/func/disapprove_root_revision"
add_file "contrib/basicio.vim"
content [ff652790f22fb5e3421c0b70b5c45d6c8d470d3b]
add_file "contrib/colortone.pl"
content [4de0235589831da1b9daeeba18841074c240fe78]
add_file "test/func/disapprove_root_revision/__driver__.lua"
content [743f82c455ccc4d57b1ee123d0c8fcf7341f8207]
patch "NEWS"
from [8cae90559bb06b2bc77c211397218299c1660d13]
to [ed0d68331a7ba1efb4877f7a65628a1c9f7d791c]
patch "src/cmd_diff_log.cc"
from [b24dffb0470d057fa1e91ccc5a81627b40252e78]
to [55dcbe5e40b8e706559f8b76a83b7fb81caecde1]
patch "src/cmd_ws_commit.cc"
from [aa290a0418e1944d17768dd0d07fe6c3f348f2cf]
to [431aff612ada586c56b63247423ae72df1650b88]
patch "src/pcrewrap.cc"
from [7f5bd4e7d8d9e02f2b0271fa9a0f64dcbce2467d]
to [59b11bb0076d4724c95c34840409be6d8357a68e]
patch "src/work.hh"
from [00e100f44763cad0019683c16c4a13d53a94d5e0]
to [0ca2a0f0ab94c2421db119216af9373b81f38e61]
============================================================
--- Makefile.am e7645a0138a74106e628aeb82399e1adad0fbc90
+++ Makefile.am e601735ae7a62b55743bef936b8acf1f2ff490fb
@@ -724,6 +724,11 @@ mostlyclean-tests:
rmdir $${d%/*} || :; \
done
+# With the MacOS X toolchain, some stuff may be generated in the form of subdirs
+.PHONY: mostlyclean-util
+mostlyclean-util:
+ rm -rf util/txt2c.dSYM
+
MOSTLYCLEANFILES = mtn.1 \
run_tester_tests run_func_tests run_unit_tests run_extra_tests \
test/tester.status test/func.status test/unit.status test/extra.status
@@ -896,7 +901,7 @@ uninstall-local: uninstall-nls \
install-contrib-data install-examples-data
uninstall-local: uninstall-nls \
uninstall-contrib-data uninstall-examples-data
-mostlyclean-local: mostlyclean-tests
+mostlyclean-local: mostlyclean-tests mostlyclean-util
check-local: check-testers
# All hooks supported by automake here, depending on all the things we want
============================================================
--- NEWS 8cae90559bb06b2bc77c211397218299c1660d13
+++ NEWS ed0d68331a7ba1efb4877f7a65628a1c9f7d791c
@@ -14,6 +14,11 @@ XXX XXX XX XX:XX:XX UTC 201X
Internal
+ - The performance and memory usage of regular expressions has
+ been improved throughout. This affects any use of the
+ ".mtn-ignore" file such as "mtn ls unknown" and "mtn add",
+ and any calls to "regex.search" in Lua hooks.
+
Other
============================================================
--- src/work.hh 00e100f44763cad0019683c16c4a13d53a94d5e0
+++ src/work.hh 0ca2a0f0ab94c2421db119216af9373b81f38e61
@@ -18,7 +18,7 @@ class lua_hooks;
class node_restriction;
struct content_merge_adaptor;
class lua_hooks;
-class i18n_format;
+struct i18n_format;
struct options;
class app_state;
============================================================
--- src/cmd_diff_log.cc b24dffb0470d057fa1e91ccc5a81627b40252e78
+++ src/cmd_diff_log.cc 55dcbe5e40b8e706559f8b76a83b7fb81caecde1
@@ -369,6 +369,9 @@ prepare_diff(app_state & app,
old_from_db = true;
new_from_db = true;
+
+ header << "# old_revision [" << r_old_id << "]\n";
+ header << "# new_revision [" << r_new_id << "]\n";
}
else
{
============================================================
--- src/cmd_ws_commit.cc aa290a0418e1944d17768dd0d07fe6c3f348f2cf
+++ src/cmd_ws_commit.cc 431aff612ada586c56b63247423ae72df1650b88
@@ -670,6 +670,8 @@ CMD(disapprove, "disapprove", "", CMD_RE
unsigned int old_head_size = heads.size();
edge_entry const & old_edge (*rev.edges.begin());
+ E(!null_id(edge_old_revision(old_edge)), origin::user,
+ F("cannot disapprove root revision"));
db.get_revision_manifest(edge_old_revision(old_edge),
rev_inverse.new_manifest);
{
============================================================
--- src/pcrewrap.cc 7f5bd4e7d8d9e02f2b0271fa9a0f64dcbce2467d
+++ src/pcrewrap.cc 59b11bb0076d4724c95c34840409be6d8357a68e
@@ -11,6 +11,7 @@
#include "pcrewrap.hh"
#include "sanity.hh"
#include <cstring>
+#include <map>
#include <vector>
// This dirty trick is necessary to prevent the 'pcre' typedef defined by
@@ -19,6 +20,9 @@
#include "pcre.h"
#undef pcre
+using std::make_pair;
+using std::map;
+using std::pair;
using std::string;
using std::vector;
@@ -69,11 +73,63 @@ namespace pcre
namespace pcre
{
+ typedef map<char const *,
+ pair<struct real_pcre const *, struct pcre_extra const *> >
+ regex_cache;
+
+ class regex_cache_manager
+ {
+public:
+ regex_cache::const_iterator find(char const * pattern)
+ {
+ return cache.find(pattern);
+ }
+
+ void store(char const * pattern,
+ pair<struct real_pcre const *, struct pcre_extra const *>
+ data)
+ {
+ cache[pattern] = data;
+ }
+
+ regex_cache::const_iterator end()
+ {
+ return cache.end();
+ }
+
+ ~regex_cache_manager()
+ {
+ for (regex_cache::iterator iter = cache.begin();
+ iter != cache.end();
+ ++iter)
+ {
+ if (iter->second.first)
+ pcre_free(const_cast<pcre_t *>(iter->second.first));
+
+ if (iter->second.second)
+ pcre_free(const_cast<pcre_extra *>(iter->second.second));
+ }
+ }
+private:
+ regex_cache cache;
+ };
+
+ regex_cache_manager compiled;
+
void regex::init(char const * pattern, flags options)
{
int errcode;
int erroff;
char const * err;
+ // use the cached data if we have it
+ regex_cache::const_iterator iter = compiled.find(pattern);
+ if (iter != compiled.end())
+ {
+ basedat = iter->second.first;
+ extradat = iter->second.second;
+ return;
+ }
+ // not in cache - compile them then store in cache
basedat = pcre_compile2(pattern, flags_to_internal(options),
&errcode, &err, &erroff, 0);
if (!basedat)
@@ -97,6 +153,8 @@ namespace pcre
ed->flags |= PCRE_EXTRA_MATCH_LIMIT_RECURSION;
ed->match_limit_recursion = 2000;
extradat = ed;
+ // store in cache
+ compiled.store(pattern, make_pair(basedat, extradat));
}
regex::regex(char const * pattern, origin::type whence, flags options)
@@ -113,10 +171,6 @@ namespace pcre
regex::~regex()
{
- if (basedat)
- pcre_free(const_cast<pcre_t *>(basedat));
- if (extradat)
- pcre_free(const_cast<pcre_extra *>(extradat));
}
bool
============================================================
--- /dev/null
+++ test/func/disapprove_root_revision/__driver__.lua 743f82c455ccc4d57b1ee123d0c8fcf7341f8207
@@ -0,0 +1,11 @@
+mtn_setup()
+
+addfile("foo", "bar")
+commit()
+to_disapprove = base_revision()
+addfile("xyzzy", "xyzzy")
+commit()
+addfile("123", "456")
+commit()
+check(mtn("disapprove", to_disapprove), 1, true, true)
+check(qgrep("cannot disapprove root revision", "stderr"))
============================================================
--- /dev/null
+++ contrib/colortone.pl 4de0235589831da1b9daeeba18841074c240fe78
@@ -0,0 +1,89 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+# colortone.pl - colors monotone output such as status, log and diff
+#
+# Reads input from STDIN and adds ANSI escape codes before outputting
+# to STDOUT. Passing filenames on the command line is also supported.
+#
+# Windows systems need Win32::Console::ANSI installed to support showing
+# color within cmd.exe.
+#
+# Usage
+# mtn diff | colortone.pl
+# mtn diff > diff.txt && colortone.pl diff.txt
+#
+# Windows Usage
+# To make it easier to use, create a new file 'myname.bat' with the
+# following contents (keeping quotes).
+#
+# @"C:\Program Files\monotone\mtn.exe" %* | perl "C:\Full\Path\To\colortone.pl"
+#
+# This allows you to use 'myname' as a replacement for mtn and output will
+# be colored automatically. Only use it if your key passphrase is not
+# required: diff, status, and log are fine.
+#
+# The piping has to be done through perl manually due to
+# http://support.microsoft.com/kb/321788.
+#
+# Copyright 2011 Richard Hopkins
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+use Term::ANSIColor;
+
+if ( $^O eq 'MSWin32' ) {
+ require Win32::Console::ANSI;
+ import Win32::Console::ANSI;
+}
+
+# pattern => attributes
+#
+# pattern should contain a grouping as only the group will be colored.
+#
+# attributes is a single string containing any attributes supported by
+# Term::ANSIColor separated with a space.
+# eg. 'red on_white bold'
+my %patterns = (
+ q/(^#.*)/ => 'yellow', # diff header
+ q/(^@@.*)/ => 'magenta', # diff encloser
+ q/(^\+.*)/ => 'green', # diff added
+ q/(^\|\s+\+.*)/ => 'green', # diff added (with graph)
+ q/(^-.*)/ => 'red', # diff removed
+ q/(^\|\s+-.*)/ => 'red', # diff removed (with graph)
+ q/([a-f0-9]{40})/ => 'magenta bold', # revision or file id
+ q/(^\| +\w+:)/ => 'white bold', # log header (with graph)
+ q/(^\w+:)/ => 'white bold', # status header
+ q/(^\*\*\*.+\*\*\*$)/ => 'yellow bold', # status warning
+ q/( added)/ => 'green', # status added
+ q/( patched)/ => 'cyan bold', # status patched
+ q/( dropped)/ => 'red', # status dropped
+ q/( renamed)/ => 'blue bold', # status renamed
+);
+
+my $reset = color('reset');
+
+while (<>) {
+
+ # colorize any matching patterns in the current line.
+ foreach my $pattern ( keys %patterns ) {
+ my $color = color( $patterns{$pattern} );
+ $_ =~ s/$pattern/$color$1$reset/;
+ }
+
+ print colored $_;
+}
+
+exit(0);
============================================================
--- /dev/null
+++ contrib/basicio.vim ff652790f22fb5e3421c0b70b5c45d6c8d470d3b
@@ -0,0 +1,13 @@
+" Syntax highlighting for monotone basic_io format
+" used by 'read-permissions', and 'write-permissions'
+"
+" Set up keywords and patterns we want to highlight
+syn match basicIOSymbol /[a-z_]*/
+syn region basicIOString start=+"+ skip=+\\\\\|\\"+ end=+"+
+syn match basicIOHexID /\[[a-fA-F0-9]*\]/
+
+" Set up sane default highlighting links, such as basicIOString->String
+hi def link basicIOSymbol Keyword
+hi def link basicIOString String
+hi def link basicIOHexID Identifier
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone: 46d59b9242bfcc6d147698168611cfa416ac62ea,
code <=