public RepositoryListItem(RepositoryListView view, SharpSvn.Remote.ISvnRepositoryListItem listItem, SvnOrigin dirOrigin, IFileIconMapper iconMapper) : base(view) { if (listItem == null) { throw new ArgumentNullException("listItem"); } else if (dirOrigin == null) { throw new ArgumentNullException("dirOrigin"); } SvnDirEntry entry = listItem.Entry; Uri entryUri = listItem.Uri; _entry = entry; _origin = new SvnOrigin(entryUri, dirOrigin); string name = SvnTools.GetFileName(entryUri); bool isFile = (entry.NodeKind == SvnNodeKind.File); string extension = isFile ? Path.GetExtension(name) : ""; if (iconMapper != null) { if (isFile) { ImageIndex = iconMapper.GetIconForExtension(extension); } else { ImageIndex = iconMapper.DirectoryIcon; } } SvnLockInfo lockInfo = null; SvnListEventArgs lea = listItem as SvnListEventArgs; if (lea != null) { lockInfo = lea.Lock; } SetValues( name, IsFolder ? RepositoryStrings.ExplorerDirectoryName : view.Context.GetService <IFileIconMapper>().GetFileType(extension), entry.Revision.ToString(), entry.Author, IsFolder ? "" : entry.FileSize.ToString(), entry.Time.ToLocalTime().ToString("g"), (lockInfo != null) ? lockInfo.Owner : ""); }
private void SvnUpdate(bool isMandatory, string[] targetDirs) { string workingCopyPath = ConfigurationManager.AppSettings["WorkingCopy.Path"]; string svnUsername = ConfigurationManager.AppSettings["Svn.Username"]; string svnPassword = ConfigurationManager.AppSettings["Svn.Password"]; using (SvnClient client = new SvnClient()) { client.Authentication.ForceCredentials(svnUsername, svnPassword); client.LoadConfiguration(Path.Combine(Path.GetTempPath(), "sharpsvn"), true); SvnPathTarget local = new SvnPathTarget(workingCopyPath); SvnInfoEventArgs clientInfo; client.GetInfo(local, out clientInfo); SvnLockInfo lockInfo = clientInfo.Lock; if (lockInfo != null) { client.CleanUp(workingCopyPath); lockInfo = clientInfo.Lock; if (lockInfo != null) { client.Unlock(workingCopyPath); } } SvnUpdateArgs updateArgs = new SvnUpdateArgs(); updateArgs.AllowObstructions = false; updateArgs.Depth = SvnDepth.Infinity; updateArgs.IgnoreExternals = false; updateArgs.UpdateParents = true; updateArgs.Revision = SvnRevision.Head; updateArgs.Conflict += new EventHandler <SvnConflictEventArgs>(UpdateArgs_Conflict); foreach (string targetDir in targetDirs) { string localPath = workingCopyPath + targetDir; if (isMandatory) { ClearFiles(client, localPath, targetDir, 0); } foreach (string file in Directory.GetFiles(localPath, "*.css")) { File.Delete(file); } client.Update(localPath, updateArgs); } } }