mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: reposync git revert fixed
This commit is contained in:
parent
d5133628b4
commit
6ef7fb08ee
4 changed files with 37 additions and 34 deletions
|
|
@ -141,7 +141,7 @@ public:
|
|||
|
||||
void Remove(const int *sl, int n) { key.Remove(sl, n); value.Remove(sl, n); }
|
||||
void Remove(const Vector<int>& sl) { Remove(sl, sl.GetCount()); }
|
||||
template <typename P> void RemoveIf(P p) { Remove(FindAlli(p)); }
|
||||
template <typename P> void RemoveIf(P p) { Remove(FindAlli(*this, p)); }
|
||||
|
||||
void Serialize(Stream& s);
|
||||
void Xmlize(XmlIO& xio);
|
||||
|
|
|
|||
|
|
@ -495,6 +495,11 @@ sorted`_list.GetCount()).&]
|
|||
[s7; [*C@3 sl]-|Sorted Vector of positions to remove.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Upp`:`:AMap`:`:RemoveIf`(P`):%- [@(0.0.255) template] <[@(0.0.255) typename]
|
||||
P> [@(0.0.255) void] [* RemoveIf](P [*@3 p])&]
|
||||
[s2; Removes all elements whose index satisfies predicate [%-*@3 p].&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:AMap`:`:RemoveKey`(const K`&`):%- [@(0.0.255) int]_[* RemoveKey]([@(0.0.255) const]_[*@4 K
|
||||
][@(0.0.255) `&]_[*@3 k])&]
|
||||
[s2; Removes all elements with the specified value. This is a slow
|
||||
|
|
|
|||
|
|
@ -243,7 +243,8 @@ bool RepoSync::ListGit(const String& path)
|
|||
int ii = list.GetCount();
|
||||
list.Add(action, file, Null, AttrText(action < 0 ? h : file).Ink(color));
|
||||
if(action >= 0) {
|
||||
list.SetCtrl(ii, 0, revert.Add().SetLabel(an + (action == ADD ? "\nSkip" : "\nRevert")).NoWantFocus());
|
||||
list.SetCtrl(ii, 0, revert.Add().SetLabel(an + (action == ADD ? "\nSkip" : "\nRevert"))
|
||||
.NoWantFocus());
|
||||
revert.Top() <<= 0;
|
||||
Ctrl& b = diff.Add().SetLabel("Changes..").SizePos().NoWantFocus();
|
||||
b <<= THISBACK1(DoDiff, ii);
|
||||
|
|
@ -323,11 +324,7 @@ void RepoSync::SyncList()
|
|||
list.Add(MESSAGE, Null, AttrText("Commit message:").SetFont(StdFont().Bold()));
|
||||
list.SetLineCy(list.GetCount() - 1, (3 * EditField::GetStdHeight()) + 4);
|
||||
list.SetCtrl(list.GetCount() - 1, 1, message.Add().SetFilter(CharFilterSvnMsgRepo).VSizePos(2, 2).HSizePos());
|
||||
int q = msgmap.Find(w.key);
|
||||
if(q >= 0) {
|
||||
message.Top() <<= msgmap[q];
|
||||
msgmap.Unlink(q);
|
||||
}
|
||||
message.Top() <<= msgmap.Get(w.key, Null);
|
||||
}
|
||||
else
|
||||
list.Add(-1, Null, "", AttrText("Nothing to do").SetFont(StdFont().Italic()));
|
||||
|
|
@ -446,7 +443,7 @@ again:
|
|||
url = GetGitUrl(repo_dir);
|
||||
if(url.GetCount())
|
||||
sys.Log("git origin url: " + url, Gray());
|
||||
|
||||
|
||||
}
|
||||
if(svn) {
|
||||
url = GetSvnUrl(repo_dir);
|
||||
|
|
@ -462,31 +459,30 @@ again:
|
|||
if(action == REPOSITORY)
|
||||
break;
|
||||
String path = list.Get(l, 1);
|
||||
|
||||
bool revert = list.Get(l, 2) == 1;
|
||||
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 << "\""))
|
||||
msgmap.GetAdd(repo_dir) = msg;
|
||||
l++;
|
||||
break;
|
||||
|
||||
bool git_commit = git && git->commit.IsEnabled() && git->commit;
|
||||
bool svn_commit = svn && svn->commit.IsEnabled() && svn->commit;
|
||||
|
||||
if(action == MESSAGE) {
|
||||
String msg = list.Get(l, 3);
|
||||
if(commit) {
|
||||
if(svn_commit && sys.CheckSystem(SvnCmd(sys, "commit", repo_dir) << filelist << " -m \"" << msg << "\"") == 0 ||
|
||||
git_commit && sys.Git(repo_dir, "commit -a -m \"" << msg << "\"") == 0)
|
||||
msg.Clear();
|
||||
}
|
||||
|
||||
if(SvnFile(sys, filelist, action, path, revert))
|
||||
commit = true;
|
||||
}
|
||||
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 << "\""))
|
||||
msgmap.GetAdd(repo_dir) = msg;
|
||||
l++;
|
||||
break;
|
||||
}
|
||||
|
||||
if(GitFile(sys, action, path, revert))
|
||||
commit = true;
|
||||
msgmap.GetAdd(repo_dir) = msg;
|
||||
l++;
|
||||
break;
|
||||
}
|
||||
|
||||
if(svn_commit && SvnFile(sys, filelist, action, path, revert))
|
||||
commit = true;
|
||||
|
||||
if(git_commit && GitFile(sys, action, path, revert))
|
||||
commit = true;
|
||||
|
||||
l++;
|
||||
}
|
||||
if(svn && svn->update)
|
||||
|
|
@ -497,8 +493,6 @@ again:
|
|||
int action = list.Get(l, 0);
|
||||
if(action == REPOSITORY)
|
||||
break;
|
||||
if(action == MESSAGE)
|
||||
msgmap.GetAdd(repo_dir) = list.Get(l, 3);
|
||||
l++;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -509,6 +503,8 @@ again:
|
|||
sys.Log("Done", Gray());
|
||||
ResetBlitz();
|
||||
sys.Perform();
|
||||
|
||||
msgmap.RemoveIf([&](int i) { return IsNull(msgmap[i]); });
|
||||
}
|
||||
|
||||
bool RepoSync::GitFile(UrepoConsole& sys, int action, const String& path, bool revert)
|
||||
|
|
@ -517,7 +513,7 @@ bool RepoSync::GitFile(UrepoConsole& sys, int action, const String& path, bool r
|
|||
String file = GetFileName(path);
|
||||
if(revert) {
|
||||
if(action != ADD)
|
||||
sys.Git(repo_dir, "checkout \"" + file + "\"");
|
||||
sys.Git(repo_dir, "restore \"" + file + "\"");
|
||||
return false;
|
||||
}
|
||||
if(action == ADD)
|
||||
|
|
|
|||
|
|
@ -751,6 +751,7 @@ void SelectPackageDlg::Load(const String& find)
|
|||
for(int i = 0; i < data.GetCount() && loading; i++) { // Now investigate individual sub folders
|
||||
ArrayMap<String, PkData>& nest = data[i];
|
||||
String nest_dir = NormalizePath(upp[i]);
|
||||
DDUMP(nest_dir);
|
||||
for(int i = 0; i < nest.GetCount() && loading; i++) {
|
||||
if(msecs(update) >= 100) { // each 100 ms update the list (and open select dialog after splash screen is closed)
|
||||
if(!IsSplashOpen() && !IsOpen())
|
||||
|
|
@ -763,6 +764,7 @@ void SelectPackageDlg::Load(const String& find)
|
|||
|
||||
PkData& d = nest[i];
|
||||
String path = nest.GetKey(i);
|
||||
DDUMP(path);
|
||||
if(NormalizePath(path).StartsWith(nest_dir) && DirectoryExists(path)) {
|
||||
String upp_path = AppendFileName(path, GetFileName(d.package) + ".upp");
|
||||
LSLOW(); // this is used for testing only, normally it is NOP
|
||||
|
|
@ -793,7 +795,7 @@ void SelectPackageDlg::Load(const String& find)
|
|||
if(IsNull(tm)) // package icon does not exist
|
||||
d.icon = Null;
|
||||
else
|
||||
if(tm != d.itm) { // chached package icon outdated
|
||||
if(tm != d.itm || d.icon.GetSize().cx != DPI(16)) { // chached package icon outdated
|
||||
d.icon = StreamRaster::LoadFileAny(icon_path);
|
||||
d.itm = tm;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue