Revision: 73150
          http://sourceforge.net/p/brlcad/code/73150
Author:   starseeker
Date:     2019-05-23 12:07:06 +0000 (Thu, 23 May 2019)
Log Message:
-----------
Not done yet, but start reworking the verify logic for the new setup.

Modified Paths:
--------------
    brlcad/trunk/misc/repoconv/svnfexport/common_structs.h
    brlcad/trunk/misc/repoconv/svnfexport/svnfexport.cxx
    brlcad/trunk/misc/repoconv/svnfexport/svnfexport_git.cxx

Modified: brlcad/trunk/misc/repoconv/svnfexport/common_structs.h
===================================================================
--- brlcad/trunk/misc/repoconv/svnfexport/common_structs.h      2019-05-23 
07:32:02 UTC (rev 73149)
+++ brlcad/trunk/misc/repoconv/svnfexport/common_structs.h      2019-05-23 
12:07:06 UTC (rev 73150)
@@ -107,14 +107,22 @@
 
 std::map<std::pair<std::string,long int>, std::string> rev_to_gsha1;
 
-int verify_repos(long int rev, std::string branch_svn, std::string branch_git, 
int already_applied)
+int verify_repos(long int rev, std::string branch_git)
 {
     int ret = 0;
     std::string git_fi;
+    std::string branch_svn;
 
+    if (branch_mappings.find(branch_git) != branch_mappings.end()) {
+       // TODO - some of these mappings are rev number specific...
+       branch_svn = branch_mappings[branch_git];
+    } else {
+       branch_svn = branch_git;
+    }
+
     std::string cleanup_cmd = std::string("rm -rf brlcad_svn_checkout 
brlcad_git_checkout");
     std::string svn_cmd;
-    if (branch_svn == std::string("trunk") || branch_svn == 
std::string("master")) {
+    if (branch_svn == std::string("trunk")) {
        svn_cmd = std::string("svn co -q -r") + std::to_string(rev) + 
std::string(" file:///home/cyapp/brlcad_repo/repo_dercs/brlcad/trunk 
brlcad_svn_checkout");
     } else {
        svn_cmd = std::string("svn co -q 
file:///home/cyapp/brlcad_repo/repo_dercs/brlcad/branches/") + branch_svn + 
std::string("@") + std::to_string(rev) + std::string(" brlcad_svn_checkout");
@@ -148,23 +156,6 @@
     while (!ret) {
        ret = std::system(git_emptydir_rm.c_str());
     }
-    if (rev > starting_rev) {
-       struct stat buffer;
-       std::string fi_file = std::to_string(rev) + std::string(".fi");
-       if (stat(fi_file.c_str(), &buffer) == 0) {
-           if (!already_applied) {
-               git_fi = std::string("cd cvs_git_working && cat ../") + fi_file 
+ std::string(" | git fast-import && git reset --hard HEAD && cd ..");
-           } else {
-               git_fi = std::string("cd cvs_git_working && git reset --hard 
HEAD && cd ..");
-           }
-           if (std::system(git_fi.c_str())) {
-               std::string failed_file = std::string("failed-") + fi_file;
-               std::cout << "Fatal - could not apply fi file for revision " << 
rev << "\n";
-               rename(fi_file.c_str(), failed_file.c_str());
-               exit(1);
-           }
-       }
-    }
     if (std::system(git_clone.c_str())) {
        std::cerr << "git clone failed!\n";
        exit(1);
@@ -175,19 +166,6 @@
         exit(1);
     }
 
-    std::string fi_file = std::to_string(rev) + std::string(".fi");
-    if (!already_applied) {
-       git_fi = std::string("cd cvs_git && cat ../") + fi_file + std::string(" 
| git fast-import && git reset --hard HEAD && cd ..");
-    } else {
-       git_fi = std::string("cd cvs_git && git reset --hard HEAD && cd ..");
-    }
-    if (std::system(git_fi.c_str())) {
-       std::string failed_file = std::string("failed-") + fi_file;
-       std::cout << "Fatal - could not apply fi file for revision " << rev << 
"\n";
-       rename(fi_file.c_str(), failed_file.c_str());
-       exit(1);
-    }
-
     return 0;
 }
 

Modified: brlcad/trunk/misc/repoconv/svnfexport/svnfexport.cxx
===================================================================
--- brlcad/trunk/misc/repoconv/svnfexport/svnfexport.cxx        2019-05-23 
07:32:02 UTC (rev 73149)
+++ brlcad/trunk/misc/repoconv/svnfexport/svnfexport.cxx        2019-05-23 
12:07:06 UTC (rev 73150)
@@ -67,6 +67,13 @@
         }
     }
 
+
+    /* Branch/tag name mappings */
+    branch_mappings[std::string("framebuffer-experiment")] = 
std::string("framebuffer-experiment");
+    branch_mappings[std::string("master")] = std::string("trunk");
+    branch_mappings[std::string("dmtogl")] = std::string("dmtogl-branch");
+
+
     std::cout << "Starting by verifying revision " << starting_rev << "\n";
 
     //starting_rev = 36000;
@@ -76,9 +83,7 @@
        std::cout << "git setup failed!\n";
        exit(1);
     }
-    //verify_repos(starting_rev, std::string("trunk"), std::string("master"), 
1);
-    //verify_repos(starting_rev, std::string("STABLE"), std::string("STABLE"), 
1);
-    //verify_repos(starting_rev, std::string("rel-5-1-branch"), 
std::string("rel-5-1-branch"), 1);
+    verify_repos(starting_rev, std::string("master"));
 
     /* Populate valid_projects */
     valid_projects.insert(std::string("brlcad"));
@@ -86,9 +91,6 @@
     /* SVN has some empty files - tell our setup how to handle them */
     
svn_sha1_to_git_sha1[std::string("da39a3ee5e6b4b0d3255bfef95601890afd80709")] = 
std::string("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391");
 
-    /* Branch/tag name mappings */
-    branch_mappings[std::string("framebuffer-experiment")] = 
std::string("framebuffer-experiment");
-
     /* Read in pre-existing branch sha1 heads from git */
     load_author_map(argv[2]);
 

Modified: brlcad/trunk/misc/repoconv/svnfexport/svnfexport_git.cxx
===================================================================
--- brlcad/trunk/misc/repoconv/svnfexport/svnfexport_git.cxx    2019-05-23 
07:32:02 UTC (rev 73149)
+++ brlcad/trunk/misc/repoconv/svnfexport/svnfexport_git.cxx    2019-05-23 
12:07:06 UTC (rev 73150)
@@ -169,7 +169,7 @@
 }
 
 
