static void Main(string[] args) { SAWHClient client = new SAWHClient(); // Step 1: Log in to server // ACTION: Update the parameters with appropriate values based on your SAWH account (organization ID, username, password, and repo name) client.ConnectToServer(1 /* org id */, "User", "Password", "RepoName"); Dictionary<string, string> movedFiles = new Dictionary<string, string>() { // ACTION: If you have any directories which were 'MOVED' within SourceAnywhere, you can map them here so the history will import in the new location // { "$/<source location>/", "$/<destination location>/" } }; IDictionary<long, Changeset> changes; // Step 2: Get all of the changes that comprise the project history, and group them into logical "changesets" // ACTION: Set the first parameter to the project you'd like to export changes = client.GetProjectHistory("$/", movedFiles); // ACTION: Set this parameter to your desired output filename GitExporter exporter = new GitExporter(@"c:\temp\sawh_export"); long? lastId = null; // Step 3: Iterate through all of the history objects foreach (Changeset change in changes.Values) { // Fetch the files associated with the changeset client.GetChangeset(WorkingDir, change); // Write the changeset out to the export file exporter.CommitChangeset(change, lastId); lastId = change.Id; } // Step 4: Done. exporter.FinishAndClose(lastId); }
static void Main(string[] args) { SAWHClient client = new SAWHClient(); // Step 1: Log in to server // ACTION: Update the parameters with appropriate values based on your SAWH account (organization ID, username, password, and repo name) client.ConnectToServer(1 /* org id */, "User", "Password", "RepoName"); Dictionary <string, string> movedFiles = new Dictionary <string, string>() { // ACTION: If you have any directories which were 'MOVED' within SourceAnywhere, you can map them here so the history will import in the new location // { "$/<source location>/", "$/<destination location>/" } }; IDictionary <long, Changeset> changes; // Step 2: Get all of the changes that comprise the project history, and group them into logical "changesets" // ACTION: Set the first parameter to the project you'd like to export changes = client.GetProjectHistory("$/", movedFiles); // ACTION: Set this parameter to your desired output filename GitExporter exporter = new GitExporter(@"c:\temp\sawh_export"); long? lastId = null; // Step 3: Iterate through all of the history objects foreach (Changeset change in changes.Values) { // Fetch the files associated with the changeset client.GetChangeset(WorkingDir, change); // Write the changeset out to the export file exporter.CommitChangeset(change, lastId); lastId = change.Id; } // Step 4: Done. exporter.FinishAndClose(lastId); }