ide: repo improvements, fixed search in package selector (removed nest name from the search string), sql, postgresql: some missing #undefs in the schema

This commit is contained in:
Mirek Fidler 2022-05-23 08:45:41 +02:00
parent e7a690d857
commit a0533749ec
7 changed files with 69 additions and 34 deletions

Binary file not shown.

View file

@ -147,75 +147,72 @@ ATTRIBUTE("alter table @t add constraint UQ_@t$" #name " unique (" list ");", \
#undef INT_ARRAY
#undef INT_
#undef INT_ARRAY_
#undef INT64
#undef INT64_ARRAY
#undef INT64_
#undef INT64_ARRAY_
#undef SERIAL
#undef SERIAL_ARRAY
#undef SERIAL_
#undef SERIAL_ARRAY_
#undef ISERIAL
#undef ISERIAL_ARRAY
#undef ISERIAL_
#undef ISERIAL_ARRAY_
#undef BIGSERIAL
#undef BIGSERIAL_ARRAY
#undef BIGSERIAL_
#undef BIGSERIAL_ARRAY_
#undef DOUBLE
#undef DOUBLE_ARRAY
#undef DOUBLE_
#undef DOUBLE_ARRAY_
#undef STRING
#undef STRING_ARRAY
#undef STRING_
#undef STRING_ARRAY_
#undef DATE
#undef DATE_ARRAY
#undef DATE_
#undef DATE_ARRAY_
#undef TIME
#undef TIME_ARRAY
#undef TIME_
#undef TIME_ARRAY_
#undef TIME_SEC
#undef TIME_SEC_ARRAY
#undef TIME_SEC_
#undef TIME_SEC_ARRAY_
#undef BOOL
#undef BOOL_ARRAY
#undef BOOL_
#undef BOOL_ARRAY_
#undef LONG
#undef LONG_
#undef LONGRAW
#undef LONGRAW_
#undef BLOB
#undef BLOB_
#undef CLOB
#undef CLOB_
#undef SEQUENCE
#undef SEQUENCE_
#undef PRIMARY_KEY
#undef NOT_NULL
#undef INDEX
#undef PARTIAL_INDEX
#undef UNIQUE
#undef SQLDEFAULT
#undef INDEX
#undef PARTIAL_INDEX
#undef PARTIAL_INDEX_
#undef REFERENCES
#undef REFERENCES_
#undef REFERENCES_CASCADE
#undef REFERENCES_
#undef REFERENCES_CASCADE_
#undef DUAL_PRIMARY_KEY
#undef DUAL_UNIQUE
#undef UNIQUE_LIST
#undef SQLCHECK
#undef INDEX_LIST
#undef PARTIAL_INDEX_LIST
#undef PRIMARY_KEY_LIST
#undef REFERENCES_LIST
#undef INDEX_LIST
#undef PARTIAL_INDEX_LIST
#undef UNIQUE_LIST

View file

@ -202,3 +202,4 @@
#undef SCHEMA
#undef CONFIG
#undef UPGRADE
#undef TIMESTAMP

View file

@ -1,5 +1,10 @@
#include "ide.h"
String RepoCfgFile(const String& path)
{
return ConfigFile("cfg/repo-" + SHA1String(path));
}
String GetGitUrl(const String& repo_dir)
{
Vector<String> ln = Split(GitCmd(repo_dir, "config --get remote.origin.url"), CharFilterCrLf);
@ -80,6 +85,33 @@ RepoSync::RepoSync()
};
}
RepoSync::~RepoSync()
{
int repoi = 0;
for(int i = 0; i < list.GetCount(); i++) {
SvnOptions *svn = dynamic_cast<SvnOptions *>(list.GetCtrl(i, 0));
GitOptions *git = dynamic_cast<GitOptions *>(list.GetCtrl(i, 0));
if(svn || git) {
String s;
if(svn) {
if(svn->commit)
s << "commit;";
if(svn->update)
s << "update;";
}
if(git) {
if(git->pull)
s << "pull;";
if(git->commit)
s << "commit;";
if(git->push)
s << "push;";
}
SaveChangedFile(RepoCfgFile(work.GetKey(repoi++)), s);
}
}
}
int CharFilterSvnMsgRepo(int c)
{
return c >= 32 && c < 128 && c != '\"' ? c : 0;
@ -228,10 +260,10 @@ void RepoSync::SyncCommits()
bool commit = true;
for(int i = 0; i < list.GetCount(); i++) {
if(SvnOptions *o = dynamic_cast<SvnOptions *>(list.GetCtrl(i, 0)))
commit = o->commit;
commit = o->commit.IsEnabled() && o->commit;
else
if(GitOptions *o = dynamic_cast<GitOptions *>(list.GetCtrl(i, 0)))
commit = o->commit;
commit = o->commit.IsEnabled() && o->commit;
else {
for(int j = 0; j < 2; j++) {
Ctrl *ctrl = list.GetCtrl(i, j);
@ -249,6 +281,12 @@ void RepoSync::SyncList()
svndir.Clear();
for(const auto& w : ~work) {
String path = GetFullPath(w.key);
String cfg = LoadFile(RepoCfgFile(path));
auto Default = [&](const char *s) {
if(cfg.IsVoid())
return true;
return cfg.Find(s) >= 0;
};
int hi = list.GetCount();
Color bk = AdjustIfDark(LtYellow());
list.Add(REPOSITORY, path,
@ -260,12 +298,11 @@ void RepoSync::SyncList()
if(w.value == SVN_DIR) {
auto& o = list.CreateCtrl<SvnOptions>(hi, 0, false);
o.SizePos();
o.commit = true;
o.commit = Default("commit");
o.commit << [=] { SyncCommits(); };
o.update = true;
o.update = Default("update");
actions = ListSvn(path);
if(!actions) {
o.commit = false;
o.commit.Disable();
}
credentials.Show();
@ -274,13 +311,12 @@ void RepoSync::SyncList()
if(w.value == GIT_DIR) {
auto& o = list.CreateCtrl<GitOptions>(hi, 0, false);
o.SizePos();
o.commit = true;
o.commit = Default("commit");
o.commit << [=] { SyncCommits(); };
o.push = true;
o.pull = true;
o.push = Default("push");
o.pull = Default("pull");
actions = ListGit(path);
if(!actions) {
o.commit = false;
o.push = false;
o.commit.Disable();
}
@ -428,6 +464,8 @@ again:
int action = list.Get(l, 0);
if(action == REPOSITORY)
break;
if(action == MESSAGE)
msgmap.GetAdd(repo_dir) = list.Get(l, 3);
l++;
}
continue;
@ -439,7 +477,7 @@ again:
break;
String path = list.Get(l, 1);
bool revert = list.Get(l, 2) == 1;
if(svn && svn->commit) {
if(svn && svn->commit.IsEnabled() && svn->commit) {
if(action == MESSAGE && commit) {
String msg = list.Get(l, 3);
if(sys.CheckSystem(SvnCmd(sys, "commit", repo_dir) << filelist << " -m \"" << msg << "\""))
@ -451,7 +489,7 @@ again:
if(SvnFile(sys, filelist, action, path, revert))
commit = true;
}
if(git && git->commit) {
if(git && git->commit.IsEnabled() && git->commit) {
if(action == MESSAGE && commit) {
String msg = list.Get(l, 3);
if(sys.Git(repo_dir, "commit -a -m \"" << msg << "\""))

View file

@ -593,7 +593,7 @@ void SelectPackageDlg::SyncList(const String& find)
d.ispackage &&
(!(fk == MAIN) || d.main) &&
(!(fk == NONMAIN) || !d.main) &&
ToUpper(d.package + d.description + d.nest).Find(s) >= 0 &&
ToUpper(d.package + d.description).Find(s) >= 0 &&
added.Find(d.package) < 0) {
packages.Add() = d;
if(!d.main)

View file

@ -581,7 +581,7 @@ void Ide::FilePropertiesMenu(Bar& menu)
}
if(mine.GetCount() || theirs.GetCount() || original.GetCount()) {
menu.Sub("SVN Conflict", [=] (Bar& bar) {
menu.Sub(editfile_repo == GIT_DIR ? "GIT Conflict" : "SVN Conflict", [=] (Bar& bar) {
if(mine.GetCount() && theirs.GetCount())
bar.Add("Compare mine <-> theirs", [=] { DiffFiles("mine", mine, "theirs", theirs); });
if(mine.GetCount() && original.GetCount())
@ -610,8 +610,6 @@ void Ide::FilePropertiesMenu(Bar& menu)
});
}
}
if(editfile.GetCount() && editfile_repo == GIT_DIR) {
}
}
}

View file

@ -84,6 +84,7 @@ public:
void DoSync();
RepoSync();
~RepoSync();
};