internal VssRevision(VssItem item, RevisionRecord revision, CommentRecord comment) { this.item = item; this.action = CreateAction(revision, item); this.revision = revision; this.comment = comment; }
private void checkRevisionTime(VssItem item, VssRevision revision1, VssRevision revision2) { int version1 = revision1.Version; int version2 = revision2.Version; DateTime time1 = revision1.DateTime; DateTime time2 = revision2.DateTime; if (version1 > version2) { string msg = item.Name + "(" + item.PhysicalName + ")"; logger.WriteLine("***** warning: revision number out of sequence: " + version1 + " before " + version2 + " for item " + msg); } if (time1.CompareTo(time2) > 0) { string msg = item.Name + "(" + item.PhysicalName + ")"; logger.WriteLine("***** warning: revision time out of sequence: " + time1 + "@" + version1 + " later than " + time2 + "@" + version2 + " for item " + msg); // as we are only looking at items that are out of sequence, we try to fix // each of them as it may be the first or the second fixSequence(item, revision1); fixSequence(item, revision2); } }
private void ProcessItem(VssItem item, string path, PathMatcher exclusionMatcher) { try { VssRevision previousRevision = null; LinkedList <VssRevision> revisions = new LinkedList <VssRevision>(); IEnumerable <VssRevision> originalRevisions = item.Revisions; // this is recreated from the file each time it is queried!!! foreach (VssRevision vssRevision in originalRevisions) { if (previousRevision != null) { checkRevisionTime(item, previousRevision, vssRevision); } previousRevision = vssRevision; revisions.AddLast(vssRevision); } foreach (VssRevision vssRevision in revisions) { var actionType = vssRevision.Action.Type; var namedAction = vssRevision.Action as VssNamedAction; if (namedAction != null) { if (actionType == VssActionType.Destroy) { // track destroyed files so missing history can be anticipated // (note that Destroy actions on shared files simply delete // that copy, so destroyed files can't be completely ignored) destroyedFiles.Add(namedAction.Name.PhysicalName); } var targetPath = path + VssDatabase.ProjectSeparator + namedAction.Name.LogicalName; if (exclusionMatcher != null && exclusionMatcher.Matches(targetPath)) { // project action targets an excluded file continue; } } Revision revision = new Revision(vssRevision.DateTime, vssRevision.User, item.ItemName, vssRevision.Version, vssRevision.Comment, vssRevision.Action); ICollection <Revision> revisionSet; if (!sortedRevisions.TryGetValue(vssRevision.DateTime, out revisionSet)) { revisionSet = new LinkedList <Revision>(); sortedRevisions[vssRevision.DateTime] = revisionSet; } revisionSet.Add(revision); ++revisionCount; } } catch (RecordException e) { var message = string.Format("Failed to read revisions for {0} ({1}): {2}", path, item.PhysicalName, ExceptionFormatter.Format(e)); LogException(e, message); ReportError(message); } }
private void ProcessItem(VssItem item, string path, PathMatcher exclusionMatcher) { try { foreach (var vssRevision in item.Revisions) { var actionType = vssRevision.Action.Type; if (vssRevision.Action is VssNamedAction namedAction) { if (actionType == VssActionType.Destroy) { // track destroyed files so missing history can be anticipated // (note that Destroy actions on shared files simply delete // that copy, so destroyed files can't be completely ignored) DestroyedFiles.Add(namedAction.Name.PhysicalName); } var targetPath = path + VssDatabase.ProjectSeparator + namedAction.Name.LogicalName; if (exclusionMatcher != null && exclusionMatcher.Matches(targetPath)) { // project action targets an excluded file continue; } } var revision = new Revision(vssRevision.DateTime, vssRevision.User, item.ItemName, vssRevision.Version, vssRevision.Comment, vssRevision.Action); ICollection <Revision> revisionSet; if (!SortedRevisions.TryGetValue(vssRevision.DateTime, out revisionSet)) { revisionSet = new LinkedList <Revision>(); SortedRevisions[vssRevision.DateTime] = revisionSet; } revisionSet.Add(revision); ++revisionCount; } } catch (RecordException e) { var message = string.Format("Failed to read revisions for {0} ({1}): {2}", path, item.PhysicalName, ExceptionFormatter.Format(e)); LogException(e, message); ReportError(message); } }
private void fixSequence(VssItem item, VssRevision revision) { if (timeFixList != null) { foreach (TimeFix timeFix in timeFixList) { DateTime time = revision.DateTime; if (time.CompareTo(timeFix.start) > 0 && time.CompareTo(timeFix.end) < 0) { int version = revision.Version; revision.FixDateTime(timeFix.newTime); string msg = item.Name + "(" + item.PhysicalName + ")"; logger.WriteLine("changed time " + time + " to " + timeFix.newTime + " for item " + msg + "@" + version); } } } }
private void ProcessItem(VssItem item, string path, PathMatcher exclusionMatcher) { try { foreach (VssRevision vssRevision in item.Revisions) { var actionType = vssRevision.Action.Type; var namedAction = vssRevision.Action as VssNamedAction; if (namedAction != null) { if (actionType == VssActionType.Destroy) { // track destroyed files so missing history can be anticipated // (note that Destroy actions on shared files simply delete // that copy, so destroyed files can't be completely ignored) destroyedFiles.Add(namedAction.Name.PhysicalName); } var targetPath = path + VssDatabase.ProjectSeparator + namedAction.Name.LogicalName; if (exclusionMatcher != null && exclusionMatcher.Matches(targetPath)) { // project action targets an excluded file continue; } } Revision revision = new Revision(vssRevision.DateTime, vssRevision.User, item.ItemName, vssRevision.Version, vssRevision.Comment, vssRevision.Action); LinkedList<Revision> revisionSet; if (!sortedRevisions.TryGetValue(vssRevision.DateTime, out revisionSet)) { revisionSet = new LinkedList<Revision>(); sortedRevisions[vssRevision.DateTime] = revisionSet; } ((ICollection<Revision>)revisionSet).Add(revision); ++revisionCount; } } catch (RecordException e) { var message = string.Format("Failed to read revisions for {0} ({1}): {2}", path, item.PhysicalName, ExceptionFormatter.Format(e)); LogException(e, message); ReportError(message); } }
internal VssProjectRevision(VssItem item, RevisionRecord revision, CommentRecord comment) : base(item, revision, comment) { }
private static VssAction CreateAction(RevisionRecord revision, VssItem item) { var db = item.Database; switch (revision.Action) { case Hpdi.VssPhysicalLib.Action.Label: { return new VssLabelAction(revision.Label); } case Hpdi.VssPhysicalLib.Action.DestroyProject: case Hpdi.VssPhysicalLib.Action.DestroyFile: { var destroy = (DestroyRevisionRecord)revision; return new VssDestroyAction(db.GetItemName(destroy.Name, destroy.Physical)); } case Hpdi.VssPhysicalLib.Action.RenameProject: case Hpdi.VssPhysicalLib.Action.RenameFile: { var rename = (RenameRevisionRecord)revision; return new VssRenameAction(db.GetItemName(rename.Name, rename.Physical), db.GetFullName(rename.OldName)); } case Hpdi.VssPhysicalLib.Action.MoveFrom: { var moveFrom = (MoveRevisionRecord)revision; return new VssMoveFromAction(db.GetItemName(moveFrom.Name, moveFrom.Physical), moveFrom.ProjectPath); } case Hpdi.VssPhysicalLib.Action.MoveTo: { var moveTo = (MoveRevisionRecord)revision; return new VssMoveToAction(db.GetItemName(moveTo.Name, moveTo.Physical), moveTo.ProjectPath); } case Hpdi.VssPhysicalLib.Action.ShareFile: { var share = (ShareRevisionRecord)revision; return new VssShareAction(db.GetItemName(share.Name, share.Physical), share.ProjectPath); } case Hpdi.VssPhysicalLib.Action.BranchFile: case Hpdi.VssPhysicalLib.Action.CreateBranch: { var branch = (BranchRevisionRecord)revision; var name = db.GetFullName(branch.Name); return new VssBranchAction( new VssItemName(name, branch.Physical, branch.Name.IsProject), new VssItemName(name, branch.BranchFile, branch.Name.IsProject)); } case Hpdi.VssPhysicalLib.Action.EditFile: { return new VssEditAction(item.PhysicalName); } case Hpdi.VssPhysicalLib.Action.CreateProject: case Hpdi.VssPhysicalLib.Action.CreateFile: { var create = (CommonRevisionRecord)revision; return new VssCreateAction(db.GetItemName(create.Name, create.Physical)); } case Hpdi.VssPhysicalLib.Action.AddProject: case Hpdi.VssPhysicalLib.Action.AddFile: { var add = (CommonRevisionRecord)revision; return new VssAddAction(db.GetItemName(add.Name, add.Physical)); } case Hpdi.VssPhysicalLib.Action.DeleteProject: case Hpdi.VssPhysicalLib.Action.DeleteFile: { var delete = (CommonRevisionRecord)revision; return new VssDeleteAction(db.GetItemName(delete.Name, delete.Physical)); } case Hpdi.VssPhysicalLib.Action.RecoverProject: case Hpdi.VssPhysicalLib.Action.RecoverFile: { var recover = (CommonRevisionRecord)revision; return new VssRecoverAction(db.GetItemName(recover.Name, recover.Physical)); } case Hpdi.VssPhysicalLib.Action.ArchiveProject: { var archive = (ArchiveRevisionRecord)revision; return new VssArchiveAction(db.GetItemName(archive.Name, archive.Physical), archive.ArchivePath); } case Hpdi.VssPhysicalLib.Action.RestoreProject: { var archive = (ArchiveRevisionRecord)revision; return new VssRestoreAction(db.GetItemName(archive.Name, archive.Physical), archive.ArchivePath); } default: throw new RecordException("Unknown revision action: " + revision.Action); } }