-int apply_fi_file_working(std::string &fi_file) {
+int apply_fi_file_working(std::string &fi_file, std::string &rbranch, int 
is_tag, int do_verify) {
     std::string git_fi = std::string("cd cvs_git_working && cat ../") + 
fi_file + std::string(" | git fast-import && git reset --hard HEAD && cd ..");
     if (std::system(git_fi.c_str())) {
        std::string failed_file = std::string("failed-") + fi_file;
@@ -177,7 +177,9 @@
        rename(fi_file.c_str(), failed_file.c_str());
        return 0;
     }
-    // TODO - this is when we need to do a verify step, if we're going to do 
one...
+    // TODO - should check tags as well...
+    if (do_verify)
+       verify_repos(starting_rev, rbranch);
     return 1;
 }
 
@@ -390,7 +392,7 @@
     std::string wbfi_file;
     if (branch_fi_template.length()) {
        wbfi_file = populate_template(branch_fi_template, rbranch);
-       apply_fi_file_working(wbfi_file);
+       apply_fi_file_working(wbfi_file,rbranch, 0, 1);
        get_rev_sha1(rbranch, rev.revision_number);
        all_git_branches.push_back(rbranch);
     } else {
@@ -410,7 +412,7 @@
     std::string wmvfi_file;
     if (move_fi_template.length()) {
        wmvfi_file = populate_template(move_fi_template, rbranch);
-       apply_fi_file_working(wmvfi_file);
+       apply_fi_file_working(wmvfi_file, rbranch, 0, 0);
        get_rev_sha1(rbranch, rev.revision_number);
     } else {
        wmvfi_file = std::string("");
@@ -496,12 +498,12 @@
            }
 
            // Apply the combined contents of the commit files
-           if (!apply_fi_file_working(wfi_file)) {
+           if (!apply_fi_file_working(wfi_file, rbranch, 0, 1)) {
                // If the apply failed, try generating the tree portion of the
                // commit from an actual svn checkout.  At least for the later
                // commits this is the most common remedy, so see if we can
                // automate it.
-               generate_svn_tree("actual_repo_checkokut_path...", 
rbranch.c_str(), rev.revision_number);
+               generate_svn_tree("actual_repo_checkout_path...", 
rbranch.c_str(), rev.revision_number);
 
                catstr = std::string("cat");
                remove(wfi_file.c_str());
@@ -524,7 +526,7 @@
                    exit(1);
                }
 
-               if (!apply_fi_file_working(wfi_file)) {
+               if (!apply_fi_file_working(wfi_file, rbranch, 0, 1)) {
                    // If we fail again, we're done - need manual review
                    std::cerr << "Failed to apply commit with custom tree: " << 
rev.revision_number << "\n";
                }
@@ -540,7 +542,7 @@
 
            // Generate the note file
            nfi_file = note_svn_rev(rev, rbranch);
-           apply_fi_file_working(nfi_file);
+           apply_fi_file_working(nfi_file, rbranch, 0, 0);
        }
 
        std::string taftercommit_fi_template;
@@ -553,7 +555,7 @@
        }
        if (taftercommit_fi_template.length()) {
            wtfi_file = populate_template(taftercommit_fi_template, rbranch);
-           apply_fi_file_working(wtfi_file);
+           apply_fi_file_working(wtfi_file, rbranch, 1, 1);
        }
 
     } else {
@@ -561,7 +563,7 @@
        wtag_fi_file = populate_template(tag_fi_template, rbranch);
 
        // Apply the tag
-       apply_fi_file_working(wtag_fi_file);
+       apply_fi_file_working(wtag_fi_file, rbranch, 1, 1);
     }
 
     // If we got this far, we're good to go - apply all files to the primary 
repo
@@ -1083,11 +1085,11 @@
 
     std::string commit_fi_file = populate_template(cfi_file, rbranch);
 
-    apply_fi_file_working(commit_fi_file);
+    apply_fi_file_working(commit_fi_file, rbranch, 0, 0);
     get_rev_sha1(rbranch, rev.revision_number);
 
     std::string nfi_file = note_svn_rev(rev, rbranch);
-    apply_fi_file_working(nfi_file);
+    apply_fi_file_working(nfi_file, rbranch, 0, 0);
 
     apply_fi_file(commit_fi_file);
     apply_fi_file(nfi_file);

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