예제 #1
0
 public void parseStrSVN(string data, string basePath)
 {
     XmlDocument doc = new XmlDocument();
     try
     {
         doc.LoadXml(data);
         XmlNode root = doc.SelectSingleNode("lists").SelectSingleNode("list");
         foreach (XmlNode node in root.ChildNodes)
         {
             if (node.Attributes["kind"].Value == "dir") continue;
             Revision r = findRev(getFileRevisionSVN(node), getFileBasePathSVN(node, basePath));
             if (null == r)
             {
                 r = new Revision(node, basePath);
                 revList.Add(r);
             }
             else
             {
                 r.appendSVN(node);
             }
         }
     }
     catch(XmlException exce)
     {
         //Console.WriteLine(@"parse xml error, text:#1", data);
         Console.WriteLine(exce.ToString());
     }
     doc = null;
 }
예제 #2
0
 public void parseStrGIT(string data, string basePath)
 {
     string[] nodes = data.Split('\n');
     int length = nodes.Length;
     for (int i = 0; i < length; i++)
     {
         string[] attribs = Regex.Split(nodes[i], @"\s+");
         if (attribs.Length <= 1 || attribs[1] != "blob") continue;
         Revision r = findRev(attribs[2], getFileBasePathGIT(attribs[4], basePath));
         if (null == r)
         {
             r = new Revision(attribs, basePath);
             revList.Add(r);
         }
         else
         {
             r.appendGIT(getFileNameGIT(attribs[4]), attribs[3]);
         }
     }
 }