Revision: 76495
          http://sourceforge.net/p/brlcad/code/76495
Author:   starseeker
Date:     2020-07-25 16:08:46 +0000 (Sat, 25 Jul 2020)
Log Message:
-----------
Add option to skip newer commits, don't try to verify branch delete commits 
(svn checkout won't work).

Modified Paths:
--------------
    brlcad/trunk/misc/repoconv/verify.cpp

Modified: brlcad/trunk/misc/repoconv/verify.cpp
===================================================================
--- brlcad/trunk/misc/repoconv/verify.cpp       2020-07-25 14:47:03 UTC (rev 
76494)
+++ brlcad/trunk/misc/repoconv/verify.cpp       2020-07-25 16:08:46 UTC (rev 
76495)
@@ -4,6 +4,7 @@
 #include <sstream>
 #include <string>
 #include <regex>
+#include "cxxopts.hpp"
 
 int verify_repos(std::string rev, std::string branch_svn, std::string sha1, 
std::string git_repo, std::string svn_repo)
 {
@@ -67,13 +68,46 @@
     return 0;
 }
 
-int main(int argc, const char *argv[])
+int main(int argc, char *argv[])
 {
     int ret;
+    int start_rev = 100000;
+
+    try
+    {
+       cxxopts::Options options(argv[0], " - verify svn->git conversion");
+
+       options.add_options()
+           ("s,start-rev", "Skip any revision higher than this number", 
cxxopts::value<int>(), "#")
+           ("h,help", "Print help")
+           ;
+
+       auto result = options.parse(argc, argv);
+
+       if (result.count("help"))
+       {
+           std::cout << options.help({""}) << std::endl;
+           return 0;
+       }
+
+       if (result.count("s"))
+       {
+           start_rev = result["s"].as<int>();
+       }
+
+    }
+    catch (const cxxopts::OptionException& e)
+    {
+       std::cerr << "error parsing options: " << e.what() << std::endl;
+       return -1;
+    }
+
+
     if (argc != 3) {
        std::cerr << "Usage: verify <git_repo_full_path> 
<svn_repo_full_path>\n";
        return -1;
     }
+
     std::string svn_repo(argv[2]);
     std::string git_repo(argv[1]);
     std::string list_sha1 = std::string("cd ") + git_repo + std::string(" && 
git log --all --pretty=format:\"%H\" > ../commits.txt && cd ..");
@@ -125,6 +159,19 @@
        }
        std::string rev = std::string(rmatch[1]);
 
+       if (std::stol(rev) > start_rev) {
+           continue;
+       }
+
+       // svn branch deletes can't be verified by checkout, skip those
+       std::regex bdelete_regex(".*svn branch delete.*");
+       std::smatch bd_match;
+       if (std::regex_search(msg, bd_match, bdelete_regex)) {
+           std::cerr << "branch delete commit, skipping verification\n";
+           continue;
+       }
+
+
        std::string branch("trunk");
        std::regex branch_regex(".*svn:branch:([a-zA-Z0-9_-]+).*");
        std::smatch bmatch;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to