当前位置: 首页>>代码示例>>C#>>正文


C# SvnClient.GetList方法代码示例

本文整理汇总了C#中SvnClient.GetList方法的典型用法代码示例。如果您正苦于以下问题:C# SvnClient.GetList方法的具体用法?C# SvnClient.GetList怎么用?C# SvnClient.GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SvnClient的用法示例。


在下文中一共展示了SvnClient.GetList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetAvailableRevisions

        public override string[] GetAvailableRevisions()
        {
            string url = Url.TrimEnd('/');

              using (SvnClient client = new SvnClient())
              {
              client.LoadConfiguration("path");
              client.Authentication.DefaultCredentials = new NetworkCredential(Login, Password);
              SvnTarget folderTarget = SvnTarget.FromString(url);

              List<String> filesFound = new List<String>();
              Collection<SvnListEventArgs> listResults;

              if (client.GetList(folderTarget, out listResults))
              {
              foreach (SvnListEventArgs item in listResults)
                  if (item.Entry.NodeKind == SvnNodeKind.Directory && !string.IsNullOrEmpty(item.Name))
                      filesFound.Add(item.Name);

              return filesFound.ToArray();
              }
              }

             return new string[0];
        }
开发者ID:jayvin,项目名称:Courier,代码行数:25,代码来源:SubversionRepository.cs

示例2: RemoteList

        public void RemoteList()
        {
            SvnClient cl = new SvnClient();
            bool found = false;
            SvnListArgs la = new SvnListArgs();
            la.RetrieveEntries = SvnDirEntryItems.AllFieldsV15;

                    cl.List(new Uri("https://ctf.open.collab.net/svn/repos/sharpsvn/trunk"), la, delegate(object Sender, SvnListEventArgs e)
                    {
                            Assert.That(e.Entry, Is.Not.Null);
                            Assert.That(e.Entry.Revision, Is.GreaterThan(0L));
                            Assert.That(e.Entry.Author, Is.Not.Null);
                            found = true;
                    });

                    Assert.That(found);

                    Collection<SvnListEventArgs> ee;
            cl.GetList(new Uri("https://ctf.open.collab.net/svn/repos/sharpsvn/trunk"), out ee);
                    Assert.That(ee, Is.Not.Null);
                    Assert.That(ee[0].Entry.Author, Is.Not.Null);
        }
开发者ID:riiiqpl,项目名称:sharpsvn,代码行数:22,代码来源:SvnRemoteTests.cs

示例3: RepositoryOperation_SetupRepository

        public void RepositoryOperation_SetupRepository()
        {
            SvnSandBox sbox = new SvnSandBox(this);
            Uri uri = sbox.CreateRepository(SandBoxRepository.Empty);
            SvnCommitResult cr;

            SvnRepositoryOperationArgs oa = new SvnRepositoryOperationArgs();
            oa.LogMessage = "Everything in one revision";

            using (SvnMultiCommandClient mucc = new SvnMultiCommandClient(uri, oa))
            {
                mucc.CreateDirectory("trunk");
                mucc.CreateDirectory("branches");
                mucc.CreateDirectory("tags");
                mucc.CreateDirectory("trunk/src");
                mucc.SetProperty("", "svn:auto-props", "*.cs = svn:eol-style=native");
                mucc.SetProperty("", "svn:global-ignores", "bin obj");

                mucc.CreateFile("trunk/README", new MemoryStream(Encoding.UTF8.GetBytes("Welcome to this project")));
                mucc.SetProperty("trunk/README", "svn:eol-style", "native");

                Assert.That(mucc.Commit(out cr)); // Commit r1
                Assert.That(cr, Is.Not.Null);
            }

            using (SvnClient svn = new SvnClient())
            {
                Collection<SvnListEventArgs> members;
                svn.GetList(uri, out members);

                Assert.That(members, Is.Not.Empty);

                MemoryStream ms = new MemoryStream();
                SvnPropertyCollection props;
                svn.Write(new Uri(uri, "trunk/README"), ms, out props);

                Assert.That(props, Is.Not.Empty);
                Assert.That(Encoding.UTF8.GetString(ms.ToArray()), Is.EqualTo("Welcome to this project"));
                Assert.That(props.Contains("svn:eol-style"));

                Collection<SvnLogEventArgs> la;
                SvnLogArgs ll = new SvnLogArgs();
                ll.Start = 1;
                svn.GetLog(uri, ll, out la);
                Assert.That(la, Is.Not.Empty);
                Assert.That(la[0].LogMessage, Is.EqualTo("Everything in one revision"));
            }
        }
开发者ID:riiiqpl,项目名称:sharpsvn,代码行数:48,代码来源:RepositoryOperationTests.cs

示例4: Window_Loaded

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            lbInfo.Content = "一切正常";

            String curDir = Directory.GetCurrentDirectory();
            String curExe = System.Reflection.Assembly.GetExecutingAssembly().Location;


            SvnClient = new SvnClient();

            SvnTarget svnTargetCurDir = SvnTarget.FromString(curDir);
            SvnTarget snvTargetCurExe = SvnTarget.FromString(curExe);

            // 未使用 - 获取目录下的文件状态
            Collection<SvnStatusEventArgs> svnStatusEventArgsCollection;
            SvnClient.GetStatus(Directory.GetCurrentDirectory(), out svnStatusEventArgsCollection);

            // 未使用 - 空的
            Collection<SvnPropertyListEventArgs> svnPropertyListEventArgsCollection;
            SvnClient.GetPropertyList(Directory.GetCurrentDirectory(), out svnPropertyListEventArgsCollection);

            // 未使用 - 获取一个文件的状态
            Collection<SvnFileVersionEventArgs> svnFileVersionEventArgsCollection;
            try
            {
                SvnClient.GetFileVersions(snvTargetCurExe, out svnFileVersionEventArgsCollection);
            }
            catch(SvnWorkingCopyPathNotFoundException ex)
            {
                // 如果查询的文件未加入Repo,会抛此异常
            }

            // 未使用 - 一个好像没什么用的信息列表,目录是第一个项,没有版本号
            Collection<SvnListEventArgs> svnListEventArgsCollection;
            SvnClient.GetList(svnTargetCurDir, out svnListEventArgsCollection);

            // 未使用 - 工作目录全路径
            String workingCopyRoot = SvnClient.GetWorkingCopyRoot(Directory.GetCurrentDirectory());
            
            // 未使用 - 整个仓库的最新版本
            long revision = 0;
            SvnClient.Youngest(Directory.GetCurrentDirectory(), out revision);

            // 此目录的相关变更 和 GUI中的ShowLog一样 是此目录的相关变更           
            Collection<SvnLogEventArgs> logList;
            try
            {
                SvnClient.GetLog(Directory.GetCurrentDirectory(), out logList);
            }
            catch(SvnInvalidNodeKindException ex)
            {
                lbInfo.Content = "当前目录不是SVN目录,停用更新检查功能";
                btnUpdateAndLaunch.Visibility = Visibility.Hidden;
                return;
            }

            // 获取本地目录信息,当前版本和修改版本都是本地的
            SvnInfoEventArgs svnInfoEventArgs;
            SvnClient.GetInfo(svnTargetCurDir, out svnInfoEventArgs);

            long curRevision = svnInfoEventArgs.Revision;       // 当前的SVN版本
            long changeRevision = logList[0].Revision;          // 当前目录的最新远程变更版本

            lbVersionChange.Content = changeRevision;
            lbVersionCur.Content = svnInfoEventArgs.Revision;

            if (curRevision < changeRevision)
            {
                btnUpdateAndLaunch.Visibility = Visibility.Visible;
                lbInfo.Content = "发现新版本";
            }
            else
            {
                btnUpdateAndLaunch.Visibility = Visibility.Hidden;
                lbInfo.Content = "已经是最新版";
            }

            // --------------------------------------------------------
            // SvnWorkingCopyClient
            // --------------------------------------------------------
            SvnWorkingCopyClient svnWorkingCopyClient = new SvnWorkingCopyClient();

            // 未使用 只有一个值IsText 没看出有什么用处
            SvnWorkingCopyState svnWorkingCopyState;
            svnWorkingCopyClient.GetState(Directory.GetCurrentDirectory(), out svnWorkingCopyState);

            // 未使用 返回仅本地存在的所有修改版本 
            SvnWorkingCopyVersion svnWorkingCopyVersion;
            svnWorkingCopyClient.GetVersion(curDir, out svnWorkingCopyVersion);

            // --------------------------------------------------------
            // SvnTools
            // --------------------------------------------------------
            // 未使用 传入正确的目录却返回false????
            bool isCurDirInWorkingCopy = SvnTools.IsManagedPath(curDir);

        }
