Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1.  
  2.     std::unordered_map<std::string, std::string> inACopy;
  3.     std::unordered_map<std::string, std::string> inBCopy;
  4.     std::vector<std::string> CommonAncestorPrefixes;
  5.  
  6.     std::unordered_map<std::string, std::string> manAMap;
  7.     std::unordered_map<std::string, std::string> manBMap;
  8.  
  9.     for(auto x: manifestA) {
  10.         std::string prefix = withoutChecksum(x);
  11.         manAMap[prefix] = x;
  12.     }
  13.  
  14.     for(auto x: manifestB) {
  15.         std::string prefix = withoutChecksum(x);
  16.         manBMap[prefix] = x;
  17.     }
  18.    
  19.  
  20.     for(auto x: manifestA) {
  21.         std::string prefix = withoutChecksum(x);
  22.         if (manBMap.count(prefix)) {
  23.             // If they're the same
  24.             if (manBMap[prefix] == x) {
  25.                 // Do nothing, checksums match
  26.                 // Left in for clarity
  27.             }
  28.             else {
  29.                 // File is same, but dif checksum.
  30.                 CommonAncestorPrefixes.push_back(prefix);
  31.                 inACopy[prefix] = x;
  32.                 inBCopy[prefix] = manBMap[prefix];
  33.                
  34.             }
  35.         }
  36.         else {
  37.             // Copy x
  38.             // The entire file is only in A
  39.         }
  40.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement