Exemplo n.º 1
0
        public void ToEscapedStringTest()
        {
            string    expected = "0";
            DepotPath dp       = new DepotPath(expected);
            FileSpec  target   = new FileSpec(dp);
            string    actual;

            actual = target.ToEscapedString();
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void ToEscapedPathTest()
        {
            string   target    = @"C:\workspace@root\test#1%2.txt";
            FileSpec LocalSpec = new FileSpec(null, null, new LocalPath(target), new NoneRevision());

            string expected = @"c:\workspace%40root\test%231%252.txt#none";

            string actual = LocalSpec.ToEscapedString();

            Assert.AreEqual(expected, actual);

            target   = @"c:\workspace%40root\test%231%252.txt";
            actual   = PathSpec.UnescapePath(target);
            expected = @"c:\workspace@root\test#1%2.txt";

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        static IList <FileDiffs> GetFileDiffs(Repository rep, IList <Changelist> changelists, GetDepotFileDiffsCmdFlags flags = GetDepotFileDiffsCmdFlags.None)
        {
            List <FileDiffs> fileDiffs = new List <FileDiffs>(changelists.Count);

            foreach (Changelist cl in changelists)
            {
                foreach (FileMetaData f in cl.Files)
                {
                    FileSpec oldRev = new FileSpec(f.DepotPath, new Revision(f.HeadRev - 1));
                    FileSpec newRev = new FileSpec(f.DepotPath, new Revision(f.HeadRev));

                    GetDepotFileDiffsCmdOptions opts = new GetDepotFileDiffsCmdOptions(flags, 0, 0, null, null, null);
                    IList <DepotFileDiff>       diff = rep.GetDepotFileDiffs(oldRev.ToEscapedString(), newRev.ToEscapedString(), opts);

                    FileDiffs diffs = new FileDiffs(newRev.ToEscapedString(), cl.OwnerName, cl.Id, diff);
                    fileDiffs.Add(diffs);
                }
            }

            return(fileDiffs);
        }