#
# patch "ChangeLog"
# from [bb1755209e927d2d4b105e619ed0d2316e7aa194]
# to [5ae1c93f361849e02134bc7b0f3f18e035fdd41e]
#
# patch "platform.hh"
# from [dab8fd68046464428f582e09be90daf606bc0161]
# to [d382d97630a9f4cc256eab352295d3ca0779db4a]
#
# patch "rcs_import.cc"
# from [678b970e6558c90e785b69ab44beeb67423c756f]
# to [2f155daece17f48756d7c866ce417a4a5c1ef7ac]
#
# patch "rcs_import.hh"
# from [eba99da6a1751f001de5a9937f8f71852836553b]
# to [6d6d1b4d5ed96e2cb050b4b30a867510b02e1614]
#
# patch "unix/fs.cc"
# from [53f1074bb04337ad52b1d75f6dfa6a3c844c7309]
# to [c197a57ee859a1240973b0f2b47f433706d36178]
#
# patch "win32/fs.cc"
# from [e9d82d6608ef2f9cac4295157a2dcb298c5aecee]
# to [36d73e1ea0457bac949e35945c0e51bb72971e4c]
#
========================================================================
--- ChangeLog bb1755209e927d2d4b105e619ed0d2316e7aa194
+++ ChangeLog 5ae1c93f361849e02134bc7b0f3f18e035fdd41e
@@ -1,5 +1,11 @@
2005-08-23 Nathaniel Smith
+ * platform.hh, unix/fs.cc, win32/fs.cc
+ (change_current_working_dir): Take an any_path, not a string.
+ * rcs_import.{cc,hh}: Convert to paths.hh.
+
+2005-08-23 Nathaniel Smith
+
* commands.cc (pid_file): Remove fs::path.
2005-08-23 Nathaniel Smith
========================================================================
--- platform.hh dab8fd68046464428f582e09be90daf606bc0161
+++ platform.hh d382d97630a9f4cc256eab352295d3ca0779db4a
@@ -13,6 +13,7 @@
#include "vocab.hh"
#include "config.h"
+#include "paths.hh"
void read_password(std::string const & prompt, char * buf, size_t bufsz);
void get_system_flavour(std::string & ident);
@@ -48,6 +49,7 @@
// filesystem stuff
std::string get_current_working_dir();
-void change_current_working_dir(std::string const & to);
+// calls N() if fails
+void change_current_working_dir(any_path const & to);
#endif // __PLATFORM_HH__
========================================================================
--- rcs_import.cc 678b970e6558c90e785b69ab44beeb67423c756f
+++ rcs_import.cc 2f155daece17f48756d7c866ce417a4a5c1ef7ac
@@ -23,10 +23,6 @@
#include
#include
-#include
-#include
-#include
-
#include "app_state.hh"
#include "cert.hh"
#include "constants.hh"
@@ -41,6 +37,8 @@
#include "sanity.hh"
#include "transforms.hh"
#include "ui.hh"
+#include "platform.hh"
+#include "paths.hh"
using namespace std;
using boost::shared_ptr;
@@ -376,7 +374,7 @@
char code;
int pos, len;
if (sscanf(directive.c_str(), " %c %d %d", &code, &pos, &len) != 3)
- throw oops("illformed directive '" + directive + "'");
+ throw oops("illformed directive '" + directive + "'");
if (code == 'a')
{
@@ -636,32 +634,32 @@
// recursively follow any branch commits coming from the branchpoint
boost::shared_ptr curr_delta = r.deltas.find(curr_version)->second;
for(vector::const_iterator i = curr_delta->branches.begin();
- i != curr_delta->branches.end(); ++i)
- {
- string branch;
- data branch_data;
- hexenc branch_id;
- vector< piece > branch_lines;
- bool priv = false;
- map::const_iterator be = cvs.branch_first_entries.find(*i);
+ i != curr_delta->branches.end(); ++i)
+ {
+ string branch;
+ data branch_data;
+ hexenc branch_id;
+ vector< piece > branch_lines;
+ bool priv = false;
+ map::const_iterator be = cvs.branch_first_entries.find(*i);
- if (be != cvs.branch_first_entries.end())
- branch = be->second;
- else
- priv = true;
-
- L(F("following RCS branch %s = '%s'\n") % (*i) % branch);
+ if (be != cvs.branch_first_entries.end())
+ branch = be->second;
+ else
+ priv = true;
- construct_version(*curr_lines, *i, branch_lines, r);
- insert_into_db(curr_data, curr_id,
+ L(F("following RCS branch %s = '%s'\n") % (*i) % branch);
+
+ construct_version(*curr_lines, *i, branch_lines, r);
+ insert_into_db(curr_data, curr_id,
branch_lines, branch_data, branch_id, db);
cvs.push_branch(branch, priv);
- process_branch(*i, branch_lines, branch_data, branch_id, r, db, cvs);
- cvs.pop_branch();
-
- L(F("finished RCS branch %s = '%s'\n") % (*i) % branch);
- }
+ process_branch(*i, branch_lines, branch_data, branch_id, r, db, cvs);
+ cvs.pop_branch();
+
+ L(F("finished RCS branch %s = '%s'\n") % (*i) % branch);
+ }
if (!r.deltas.find(curr_version)->second->next.empty())
{
@@ -722,18 +720,17 @@
void
-test_parse_rcs_file(fs::path const & filename, database & db)
+test_parse_rcs_file(system_path const & filename, database & db)
{
cvs_history cvs;
I(! filename.empty());
- I(fs::exists(filename));
- I(! fs::is_directory(filename));
+ I(path_state(filename) == path::file);
- P(F("parsing RCS file %s\n") % filename.string());
+ P(F("parsing RCS file %s\n") % filename);
rcs_file r;
- parse_rcs_file(filename.string(), r);
- P(F("parsed RCS file %s OK\n") % filename.string());
+ parse_rcs_file(filename.as_external(), r);
+ P(F("parsed RCS file %s OK\n") % filename);
}
@@ -758,7 +755,7 @@
i != vs.end(); ++i)
{
if (i != vs.begin())
- v += ".";
+ v += ".";
v += *i;
}
}
@@ -794,7 +791,7 @@
branch_first_entries.clear();
for (std::multimap::const_iterator i =
- r.admin.symbols.begin(); i != r.admin.symbols.end(); ++i)
+ r.admin.symbols.begin(); i != r.admin.symbols.end(); ++i)
{
std::string const & num = i->first;
std::string const & sym = i->second;
@@ -825,16 +822,16 @@
else if (components.size() > 2 &&
(components.size() % 2 == 0) &&
components[components.size() - 2] == string("0"))
- {
+ {
// this is a "normal" branch
//
// such as "1.3.0.2", where "1.3" is the branchpoint and
// "1.3.2.1"
first_entry_components = components;
- first_entry_components[first_entry_components.size() - 2]
+ first_entry_components[first_entry_components.size() - 2]
= first_entry_components[first_entry_components.size() - 1];
- first_entry_components[first_entry_components.size() - 1]
+ first_entry_components[first_entry_components.size() - 1]
= string("1");
branchpoint_components = components;
@@ -1219,13 +1216,13 @@
void
-import_cvs_repo(fs::path const & cvsroot,
+import_cvs_repo(system_path const & cvsroot,
app_state & app)
{
- N(!fs::exists(cvsroot / "CVSROOT"),
+ N(path_state(cvsroot / "CVSROOT") != path::directory,
F("%s appears to be a CVS repository root directory\n"
"try importing a module instead, with 'cvs_import %s/")
- % cvsroot.native_directory_string() % cvsroot.native_directory_string());
+ % cvsroot % cvsroot);
{
// early short-circuit to avoid failure after lots of work
@@ -1247,13 +1244,12 @@
{
transaction_guard guard(app.db);
cvs_tree_walker walker(cvs, app.db);
- N( fs::exists(cvsroot),
- F("path %s does not exist") % cvsroot.string());
- N( fs::is_directory(cvsroot),
- F("path %s is not a directory") % cvsroot.string());
+ N(path_state(cvsroot) != path::nonexistent,
+ F("path %s does not exist") % cvsroot);
+ N(path_state(cvsroot) == path::directory,
+ F("path %s is not a directory") % cvsroot);
app.db.ensure_open();
- N(chdir(cvsroot.native_directory_string().c_str()) == 0,
- F("could not change directory to %s") % cvsroot.string());
+ change_current_working_dir(cvsroot);
walk_tree(walker);
guard.commit();
}
@@ -1418,16 +1414,16 @@
{
L(F("skipping cyclical manifest delta %s -> %s\n")
- % parent_mid % child_mid);
+ % parent_mid % child_mid);
// we are potentially breaking the chain one would use to get to
// p. we need to make sure p exists.
if (!app.db.manifest_version_exists(parent_mid))
- {
- L(F("writing full manifest %s\n") % parent_mid);
- manifest_data mdat;
- write_manifest_map(parent_map, mdat);
- app.db.put_manifest(parent_mid, mdat);
- }
+ {
+ L(F("writing full manifest %s\n") % parent_mid);
+ manifest_data mdat;
+ write_manifest_map(parent_map, mdat);
+ app.db.put_manifest(parent_mid, mdat);
+ }
return;
}
@@ -1445,8 +1441,8 @@
delta del;
diff(child_map, parent_map, del);
rcs_put_raw_manifest_edge(parent_mid.inner(),
- child_mid.inner(),
- del, app.db);
+ child_mid.inner(),
+ del, app.db);
}
void
========================================================================
--- rcs_import.hh eba99da6a1751f001de5a9937f8f71852836553b
+++ rcs_import.hh 6d6d1b4d5ed96e2cb050b4b30a867510b02e1614
@@ -9,7 +9,7 @@
#include "vocab.hh"
#include "database.hh"
-void test_parse_rcs_file(fs::path const & filename, database & db);
-void import_cvs_repo(fs::path const & cvsroot, app_state & app);
+void test_parse_rcs_file(system_path const & filename, database & db);
+void import_cvs_repo(system_path const & cvsroot, app_state & app);
#endif // __RCS_IMPORT_HH__
========================================================================
--- unix/fs.cc 53f1074bb04337ad52b1d75f6dfa6a3c844c7309
+++ unix/fs.cc c197a57ee859a1240973b0f2b47f433706d36178
@@ -17,8 +17,8 @@
return std::string(buffer);
}
-void change_current_working_dir(std::string const & to)
+void change_current_working_dir(any_path const & to)
{
- E(!chdir(to.c_str()),
+ E(!chdir(to.as_external().c_str()),
F("cannot change to directory %s: %s") % to % strerror(errno));
}
========================================================================
--- win32/fs.cc e9d82d6608ef2f9cac4295157a2dcb298c5aecee
+++ win32/fs.cc 36d73e1ea0457bac949e35945c0e51bb72971e4c
@@ -17,8 +17,8 @@
return std::string(buffer);
}
-void change_current_working_dir(std::string const & to)
+void change_current_working_dir(any_path const & to)
{
- E(!chdir(to.c_str()),
+ E(!chdir(to.as_external().c_str()),
F("cannot change to directory %s: %s") % to % strerror(errno));
}