public static void AddLogItem(AbstractVersionControlSystem versionControlSystem, String logItem) { IEnumerable < String > items = Directory.EnumerateFileSystemEntries(_versionDirectory); String latestVersionPath = items.Last(); IList<String> content = null; if (versionControlSystem.Exists(latestVersionPath)) { content = new List<String>(versionControlSystem.GetFileText(latestVersionPath)); } else { content.Add("Version = " + versionControlSystem.GetRelativePath(latestVersionPath)); content.Add(""); } content.Add(content.Count-2 + "\t " + logItem); versionControlSystem.WriteFile(latestVersionPath, content.ToArray()); }
/// <summary> /// Save the given changes to disc as the given version number. This number should be provided by the client in the /// <c>PushVersion</c> method. /// </summary> /// <param name="version">The version to store</param> /// <param name="vcs">The version control system to store the changes in.</param> /// <param name="changes">The changes to store in the version control system.</param> private static void SaveChanges(int version, User user, AbstractVersionControlSystem vcs, IList<AbstractChange> changes) { foreach (AbstractChange change in changes.Where(change => change != null)) { change.ExecuteChanges(vcs); } // Persist the version and increment the number vcs.PersistVersion(version.ToString(), changes, user.MAC); }
/// <summary> /// Determines what to do, when the window is opened /// </summary> private void StartUp() { InitializeComponent(); SetEventListeners(); String root = VersionSystemFacade.GetAbsolutePathToRepository(); SetFolderTree(root); _vcs = VersionSystemFacade.GetVersionControlSystem(""); SetVersions(); }