[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] RCS repositories
From: |
Andrew McGuinness |
Subject: |
Re: [Monotone-devel] RCS repositories |
Date: |
Sat, 23 Apr 2005 16:42:53 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.2 (X11/20050325) |
Andrew McGuinness wrote:
> I'm having a play with monotone, and had a go at importing a small
> RCS repository with the cvs_import command.
>
> It worked (after upgrading to today's head from 0.18), but because
> we're using RCS (really!), all the files are in RCS/ subdirectories.
>
> A small change to rcs_import.cc fixes this.
>
As it stands it will get confused by directories like TheAttic/ or
convert_from_RCS/, so here's a more robust version. It's a little
awkward, though -- perhaps it would be better to let fs::path
do the dirty work.
#
# patch "ChangeLog"
# from [501f140e9335c16d7459bfa98e179e902ec232a5]
# to [824d72123403a7497c022758bbb849729737ee9b]
#
# patch "rcs_import.cc"
# from [60f5ef2fcd089c3f6bde86d3dcca879dabe58d5b]
# to [47bee90586fcf91277f5884cd660460e0039ed55]
#
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,7 @@
+2005-04-23 Andrew McGuinness <address@hidden>
+
+ * rcs_import.cc (set_filename): ignore "RCS/" in rcs file paths.
+
2005-04-22 Nathaniel Smith <address@hidden>
* manifest.cc (build_restricted_manifest_map): Fixup after merge
--- rcs_import.cc
+++ rcs_import.cc
@@ -765,7 +765,6 @@
author = cvs.author_interner.intern(delta->second->author);
}
-
cvs_history::cvs_history() :
n_versions("versions", "v", 1),
n_tree_branches("branches", "b", 1)
@@ -783,11 +782,18 @@
string ss = file;
ui.set_tick_trailer(ss);
ss.resize(ss.size() - 2);
- // remove Attic/ if present
+ // remove Attic/ or RCS/ if present
std::string::size_type last_slash=ss.rfind('/');
- if (last_slash!=std::string::npos && last_slash>=5
- && ss.substr(last_slash-5,6)=="Attic/")
- ss.erase(last_slash-5,6);
+ if (last_slash!=std::string::npos
+ && last_slash > 0) {
+ std::string::size_type prev_slash=ss.rfind('/', last_slash-1 );
+ std::string::size_type last_dir= (prev_slash==string::npos)?
+ 0:prev_slash+1;
+ std::string::size_type last_dir_len = last_slash + 1 - last_dir;
+ if (ss.substr(last_dir, last_dir_len) == "Attic/"
+ || ss.substr(last_dir, last_dir_len) == "RCS/" )
+ ss.erase(last_dir, last_dir_len );
+ }
curr_file = file_path(ss);
}