Revision: 72388
          http://sourceforge.net/p/brlcad/code/72388
Author:   starseeker
Date:     2019-02-09 21:42:53 +0000 (Sat, 09 Feb 2019)
Log Message:
-----------
Empty files are causing some issues here... need to stop and rethink.

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

Modified: brlcad/trunk/misc/repoconv/svnfexport/svnfexport.cxx
===================================================================
--- brlcad/trunk/misc/repoconv/svnfexport/svnfexport.cxx        2019-02-09 
21:03:09 UTC (rev 72387)
+++ brlcad/trunk/misc/repoconv/svnfexport/svnfexport.cxx        2019-02-09 
21:42:53 UTC (rev 72388)
@@ -464,7 +464,7 @@
     // r29887 is where we will be starting our fast-export generation - until 
that point,
     // keep current_sha1 up to date on a rolling basis
     if (rev->revision_number <= 29886) {
-       if (n.text_content_sha1.length() && n.text_content_length) {
+       if (n.text_content_sha1.length()) {
            current_sha1[n.path] = n.text_content_sha1;
        }
     }
@@ -747,6 +747,7 @@
 
 void rev_fast_export(std::ifstream &infile, std::ofstream &outfile, long int 
rev_num_min, long int rev_num_max)
 {
+    std::string empty_sha1("da39a3ee5e6b4b0d3255bfef95601890afd80709");
     std::map<long int, struct svn_revision>::iterator r_it;
     for (r_it = revs.begin(); r_it != revs.end(); r_it++) {
        struct svn_revision &rev = r_it->second;
@@ -761,7 +762,7 @@
        if (rev.nodes.size() > 0) {
            for (size_t n = 0; n != rev.nodes.size(); n++) {
                struct svn_node &node = rev.nodes[n];
-               if (node.text_content_sha1.length() && 
node.text_content_length) {
+               if (node.text_content_sha1.length()) {
                    current_sha1[node.path] = node.text_content_sha1;
                }
            }
@@ -782,6 +783,12 @@
                    write_blob(infile, outfile, node);
                    git_changes = 1;
                }
+               if (node.text_content_sha1.length()) {
+                   git_changes = 1;
+               }
+               if (node.text_copy_source_sha1.length()) {
+                   git_changes = 1;
+               }
                if (node.exec_change) {
                    git_changes = 1;
                }
@@ -814,6 +821,9 @@
                        case nadd:
                            outfile << "M ";
                            break;
+                       case nreplace:
+                           outfile << "M ";
+                           break;
                        case ndelete:
                            outfile << "D ";
                            break;
@@ -830,28 +840,19 @@
                        outfile << "100644 ";
                    }
                    if (node.action == nchange || node.action == nadd) {
-                       if (node.exec_change || node.copyfrom_path.length() || 
node.text_content_length) {
+                       if (node.exec_change || node.copyfrom_path.length() || 
node.text_content_length || node.text_content_sha1.length()) {
+                           std::string tpath = std::string("brlcad/trunk/") + 
node.local_path;
                            std::string gsha1 = 
svn_sha1_to_git_sha1[current_sha1[node.path]];
                            if (gsha1.length() < 40) {
                                if (node.copyfrom_rev) {
                                    gsha1 = 
svn_sha1_to_git_sha1[node.text_copy_source_sha1];
-                                   if (gsha1.length() < 40) {
-                                       //TODO - next up is copyfrom_rev - 
probably means we need to go back to the full dump
-                                       //so we can reference earlier versions, 
and track all sha1 content locations not just current...
-                                       std::cout << "Fatal - could not find 
git sha1 - r" << rev.revision_number << ", node: " << node.path << "\n";
-                                       std::cout << "current sha1: " << 
current_sha1[node.path] << "\n";
-                                       std::cout << "Revision merged from: " 
<< rev.merged_from << "\n";
-                                       print_node(node);
-                                       exit(1);
-                                   }
-                               } else {
-                                   std::string tpath = 
std::string("brlcad/trunk/") + node.local_path;
+                               }
+                               if (gsha1.length() < 40) {
                                    gsha1 = 
svn_sha1_to_git_sha1[current_sha1[tpath]];
                                    if (gsha1.length() < 40) {
-                                       //TODO - next up is copyfrom_rev - 
probably means we need to go back to the full dump
-                                       //so we can reference earlier versions, 
and track all sha1 content locations not just current...
                                        std::cout << "Fatal - could not find 
git sha1 - r" << rev.revision_number << ", node: " << node.path << "\n";
                                        std::cout << "current sha1: " << 
current_sha1[node.path] << "\n";
+                                       std::cout << "trunk sha1: " << 
current_sha1[tpath] << "\n";
                                        std::cout << "Revision merged from: " 
<< rev.merged_from << "\n";
                                        print_node(node);
                                        exit(1);
@@ -1013,7 +1014,7 @@
     std::ifstream infile(argv[1]);
     std::ofstream outfile("export.fi", std::ios::out | std::ios::binary);
     if (!outfile.good()) return -1;
-    rev_fast_export(infile, outfile, 29887, 32000);
+    rev_fast_export(infile, outfile, 29887, 42000);
     outfile.close();
 
     return 0;

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



_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to