From 7ac5740baefdb486cc7dc3ed239ff063ca9dc517 Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 31 Dec 2020 16:59:03 +0000 Subject: [PATCH] ide: repo improvements git-svn-id: svn://ultimatepp.org/upp/trunk@15628 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/RepoSync.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/uppsrc/ide/RepoSync.cpp b/uppsrc/ide/RepoSync.cpp index d24f5cec2..7695637ea 100644 --- a/uppsrc/ide/RepoSync.cpp +++ b/uppsrc/ide/RepoSync.cpp @@ -130,6 +130,7 @@ String GitCmd(const char *dir, const char *command) SetCurrentDirectory(dir); String r = RepoSys(String() << "git " << command); SetCurrentDirectory(h); + DDUMP(r); return r; } @@ -336,6 +337,19 @@ void RepoMoveSvn(const String& path, const String& tp) } } +String GetGitUrl(const String& repo_dir) +{ + Vector ln = Split(GitCmd(repo_dir, "config --get remote.origin.url"), CharFilterCrLf); + return ln.GetCount() ? ln[0] : String(); +} + + +String GetSvnUrl(const String& repo_dir) +{ + Vector ln = Split(RepoSys("svn info --show-item repos-root-url " + repo_dir), CharFilterCrLf); + return ln.GetCount() ? ln[0] : String(); +} + void RepoSync::DoSync() { SyncList(); @@ -365,11 +379,22 @@ again: UrepoConsole sys; int repoi = 0; int l = 0; - String repo_dir; while(l < list.GetCount()) { SvnOptions *svn = dynamic_cast(list.GetCtrl(l, 0)); GitOptions *git = dynamic_cast(list.GetCtrl(l, 0)); String repo_dir = work[repoi++].dir; + String url; + if(git) { + url = GetGitUrl(repo_dir); + if(url.GetCount()) + sys.Log("git origin url: " + url, Gray()); + + } + if(svn) { + url = GetGitUrl(repo_dir); + if(url.GetCount()) + sys.Log("svn repository url: " + url, Gray()); + } l++; String message; String filelist; // <-- list of files to update