public void CreateDirectory_CreateTrunk() { SvnSandBox sbox = new SvnSandBox(this); Uri ReposUrl = sbox.CreateRepository(SandBoxRepository.Empty); using (SvnClient client = NewSvnClient(true, false)) { Uri trunkUri = new Uri(ReposUrl, "trunk/"); client.RemoteCreateDirectory(trunkUri); string trunkPath = sbox.Wc; client.CheckOut(trunkUri, trunkPath); TouchFile(Path.Combine(trunkPath, "test.txt")); Assert.That(SvnTools.IsManagedPath(trunkPath)); Assert.That(SvnTools.IsBelowManagedPath(trunkPath)); Assert.That(SvnTools.IsBelowManagedPath(Path.Combine(trunkPath, "q/r/s/t/u/v/test.txt"))); client.Add(Path.Combine(trunkPath, "test.txt")); Directory.CreateDirectory(Path.Combine(trunkPath, "dir")); TouchFile(Path.Combine(trunkPath, "dir/test.txt")); SvnAddArgs aa = new SvnAddArgs(); aa.AddParents = true; client.Add(Path.Combine(trunkPath, "dir/test.txt"), aa); client.Commit(trunkPath); client.RemoteDelete(trunkUri, new SvnDeleteArgs()); } }
void UpdateVersionable() { bool versionable; SvnItemState state; if (TryGetState(SvnItemState.Versioned, out state) && state != 0) { versionable = true; } else if (Exists && SvnTools.IsBelowManagedPath(FullPath)) // Will call GetState again! { versionable = true; } else { versionable = false; } if (versionable) { SetState(SvnItemState.Versionable, SvnItemState.None); } else { SetState(SvnItemState.None, SvnItemState.Versionable); } }
/// <summary> /// SourceIndex detector which tries to find valid providers /// </summary> /// <param name="state"></param> /// <returns>true if one or more files might be managed in subversion, otherwise false</returns> public bool CanProvideSources(SharpSvn.PdbAnnotate.Framework.IndexerState state) { SortedList <string, string> directories = new SortedList <string, string>(StringComparer.InvariantCultureIgnoreCase); foreach (SourceFile file in state.SourceFiles.Values) { string dir = file.File.DirectoryName; if (directories.ContainsKey(dir)) { continue; } directories.Add(dir, dir); if (SvnTools.IsBelowManagedPath(dir)) { return(true); } } return(false); }
public void IsBelowAdmin() { SvnSandBox sbox = new SvnSandBox(this); string dir = sbox.GetTempDir(); Assert.That(!SvnTools.IsBelowManagedPath(dir), "Temp is not managed"); string sd = Path.Combine(dir, "w"); Directory.CreateDirectory(sd); Assert.That(!SvnTools.IsBelowManagedPath(sd), "sd not managed"); string sdsvn = Path.Combine(sd, ".svn"); Directory.CreateDirectory(sdsvn); Assert.That(SvnTools.IsBelowManagedPath(sd), "sd managed"); Assert.That(!SvnTools.IsBelowManagedPath(sdsvn), "sdsvn not managed"); string format = Path.Combine(sdsvn, "format"); File.WriteAllText(format, "-1"); Assert.That(!SvnTools.IsBelowManagedPath(format), "format not managed"); string sdsvnsvn = Path.Combine(sd, ".svn"); Directory.CreateDirectory(sdsvnsvn); Assert.That(!SvnTools.IsBelowManagedPath(format), "format not managed"); string sdsvnd = Path.Combine(sdsvn, "d"); Directory.CreateDirectory(sdsvnd); Assert.That(!SvnTools.IsBelowManagedPath(sdsvnd), "d not managed"); Directory.CreateDirectory(Path.Combine(sdsvnd, ".svn")); Assert.That(SvnTools.IsBelowManagedPath(sdsvnd), "d managed"); }
/// <summary> /// Called by ProjectDocumentTracker when a solution is opened /// </summary> protected override void OnSolutionOpened(bool onLoad) { base.OnSolutionOpened(onLoad); if (!IsActive) { IAnkhCommandStates states = GetService <IAnkhCommandStates>(); if (states == null || states.OtherSccProviderActive) { return; } } if (!IsSolutionManaged) { string dir = SolutionDirectory; if (!string.IsNullOrEmpty(dir) && Directory.Exists(dir)) { if (!SvnTools.IsBelowManagedPath(dir)) { return; // Not for us } if (!IsActive) { RegisterAsPrimarySccProvider(); // Set us active; we know there is a .svn } // BH: Many users seem to have .load and .noload files checked in // so we can't just remove them without issues. } } if (!IsActive) { return; } foreach (SccProjectData data in ProjectMap.AllSccProjects) { if (data.IsSolutionInfrastructure) { // Solution folders don't save their Scc management state // We let them follow the solution settings if (IsSolutionManaged) { data.SetManaged(true); } } if (data.IsStoredInSolution) { // Flush the glyph cache of solution folders // (Well known VS bug: Initially clear) data.NotifyGlyphsChanged(); } } IPendingChangesManager mgr = GetService <IPendingChangesManager>(); if (mgr != null && mgr.IsActive) { mgr.FullRefresh(false); } UpdateSolutionGlyph(); }