#
#
# delete "localized_file_io.cc"
#
# delete "localized_file_io.hh"
#
# delete "tests/files_with_non-utf8_data"
#
# delete "tests/files_with_non-utf8_data/8859-5.lua"
#
# delete "tests/files_with_non-utf8_data/__driver__.lua"
#
# delete "tests/files_with_non-utf8_data/euc.lua"
#
# delete "tests/files_with_non-utf8_data/jp-euc"
#
# delete "tests/files_with_non-utf8_data/jp-utf8"
#
# delete "tests/files_with_non-utf8_data/ru-8859-5"
#
# delete "tests/files_with_non-utf8_data/ru-utf8"
#
# delete "tests/use_get_linesep_conv_hook"
#
# delete "tests/use_get_linesep_conv_hook/__driver__.lua"
#
# delete "tests/use_get_linesep_conv_hook/linesep.lua"
#
# patch "ChangeLog"
# from [659e723a39e7dd50e5b7349f3b15c44d8a8a60fa]
# to [44b1b4ca04e92ba7353f56472072594929704b74]
#
# patch "Makefile.am"
# from [4da41ad5f850629a5da1e19298b1543c197d55fb]
# to [071db1a513c3d68bc0c2b025399688549f0af6b7]
#
# patch "cmd_diff_log.cc"
# from [eea68109f73eb58ad1488bc454e10182c28bafe5]
# to [e84b4a86ba0414af02f3f1de7703dfa89c3fe523]
#
# patch "cmd_files.cc"
# from [bffec2cf6dda0e6bffd827733a5d21e906d1c8cd]
# to [bcb53b6502715fab1b44524cadfe55b8e440b25a]
#
# patch "cmd_ws_commit.cc"
# from [4af21310c13cf9cf4ececa804feffda4ca752de2]
# to [0d728973c10f885a7308b3aaed5b7132271bac6f]
#
# patch "diff_patch.cc"
# from [d23d8030dab765435e0e23847d40cb536bded9ec]
# to [eecf25071f8d089506b15358c160d018b18b0d07]
#
# patch "file_io.cc"
# from [3e1d981f0871c3eba5b8f3eaf2d0dd195cf5a1c2]
# to [2afeb26b0c958d01732bd57a64fd531381cbe892]
#
# patch "file_io.hh"
# from [bda404d4d6e8580d03611242c2c68052d47127a7]
# to [dbfff55ce5a054fe319093f1f733137ca15322b4]
#
# patch "lua_hooks.cc"
# from [bbb38333f2877533b42a2bedf90f518114a1b926]
# to [1f41837fe4b656f8455b5abb327c21f65b41d3f2]
#
# patch "lua_hooks.hh"
# from [3117a32b7a9aa1198111be385327b7d55276e08c]
# to [d1b989184b673d8a9f2082b58ae3bd0a9f38b717]
#
# patch "monotone.texi"
# from [0246c4a5e9d216ebc2b5b8d30ad411f8fdd44345]
# to [47888c3b49f8c6c639a0863d38a66f8b81051f2c]
#
# patch "simplestring_xform.cc"
# from [11b4fae760fa089abfae4084e4746e682e74046f]
# to [97d9d76e5a162bafbe2dd9517e1fbbb17cf562e2]
#
# patch "simplestring_xform.hh"
# from [5eed3405af9b54d50a9dd8b2423effe67ab5b05c]
# to [a3d2b3c5201493b1609578d624070636688c989e]
#
# patch "testsuite.lua"
# from [e6bfff711945291f9ac6aa3116ace3aaa5e1007f]
# to [560dfc234f0599bde41a9d7a7a2736623ad71379]
#
# patch "work.cc"
# from [e51eb4ef492089f109c3aa2b303e3c49b4e122c9]
# to [5bf18d1b155da4c7816e3e82ad2fd82b35cb1336]
#
============================================================
--- ChangeLog 659e723a39e7dd50e5b7349f3b15c44d8a8a60fa
+++ ChangeLog 44b1b4ca04e92ba7353f56472072594929704b74
@@ -1,5 +1,27 @@
-2007-02-07 Daniel Carosone
+2007-02-07 Derek Scherger
+ * Makefile.am (localized_file_io.{cc,hh}): remove
+ * cmd_diff_log.cc:
+ * cmd_files.cc:
+ * cmd_ws_commit.cc:
+ * diff_patch.cc:
+ * work.cc:
+ replace calls to read_localized_data with read_data
+ replace calls to write_localized_data with write_data
+ remove lua arg from calls to ident_existing_file and
+ calculate_ident
+ * file_io.{cc,hh} (ident_existing_file, calculate_ident): move
+ here from localized_file_io.{cc,hh}
+ * lua_hooks.{cc,hh} (hook_get_system_linesep,
+ hook_get_charset_conv, hook_get_linesep_conv): remove
+ * localized_file.{cc,hh}: remove
+ * monotone.texi: remove charset/linesep sections
+ * simplestring_xform.{cc,hh} (line_end_convert): remove
+ * testsuite.lua (use_get_linesep_hook, files_with_non-utf8_data):
+ remove
+
+2007-02-07 Daniel Carosone
+
* tests/db_kill_rev_and_recommit/__driver__.lua/: add a test
(xfail'ed, until fixed) for a bug (#18990) I just tripped over,
whereby db_kill_rev_locally doesn't seem to kill enough.
============================================================
--- Makefile.am 4da41ad5f850629a5da1e19298b1543c197d55fb
+++ Makefile.am 071db1a513c3d68bc0c2b025399688549f0af6b7
@@ -37,7 +37,6 @@ MOST_SOURCES = \
outdated_indicator.cc outdated_indicator.hh \
database.cc database.hh \
key_store.cc key_store.hh \
- localized_file_io.cc localized_file_io.hh \
keys.cc keys.hh \
packet.cc packet.hh \
rcs_file.cc rcs_file.hh \
============================================================
--- cmd_diff_log.cc eea68109f73eb58ad1488bc454e10182c28bafe5
+++ cmd_diff_log.cc e84b4a86ba0414af02f3f1de7703dfa89c3fe523
@@ -15,7 +15,7 @@
#include "cmd.hh"
#include "diff_patch.hh"
-#include "localized_file_io.hh"
+#include "file_io.hh"
#include "restrictions.hh"
#include "revision.hh"
#include "simplestring_xform.hh"
@@ -198,8 +198,7 @@ do_external_diff(cset const & cs,
}
else
{
- read_localized_data(file_path(delta_entry_path(i)),
- data_new, app.lua);
+ read_data(file_path(delta_entry_path(i)), data_new);
}
bool is_binary = false;
@@ -248,8 +247,7 @@ dump_diffs(cset const & cs,
}
else
{
- read_localized_data(file_path(i->first),
- unpacked, app.lua);
+ read_data(file_path(i->first), unpacked);
}
std::string pattern("");
@@ -297,8 +295,7 @@ dump_diffs(cset const & cs,
}
else
{
- read_localized_data(file_path(delta_entry_path(i)),
- data_new, app.lua);
+ read_data(file_path(delta_entry_path(i)), data_new);
}
split_path dst_path = delta_entry_path(i);
============================================================
--- cmd_files.cc bffec2cf6dda0e6bffd827733a5d21e906d1c8cd
+++ cmd_files.cc bcb53b6502715fab1b44524cadfe55b8e440b25a
@@ -12,7 +12,7 @@
#include "annotate.hh"
#include "cmd.hh"
#include "diff_patch.hh"
-#include "localized_file_io.hh"
+#include "file_io.hh"
#include "packet.hh"
#include "simplestring_xform.hh"
#include "transforms.hh"
@@ -165,8 +165,7 @@ CMD(identify, N_("debug"), N_("[PATH]"),
if (args.size() == 1)
{
- read_localized_data(file_path_external(idx(args, 0)),
- dat, app.lua);
+ read_data(file_path_external(idx(args, 0)), dat);
}
else
{
============================================================
--- cmd_ws_commit.cc 4af21310c13cf9cf4ececa804feffda4ca752de2
+++ cmd_ws_commit.cc 0d728973c10f885a7308b3aaed5b7132271bac6f
@@ -12,7 +12,7 @@
#include "cmd.hh"
#include "diff_patch.hh"
-#include "localized_file_io.hh"
+#include "file_io.hh"
#include "packet.hh"
#include "restrictions.hh"
#include "revision.hh"
@@ -154,7 +154,7 @@ CMD(revert, N_("workspace"), N_("[PATH].
if (file_exists(fp))
{
hexenc ident;
- calculate_ident(fp, ident, app.lua);
+ calculate_ident(fp, ident);
// don't touch unchanged files
if (ident == f->content.inner())
continue;
@@ -171,7 +171,7 @@ CMD(revert, N_("workspace"), N_("[PATH].
L(FL("writing file %s to %s")
% f->content % fp);
app.db.get_file_version(f->content, dat);
- write_localized_data(fp, dat.inner(), app.lua);
+ write_data(fp, dat.inner());
}
else
{
@@ -591,7 +591,7 @@ CMD(checkout, N_("tree"), N_("[DIRECTORY
L(FL("writing file %s to %s")
% file->content % path);
app.db.get_file_version(file->content, dat);
- write_localized_data(path, dat.inner(), app.lua);
+ write_data(path, dat.inner());
}
}
@@ -841,7 +841,7 @@ CMD(commit, N_("workspace"), N_("[PATH].
file_data old_data;
data new_data;
app.db.get_file_version(old_content, old_data);
- read_localized_data(path, new_data, app.lua);
+ read_data(path, new_data);
// sanity check
hexenc tid;
calculate_ident(new_data, tid);
@@ -871,7 +871,7 @@ CMD(commit, N_("workspace"), N_("[PATH].
L(FL("inserting full version %s") % new_content);
data new_data;
- read_localized_data(path, new_data, app.lua);
+ read_data(path, new_data);
// sanity check
hexenc tid;
calculate_ident(new_data, tid);
============================================================
--- diff_patch.cc d23d8030dab765435e0e23847d40cb536bded9ec
+++ diff_patch.cc eecf25071f8d089506b15358c160d018b18b0d07
@@ -31,7 +31,7 @@
#include "vocab.hh"
#include "revision.hh"
#include "constants.hh"
-#include "localized_file_io.hh"
+#include "file_io.hh"
using std::endl;
using std::make_pair;
@@ -613,7 +613,7 @@ content_merge_workspace_adaptor::get_ver
require_path_is_file(path,
F("file '%s' does not exist in workspace") % path,
F("'%s' in workspace is a directory, not a file") % path);
- read_localized_data(path, tmp, app.lua);
+ read_data(path, tmp);
calculate_ident(file_data(tmp), fid);
E(fid == ident,
F("file %s in workspace has id %s, wanted %s")
============================================================
--- file_io.cc 3e1d981f0871c3eba5b8f3eaf2d0dd195cf5a1c2
+++ file_io.cc 2afeb26b0c958d01732bd57a64fd531381cbe892
@@ -553,6 +553,41 @@ walk_tree(file_path const & path,
}
}
+bool
+ident_existing_file(file_path const & p, file_id & ident)
+{
+ switch (get_path_status(p))
+ {
+ case path::nonexistent:
+ return false;
+ case path::file:
+ break;
+ case path::directory:
+ W(F("expected file '%s', but it is a directory.") % p);
+ return false;
+ }
+
+ hexenc id;
+ calculate_ident(p, id);
+ ident = file_id(id);
+
+ return true;
+}
+
+void
+calculate_ident(file_path const & file,
+ hexenc & ident)
+{
+ // no conversions necessary, use streaming form
+ // Best to be safe and check it isn't a dir.
+ assert_path_is_file(file);
+ Botan::Pipe p(new Botan::Hash_Filter("SHA-160"), new Botan::Hex_Encoder());
+ Botan::DataSource_Stream infile(file.as_external(), true);
+ p.process_msg(infile);
+
+ ident = hexenc(lowercase(p.read_all_as_string()));
+}
+
// Local Variables:
// mode: C++
// fill-column: 76
============================================================
--- file_io.hh bda404d4d6e8580d03611242c2c68052d47127a7
+++ file_io.hh dbfff55ce5a054fe319093f1f733137ca15322b4
@@ -105,6 +105,9 @@ void walk_tree(file_path const & path,
tree_walker & walker);
+bool ident_existing_file(file_path const & p, file_id & ident);
+void calculate_ident(file_path const & file,
+ hexenc & ident);
// Local Variables:
// mode: C++
============================================================
--- lua_hooks.cc bbb38333f2877533b42a2bedf90f518114a1b926
+++ lua_hooks.cc 1f41837fe4b656f8455b5abb327c21f65b41d3f2
@@ -736,56 +736,6 @@ bool
bool
-lua_hooks::hook_get_system_linesep(string & linesep)
-{
- return Lua(st)
- .func("get_system_linesep")
- .call(0,1)
- .extract_str(linesep)
- .ok();
-}
-
-bool
-lua_hooks::hook_get_charset_conv(file_path const & p,
- string & db,
- string & ext)
-{
- Lua ll(st);
- ll
- .func("get_charset_conv")
- .push_str(p.as_external())
- .call(1,1)
- .begin();
-
- ll.next();
- ll.extract_str(db).pop();
-
- ll.next();
- ll.extract_str(ext).pop();
- return ll.ok();
-}
-
-bool
-lua_hooks::hook_get_linesep_conv(file_path const & p,
- string & db,
- string & ext)
-{
- Lua ll(st);
- ll
- .func("get_linesep_conv")
- .push_str(p.as_external())
- .call(1,1)
- .begin();
-
- ll.next();
- ll.extract_str(db).pop();
-
- ll.next();
- ll.extract_str(ext).pop();
- return ll.ok();
-}
-
-bool
lua_hooks::hook_validate_commit_message(utf8 const & message,
revision_data const & new_rev,
utf8 const & branchname,
============================================================
--- lua_hooks.hh 3117a32b7a9aa1198111be385327b7d55276e08c
+++ lua_hooks.hh d1b989184b673d8a9f2082b58ae3bd0a9f38b717
@@ -110,13 +110,6 @@ public:
file_path const & filename,
std::string const & value);
- // conversion hooks
- bool hook_get_system_linesep(std::string & linesep);
- bool hook_get_charset_conv(file_path const & p,
- std::string & db, std::string & ext);
- bool hook_get_linesep_conv(file_path const & p,
- std::string & db, std::string & ext);
-
// validation hooks
bool hook_validate_commit_message(utf8 const & message,
revision_data const & new_rev,
============================================================
--- monotone.texi 0246c4a5e9d216ebc2b5b8d30ad411f8fdd44345
+++ monotone.texi 47888c3b49f8c6c639a0863d38a66f8b81051f2c
@@ -8147,78 +8147,6 @@ @subsection Selector Expansion
@end ftable
address@hidden System Line and Character Conversions
-
-Different operating systems vary in the character(s) used as line
-separators for text files, and in the character set (locale) used for
-filenames. These differences can become annoying when multiple
-developers on a project use different operating systems. Because so much
-of monotone depends on cryptographic checksums, it is often desirable
-that these differences are removed so that files are considered
-identical regardless of platform-specific representations. The hooks in
-this section allow the user to specify these equivalence and conversion
-rules.
-
address@hidden @code
address@hidden get_system_linesep ()
-
-Returns a string which defines the default system line separator.
-This should be one of the strings @code{CR}, @code{LF}, or
address@hidden The system line separator may be used when reading or
-writing data to the terminal, or otherwise interfacing with the user.
-The system line separator is not used to convert files in the working
-copy; use @code{get_linesep_conv} for converting line endings in the
-workspace.
-
-This hook has no default definition. For more information on line
-ending conversion, see the section on @ref{Internationalization}.
-
address@hidden get_linesep_conv (@var{filename})
-
-Returns a table which contains two strings. The first string in the
-return value is the name of a line ending convention to use for the
-``internal'' representation of @var{filename}. The second string in
-the return value is the name of a line ending convention to use for
-the ``external'' representation of @var{filename}. Line ending
-conventions should be one of the strings @code{CR}, @code{LF}, or
address@hidden
-
-When @var{filename} is read from the workspace, it is run through
-line ending conversion from the external form to the internal
-form. When @var{filename} is written to the workspace, it is run
-through line ending conversion from the internal form to the external
-form. @sc{sha1} values are calculated from the internal form of
address@hidden It is your responsibility to decide which line ending
-conversions your work will use.
-
-This hook has no default definition; monotone's default behavior is to
-keep external and internal forms byte-for-byte identical. For more
-information on line ending conversion, see the section on
address@hidden
-
address@hidden get_charset_conv (@var{filename})
-
-Returns a table which contains two strings. The first string in the
-return value is the name of a character set to use for the
-``internal'' representation of @var{filename}. The second string in
-the return value is the name of a character set to use for the
-``external'' representation of @var{filename}.
-
-When @var{filename} is read from the workspace, it is run through
-character set conversion from the external form to the internal
-form. When @var{filename} is written to the workspace, it is run
-through character set conversion from the internal form to the
-external form. @sc{sha1} values are calculated from the internal
-form of @var{filename}. It is your responsibility to decide which
-character set conversions your work will use.
-
-This hook has no default definition; monotone's default behavior is to
-keep external and internal forms byte-for-byte identical. For more
-information on character set conversion, see the section on
address@hidden
-
address@hidden ftable
-
@subsection Attribute Handling
Some files in a project are special; they may require different handling
@@ -8551,39 +8479,6 @@ @heading General Terms
"internal" (database) charset, the second represents the "external"
(file system) charset.
address@hidden Line ending conversion
-The process of converting platform-dependent end-of-line codes
-(@code{0x0D}, @code{0x0A}, or the pair @code{0x0D 0x0A}) from one
-convention to another. Per-file line ending conversion is specified by
-a Lua hook @code{get_linesep_conv} which takes a filename and returns
-a table of two strings: the first represents the "internal" (database)
-line ending convention, the second represents the "external"
-(file system) line ending convention. each string should be one of the
-three strings "CR", "LF", or "CRLF".
-
-Note that Line ending conversion is always performed on the internal
-character set, when both character set and line ending conversion are
-enabled; this behavior is meant to encourage the use of the monotone's
-``normal form'' (UTF-8, '\n') as an internal form for your source
-files, when working with multiple external forms. Also note that line
-ending conversion only works on character encodings with the specific
-code bytes described above, such as ASCII, ISO-8859x, and UTF-8.
-
address@hidden Normal form conversion
-Character set and line ending conversions done between a "system form"
-and a "normal form". The system character set form is inferred from
-the environment, using the various locale environment variables. The
-system line ending form can be additionally specialized using the
address@hidden hook. No hooks exist for adjusting the
-system character set, since the system character set must be known
-during command-line argument processing, before any Lua hooks are
-loaded.
-
-Monotone's normal form is the UTF-8 character set and the @code{0x0A}
-(LF) line ending form. This form is used in any files monotone needs
-to read, write, and interpret itself, such as @file{_MTN/revision} and
address@hidden/options}.
-
@item LDH
Letters, digits, and hyphen: the set of ASCII bytes @code{0x2D},
@code{0x30..0x39}, @code{0x41..0x5A}, and @code{0x61..0x7A}.
============================================================
--- simplestring_xform.cc 11b4fae760fa089abfae4084e4746e682e74046f
+++ simplestring_xform.cc 97d9d76e5a162bafbe2dd9517e1fbbb17cf562e2
@@ -185,27 +185,6 @@ trim_ws(string const & s)
return tmp;
}
-void
-line_end_convert(string const & linesep, string const & src, string & dst)
-{
- string linesep_str("\n");
- if (linesep == "CR" || linesep == "\r")
- linesep_str = "\r";
- else if (linesep == "CRLF" || linesep == "\r\n")
- linesep_str = "\r\n";
- else if (linesep == "LF"|| linesep == "\n")
- linesep_str = "\n";
-
- L(FL("doing linesep conversion to %s") % linesep);
- vector tmp;
- split_into_lines(src, tmp);
- join_lines(tmp, dst, linesep_str);
- if (src.size() >= linesep.size() &&
- (src.compare(src.size() - linesep.size(), linesep.size(), linesep) == 0))
- dst += linesep_str;
-}
-
-
#ifdef BUILD_UNIT_TESTS
#include "unit_tests.hh"
#include
============================================================
--- simplestring_xform.hh 5eed3405af9b54d50a9dd8b2423effe67ab5b05c
+++ simplestring_xform.hh a3d2b3c5201493b1609578d624070636688c989e
@@ -34,9 +34,6 @@ std::string trim_ws(std::string const &
// remove leading and trailing whitespace
std::string trim_ws(std::string const & s);
-// line-ending conversion
-void line_end_convert(std::string const & linesep, std::string const & src, std::string & dst);
-
// Local Variables:
// mode: C++
// fill-column: 76
============================================================
--- testsuite.lua e6bfff711945291f9ac6aa3116ace3aaa5e1007f
+++ testsuite.lua 560dfc234f0599bde41a9d7a7a2736623ad71379
@@ -493,7 +493,6 @@ table.insert(tests, "cvs_import_with_fil
table.insert(tests, "renaming_a_directory_and_then_adding_a_new_with_the_old_name")
table.insert(tests, "test_problematic_cvs_import")
table.insert(tests, "cvs_import_with_file_added_on_a_branch")
-table.insert(tests, "use_get_linesep_conv_hook")
table.insert(tests, "add_workspace_commit_in_another")
table.insert(tests, "update_to_non-existent_rev")
table.insert(tests, "_--author,_--date")
@@ -516,7 +515,6 @@ table.insert(tests, "automate_graph")
table.insert(tests, "replace_dir_with_file")
table.insert(tests, "automate_parents,_automate_children")
table.insert(tests, "automate_graph")
-table.insert(tests, "files_with_non-utf8_data")
table.insert(tests, "cvs_import,_file_dead_on_head_and_branch")
table.insert(tests, "selecting_arbitrary_certs")
table.insert(tests, "automate_select")
============================================================
--- work.cc e51eb4ef492089f109c3aa2b303e3c49b4e122c9
+++ work.cc 5bf18d1b155da4c7816e3e82ad2fd82b35cb1336
@@ -16,7 +16,7 @@
#include "work.hh"
#include "basic_io.hh"
#include "cset.hh"
-#include "localized_file_io.hh"
+#include "file_io.hh"
#include "platform-wrapped.hh"
#include "restrictions.hh"
#include "sanity.hh"
@@ -540,7 +540,7 @@ addition_builder::add_node_for(split_pat
case path::file:
{
file_id ident;
- I(ident_existing_file(path, ident, lua));
+ I(ident_existing_file(path, ident));
nid = er.create_file_node(ident);
}
break;
@@ -797,7 +797,7 @@ editable_working_tree::attach_node(node_
P(F("adding %s") % dst_pth);
file_data dat;
source.get_version(dst_pth, i->second, dat);
- write_localized_data(dst_pth, dat.inner(), lua);
+ write_data(dst_pth, dat.inner());
return;
}
}
@@ -861,7 +861,7 @@ editable_working_tree::apply_delta(split
F("file '%s' does not exist") % pth_unsplit,
F("file '%s' is a directory") % pth_unsplit);
hexenc curr_id_raw;
- calculate_ident(pth_unsplit, curr_id_raw, lua);
+ calculate_ident(pth_unsplit, curr_id_raw);
file_id curr_id(curr_id_raw);
E(curr_id == old_id,
F("content of file '%s' has changed, not overwriting") % pth_unsplit);
@@ -869,7 +869,7 @@ editable_working_tree::apply_delta(split
file_data dat;
source.get_version(pth_unsplit, new_id, dat);
- write_localized_data(pth_unsplit, dat.inner(), lua);
+ write_data(pth_unsplit, dat.inner());
}
void
@@ -1091,7 +1091,7 @@ workspace::classify_roster_paths(roster_
// the node is a file, check if it exists and has been changed
file_t file = downcast_to_file_t(node);
file_id fid;
- if (ident_existing_file(fp, fid, lua))
+ if (ident_existing_file(fp, fid))
{
if (file->content == fid)
unchanged.insert(sp);
@@ -1179,7 +1179,7 @@ workspace::update_current_roster_from_fi
}
file_t file = downcast_to_file_t(node);
- ident_existing_file(fp, file->content, lua);
+ ident_existing_file(fp, file->content);
}
}