// // aegis - project change supervisor // Copyright (C) 2001, 2003-2008, 2014 Peter Miller // // 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 3 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 // . // #include #include #include #include #include format_rcs::~format_rcs() { } format_rcs::format_rcs() { } format_rcs::pointer format_rcs::create(void) { return pointer(new format_rcs()); } bool format_rcs::is_a_candidate(const nstring &filename) { return filename.ends_with(",v"); } nstring format_rcs::sanitize(const nstring &filename, bool last_part) { // // Break the filename into path elements. // nstring_list sl; sl.split(filename, "/"); // // Get rid of path elements named "RCS" or "CVS" or "Attic". // nstring_list sl2; for (size_t j = 0; j < sl.size(); ++j) { nstring s = sl[j]; if (s != "RCS" && s != "CVS" && s != "Attic") sl2.push_back(s); } if (last_part) { // // Remove the ",v" from the end of the last path element. // if (sl2.size()) { nstring s = sl2.back(); if (s.ends_with(",v")) { s = s.substr(0, s.size() - 2); sl2.pop_back(); sl2.push_back(s); } } } // // Rebuild the filename from the remaining path elements. // return sl2.unsplit("/"); } format_version * format_rcs::read_versions(const nstring &physical, const nstring &logical) { return rcs_parse(physical, logical); } nstring format_rcs::history_put(void) { return ( "ci -u -d -M -m${quote ($version) ${change description}} " "-t/dev/null ${quote $input} ${quote $history,v}; " "rcs -U ${quote $history,v}" ); } nstring format_rcs::history_get(void) { return ( "co -r${quote $edit} -p ${quote $history,v} > ${quote $output}" ); } nstring format_rcs::history_query(void) { return ( "rlog -r ${quote $history,v} | awk '/^revision/ {print $$2}'" ); } nstring format_rcs::diff(void) { // // I'd prefer to say "diff -U10", but we can't rely on GNU // Diff being installed everywhere. It's a risk even using // a context diff, because not all non-GNU diff progs have -c. // return ( "set +e; " CONF_DIFF " " #ifdef HAVE_GNU_DIFF "-U10 --text " #else "-c " #endif "${quote $original} ${quote $input} > ${quote $output}; " "test $? -le 1" ); } nstring format_rcs::merge(void) { return ( "set +e; " "merge -p -L baseline -L C$c ${quote $mostrecent} " "${quote $original} ${quote $input} > ${quote $output}; " "test $? -le 1" ); } void format_rcs::unlock(const nstring &filename) { // // -b means resume working from the trunk, not a branch // -e means get rid of any access list // -ko means no keyword expansion // -M means do not send mail // -q means operate quietly // -U means set locking to non-strict // // There doesn't seem to be an option to get rid of all locks. // nstring qfn = filename.quote_shell(); nstring cmd = "rcs -b -e -M -q -U " + qfn; int flags = OS_EXEC_FLAG_ERROK; nstring dir = "."; os_execute(cmd, flags, dir); } bool format_rcs::valid(void) const { return format::valid(); } // vim: set ts=8 sw=4 et :