首页 > 代码库 > svn签出单个文件

svn签出单个文件

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)
                    };
                }