Commit 765e753c authored by coppro's avatar coppro

Following a fine MSE tradition of forgetting to svn add new files.

parent e3abdb69
......@@ -18,7 +18,7 @@ AM_LDFLAGS = @WX_LIBS@ $(BOOST_LDFLAGS)
.hpp.gch:
target=`echo $@ | sed "s|.gch$$|.hpp|"`;\
depbase=`echo $$target | sed "s|[^/]*\$$|$(DEPDIR)/&|;s|\\.hpp\$$||"`;\
$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpch -c $$target &&\
$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpch -x c++-header -c $$target &&\
$(am__mv) $$depbase.Tpch $$depbase.Pch
touch $@
.gch.o:
......
......@@ -17,7 +17,7 @@ AM_LDFLAGS = @WX_LIBS@ $(BOOST_LDFLAGS)
.hpp.gch:
target=`echo $@ | sed "s|.gch$$|.hpp|"`;\
depbase=`echo $$target | sed "s|[^/]*\$$|$(DEPDIR)/&|;s|\\.hpp\$$||"`;\
$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpch -c $$target &&\
$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpch -x c++-header -c $$target &&\
$(am__mv) $$depbase.Tpch $$depbase.Pch
touch $@
.gch.o:
......
......@@ -4318,7 +4318,7 @@ uninstall-am: uninstall-binPROGRAMS
.hpp.gch:
target=`echo $@ | sed "s|.gch$$|.hpp|"`;\
depbase=`echo $$target | sed "s|[^/]*\$$|$(DEPDIR)/&|;s|\\.hpp\$$||"`;\
$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpch -c $$target &&\
$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpch -x c++-header -c $$target &&\
$(am__mv) $$depbase.Tpch $$depbase.Pch
touch $@
.gch.o:
......
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2009 Twan van Laarhoven and Sean Hunt |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <util/vcs.hpp>
#include <util/vcs/subversion.hpp>
// ----------------------------------------------------------------------------- : Reflection
template <>
VCSP read_new<VCS>(Reader& reader) {
// there must be a type specified
String type;
reader.handle(_("type"), type);
if (type == _("none")) return new_intrusive<VCS>();
else if (type == _("subversion")) return new_intrusive<SubversionVCS>();
else if (type.empty()) {
reader.warning(_ERROR_1_("expected key", _("version control system")));
throw ParseError(_ERROR_("aborting parsing"));
} else {
reader.warning(_ERROR_1_("unsupported version control type", type));
throw ParseError(_ERROR_("aborting parsing"));
}
}
IMPLEMENT_REFLECTION(VCS) {
REFLECT_IF_NOT_READING {
String type = _("none");
REFLECT(type);
}
}
template <>
void Reader::handle(VCSP& pointer) {
pointer = read_new<VCS>(*this);
handle(*pointer);
}
// ----------------------------------------------------------------------------- : EOF
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2009 Twan van Laarhoven and Sean Hunt |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_UTIL_IO_VCS
#define HEADER_UTIL_IO_VCS
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <wx/filename.h>
class VCS;
DECLARE_POINTER_TYPE(VCS);
template <>
void Reader::handle(VCSP& pointer);
// ----------------------------------------------------------------------------- : VCS
/// Interface to a version control system
/** This allows MSE to interact with various revision control systems directly
* rather than relying on the user to do so. Each method causes the external
* version control system to perform an operation on the specified file name.
* The default implementation just calls the normal file-handling functions.
*/
class VCS : public IntrusivePtrVirtualBase
{
public:
/// Add a file - it's assumed to already have been created
virtual void addFile (const wxFileName& filename) {
}
/// Rename a file (currently unused)
virtual void moveFile (const wxFileName& source, const wxFileName& destination) {
wxRenameFile(source.GetFullName(), destination.GetFullName());
}
/// Delete a file right off the disk
virtual void removeFile (const wxFileName& filename) {
wxRemoveFile(filename.GetFullName());
}
DECLARE_REFLECTION_VIRTUAL();
};
// ----------------------------------------------------------------------------- : EOF
#endif
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2009 Twan van Laarhoven and Sean Hunt |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <util/vcs/subversion.hpp>
// ----------------------------------------------------------------------------- : SVN File Manipulation
void SubversionVCS::addFile(const wxFileName& filename)
{
String name = filename.GetFullPath();
const Char* name_c[] = {_("svn"), _("add"), name.c_str(), nullptr};
switch (wxExecute(const_cast<Char**>(name_c), wxEXEC_SYNC)) // Yuck, const_cast
{
// Success
case 0:
return;
// Couldn't run SVN
case -1:
handle_error(String(_("Can't run SVN.")));
VCS::addFile(filename);
return;
// SVN error
default:
handle_error(String(_("SVN encountered an error")));
VCS::addFile(filename);
return;
}
}
void SubversionVCS::moveFile(const wxFileName& source, const wxFileName& dest)
{
String source_name = source.GetFullPath(), dest_name = dest.GetFullPath();
const Char* name_c[] = {_("svn"), _("mv"), source_name.c_str(), dest_name.c_str(), nullptr};
switch (wxExecute(const_cast<Char**>(name_c), wxEXEC_SYNC)) // Once again, yuck
{
// Success
case 0:
return;
// Couldn't run SVN
case -1:
handle_error(String(_("Can't run SVN.")));
VCS::moveFile(source, dest);
return;
// SVN error
default:
handle_error(String(_("SVN encountered an error")));
VCS::moveFile(source, dest);
return;
}
}
void SubversionVCS::removeFile(const wxFileName& filename)
{
String name = filename.GetFullPath();
const Char* name_c[] = {_("svn"), _("rm"), name.c_str(), nullptr};
handle_warning(String(name_c[0]) + name_c[1] + name_c[2]);
VCS::removeFile(filename);
switch (wxExecute(const_cast<Char**>(name_c), wxEXEC_SYNC)) // Once again, yuck
{
// Success
case 0:
return;
// Couldn't run SVN
case -1:
handle_error(String(_("Can't run SVN.")));
VCS::removeFile(filename);
return;
// SVN error
default:
handle_error(String(_("SVN encountered an error")));
VCS::removeFile(filename);
return;
}
}
IMPLEMENT_REFLECTION(SubversionVCS) {
REFLECT_IF_NOT_READING {
String type = _("subversion");
REFLECT(type);
}
}
// ----------------------------------------------------------------------------- : EOF
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2009 Twan van Laarhoven and Sean Hunt |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_UTIL_IO_SUBVERSION
#define HEADER_UTIL_IO_SUBVERSION
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <util/vcs.hpp>
// ----------------------------------------------------------------------------- : SubversionVCS
class SubversionVCS : public VCS
{
public:
virtual void addFile (const wxFileName& filename);
virtual void moveFile (const wxFileName& source, const wxFileName& destination);
virtual void removeFile (const wxFileName& filename);
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : EOF
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment