首页 > 技术文章 > svn签出单个文件

yomho 2014-05-16 11:39 原文

if (System.IO.Directory.Exists(System.IO.Path.GetDirectoryName(this.Asset.LocalPath)) && System.IO.Directory.GetFiles(System.IO.Path.GetDirectoryName(this.Asset.LocalPath)).Length>0)
                {
                    return new string[]{
                        string.Format("cd /d \"{0}\"",System.IO.Path.GetDirectoryName(this.Asset.LocalPath)),
                        string.Format("svn up \"{0}\" --username \"{1}\" --password \"{2}\"",System.IO.Path.GetFileName(this.Asset.LocalPath),this.UserName,this.PassWord)
                    };
                }
                else
                {
                    return new string[]{
                    //string.Format("del /s /q /f {0}",System.IO.Path.Combine(System.IO.Path.GetDirectoryName(this.Asset.LocalPath),"*.*")),
                        string.Format(
                            "svn checkout --depth=empty \"{0}\" \"{3}\" --username \"{1}\" --password \"{2}\"", 
                            System.IO.Path.GetDirectoryName(this.Asset.LocalPath).Replace('\\','/').Replace(string.Format("{0}/{1}",Huawei.SCMSync.SCMConfig.WorkPath.Replace('\\','/'),this.Asset.GUID),System.Text.RegularExpressions.Regex.Replace(this.Asset.StorePath,"[\\/][^\\.\\/]+\\.(cpp|h|java|c|v|sv)$",string.Empty)), 
                            this.UserName, 
                            this.PassWord,
                            System.IO.Path.GetDirectoryName(this.Asset.LocalPath)
                        ),
                        string.Format("cd /d \"{0}\"",System.IO.Path.GetDirectoryName(this.Asset.LocalPath)),
                        string.Format("svn up \"{0}\" --username \"{1}\" --password \"{2}\"",System.IO.Path.GetFileName(this.Asset.LocalPath),this.UserName,this.PassWord)
                    };
                }

 

推荐阅读