Ejemplo n.º 1
0
 public bool MoveNext()
 {
     revision = null;
     if (beforeFirst)
     {
         revisionRecord = item.ItemFile.GetFirstRevision();
         beforeFirst    = false;
     }
     else if (revisionRecord != null)
     {
         revisionRecord = item.ItemFile.GetNextRevision(revisionRecord);
     }
     return(revisionRecord != null);
 }
Ejemplo n.º 2
0
        protected VssRevision CreateRevision(RevisionRecord revision)
        {
            CommentRecord comment = null;

            if (revision.CommentLength > 0 && revision.CommentOffset > 0)
            {
                comment = new CommentRecord();
                ItemFile.ReadRecord(comment, revision.CommentOffset);
            }
            else if (revision.Action == VssPhysicalLib.Action.Label &&
                     revision.LabelCommentLength > 0 && revision.LabelCommentOffset > 0)
            {
                comment = new CommentRecord();
                ItemFile.ReadRecord(comment, revision.LabelCommentOffset);
            }
            return(CreateRevision(revision, comment));
        }
Ejemplo n.º 3
0
 protected override VssRevision CreateRevision(RevisionRecord revision, CommentRecord comment)
 {
     return(new VssFileRevision(this, revision, comment));
 }
Ejemplo n.º 4
0
        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:
            case Hpdi.VssPhysicalLib.Action.RestoreFile:
            {
                var archive = (ArchiveRevisionRecord)revision;
                return(new VssRestoreAction(db.GetItemName(archive.Name, archive.Physical),
                                            archive.ArchivePath));
            }

            default:
                throw new ArgumentException("Unknown revision action: " + revision.Action);
            }
        }
Ejemplo n.º 5
0
 internal VssFileRevision(VssItem item, RevisionRecord revision, CommentRecord comment)
     : base(item, revision, comment)
 {
 }
Ejemplo n.º 6
0
 protected abstract VssRevision CreateRevision(RevisionRecord revision, CommentRecord comment);