private void renameOldRevisions() { if (!Directory.Exists(Path)) { return; } IEnumerable <string> allSubdirectories; try { allSubdirectories = Directory.GetDirectories(Path, "*", SearchOption.TopDirectoryOnly); } catch (Exception ex) // Any exception from Directory.GetDirectories() { ExceptionHandlers.Handle(String.Format("Cannot obtain a list of subdirectories at {0}", Path), ex); return; } foreach (string oldPath in allSubdirectories) { string oldRevisionDirName; try { oldRevisionDirName = System.IO.Path.GetFileName(oldPath); } catch (ArgumentException ex) { ExceptionHandlers.Handle(String.Format("Cannot obtain directory name from path {0}", oldPath), ex); continue; } if (oldRevisionDirName.Length != FileStorageUtils.FullShaLength) { continue; } // oldRevisionDirName is a full git SHA string newRevisionDirName = FileStorageUtils.ConvertShaToRevision(oldRevisionDirName); string newPath = System.IO.Path.Combine(Path, newRevisionDirName); FileStorageUtils.MigrateDirectory(oldPath, newPath); } }
private string getRevisionPath(string sha) { return(System.IO.Path.Combine(Path, FileStorageUtils.ConvertShaToRevision(sha))); }