// // aegis - project change supervisor // Copyright (C) 2001, 2004-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 #include format_sccs::~format_sccs() { } format_sccs::format_sccs() { } format_sccs::pointer format_sccs::create(void) { return pointer(new format_sccs()); } bool format_sccs::is_a_candidate(const nstring &filename) { return filename.basename().starts_with("s."); } nstring format_sccs::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 "SCCS" // nstring_list sl2; for (size_t j = 0; j < sl.size(); ++j) { nstring s = sl[j]; if (s != "SCCS" && s != "CSSC") sl2.push_back(s); // another for BitKeeper? } if (last_part) { // // Remove the "s." from the beginning of the last path element. // if (sl2.size()) { nstring s = sl2.back(); if (s.starts_with("s.")) { s = s.substr(2, s.size() - 2); sl2.pop_back(); sl2.push_back(s); } } } // // Rebuild the filename from the remaining path elements. // return sl2.unsplit("/"); } format_version * format_sccs::read_versions(const nstring &physical, const nstring &logical) { return sccs_parse(physical, logical); } nstring format_sccs::history_put(void) { // // The ae-sccs-put script is distributed with Aegis. // return ( "ae-sccs-put -G${quote $input} " "-y${quote (${version}) ${change description}} " "${quote ${dirname $history}/s.${basename $history}}" ); } nstring format_sccs::history_get(void) { // // get -r get the specified version // get -G output to file // get -s work silently // get -k no keyword expansion // return ( "sccs get -r${quote $edit} -s -k -G${quote $output} " "${quote ${dirname $history}/s.${basename $history}}" ); } nstring format_sccs::history_query(void) { return ( "sccs get -t -g ${quote ${dirname $history}/s.${basename $history}}" ); } nstring format_sccs::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_sccs::merge(void) { // // This is the RCS merge command. // SCCS doesn't have one of its own. // return ( "set +e; " "merge -p -L baseline -L C$c ${quote $mostrecent} " "${quote $original} ${quote $input} > ${quote $output}; " "test $? -le 1" ); } void format_sccs::unlock(const nstring &filename) { // // -di no keyword expansion // nstring qfn = filename.quote_shell(); nstring cmd = "sccs admin -di " + qfn; int flags = OS_EXEC_FLAG_ERROK; nstring dir = "."; os_execute(cmd, flags, dir); } bool format_sccs::valid(void) const { return format::valid(); } // vim: set ts=8 sw=4 et :