开发者ID:Henry-T,项目名称:UnityPG,代码行数:97,代码来源:MainWindow.xaml.cs

示例5: updateList

        private void updateList()
        {
            Cursor.Current = Cursors.WaitCursor;

            tagList.Items.Clear();

            using (SvnClient client = new SvnClient())
            {
                try
                {
                    SvnUI.Bind(client, this);
                    SvnUriTarget svnUri = new SvnUriTarget(repoAddressTextBox.Text);
                    Collection<SvnListEventArgs> contents;
                    List<string> files = new List<string>();

                    if (client.GetList(svnUri, out contents))
                    {
                        if (contents.Count > 0)
                            contents.RemoveAt(0);

                        List<SvnListEventArgs> newList = new List<SvnListEventArgs>(contents);
                        newList = newList.OrderByDescending(o => o.Entry.Time.Ticks).ToList();

                        foreach (SvnListEventArgs item in newList)
                        {
                            ListViewItem tag = new ListViewItem(item.Name);
                            tag.SubItems.Add(new ListViewItem.ListViewSubItem(tag, item.Entry.Time.ToString()));
                            tag.SubItems.Add(new ListViewItem.ListViewSubItem(tag, item.Entry.Revision.ToString()));
                            tagList.Items.Add(tag);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "SVN Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            Cursor.Current = Cursors.Default;
        }
开发者ID:vekkuli,项目名称:CheckoutSVN,代码行数:39,代码来源:Form1.cs

示例6: Main

        static void Main(string[] args)
        {
            if (args.Length != 1)
                throw new InvalidOperationException("Specify directory at the command line");

            var lines = new List<Line>();

            using (var client = new SvnClient())
            {
                Collection<SvnListEventArgs> list;
                var listArgs = new SvnListArgs { Depth = SvnDepth.Infinity };
                client.GetList(new SvnUriTarget(args[0]), listArgs, out list);

                foreach (var item in list)
                {
                    string hashString = null;
                    long length = 0;

                    if (item.Entry.NodeKind == SvnNodeKind.File)
                    {
                        using (var stream = new MemoryStream())
                        {
                            client.Write(item.Uri, stream);
                            length = stream.Length;
                            stream.Position = 0;

                            using (var sha = new SHA1Managed())
                            {
                                var hash = sha.ComputeHash(stream);
                                hashString = BitConverter.ToString(hash).Replace("-", "").ToLower();
                            }
                        }
                    }

                    lines.Add(new Line(
                        item.Path,
                        item.Entry.Revision,
                        length,
                        item.Entry.Author,
                        item.Entry.Time,
                        hashString
                    ));
                }
            }

            lines.Sort((a, b) => String.Compare(a.Path, b.Path, StringComparison.InvariantCultureIgnoreCase));

            using (var target = new StreamWriter("out.txt"))
            {
                target.WriteLine("Path\tRevision\tLength\tAuthor\tTime\tHash");
                foreach (var line in lines)
                {
                    target.WriteLine(
                        new StringBuilder()
                            .Append(line.Path)
                            .Append('\t')
                            .Append(line.Revision)
                            .Append('\t')
                            .Append(line.Length)
                            .Append('\t')
                            .Append(line.Author)
                            .Append('\t')
                            .Append(line.Time.ToString("yyyy-MM-dd hh:mm:ss"))
                            .Append('\t')
                            .Append(line.Hash)
                            .ToString()
                    );
                }
            }
        }
开发者ID:gmt-europe,项目名称:svn-asset-list,代码行数:70,代码来源:Program.cs


注:本文中的SvnClient.GetList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。