Пример #1
0
        /// <summary>
        /// Attempts to connect to the SourceSafe Database and
        /// load the specified item, or version of the item, if specified.
        /// </summary>
        protected void ConnectToDatabase()
        {
            _database = new VSSDatabase();
            _database.Open(new FileInfo(DatabasePath).FullName, UserName, Password);

            _item = _database.get_VSSItem(Path, false);
            if (Version != null)
            {
                _item = _item.get_Version(Version);
            }
        }
Пример #2
0
        /// <summary>
        /// Opens the Source Safe database and sets the reference to the specified
        /// item and version.
        /// </summary>
        protected void Open()
        {
            try {
                _database = new VSSDatabase();
                _database.Open(DBPath.FullName, UserName, Password);
            } catch (Exception ex) {
                throw new BuildException(string.Format(CultureInfo.InvariantCulture,
                                                       "Failed to open database \"{0}\".", DBPath.FullName),
                                         Location, ex);
            }

            try {
                // get the reference to the specified project item
                // and version
                _item = _database.get_VSSItem(Path, false);
                if (Version != null)
                {
                    _item = _item.get_Version(Version);
                }
            } catch (Exception ex) {
                throw new BuildException("The \"path\" and/or \"version\" is not valid.",
                                         Location, ex);
            }
        }
Пример #3
0
        private void AddFileVersionToChangeset(IVSSItem vssFile, Int32 f_count, IVSSVersion vssVersion, bool isAdd)
        {
            string    filePath;
            VSSItem   versionItem;
            string    comment;
            Changeset thisChangeset;

            // define the working copy filename
            if (!this.IsPreview)
            {
                filePath = Path.Combine(this.SvnFullRepositoryPath, this.VssRelativeFilePaths[f_count]);
            }
            else
            {
                filePath = string.Empty;
            }

            //get version item to get the version of the file
            versionItem = vssFile.get_Version(vssVersion.VersionNumber);
            comment     = versionItem.VSSVersion.Comment;

            if (Changesets.ContainsKey(vssVersion.Date))
            {
                // using an existing change set
                thisChangeset = Changesets[vssVersion.Date];

                // different comment, so create a new change set anyway
                if (thisChangeset.Comment != comment)
                {
                    bool done = false;

                    //there are two different changes at the same time
                    //I'm not sure how this happened, but it did.
                    //make the date/time of this changeset after any existing changeset
                    thisChangeset = new Changeset()
                    {
                        Comment  = comment,
                        DateTime = vssVersion.Date,
                        Username = vssVersion.Username
                    };

                    //make sure not to try and add this entry if an entry with the time already exists
                    while (!done)
                    {
                        if (Changesets.ContainsKey(thisChangeset.DateTime))
                        {
                            thisChangeset.DateTime = thisChangeset.DateTime.AddSeconds(1);
                        }
                        else
                        {
                            done = true;
                        }
                    }

                    this.Changesets.Add(thisChangeset.DateTime, thisChangeset);
                }
            }
            else
            {
                // create a new change set
                thisChangeset = new Changeset()
                {
                    Comment  = comment,
                    DateTime = vssVersion.Date,
                    Username = vssVersion.Username
                };
                this.Changesets.Add(thisChangeset.DateTime, thisChangeset);
            }

            // add the file to the change set
            thisChangeset.Files.Add(new ChangesetFileInfo()
            {
                FilePath   = filePath,
                IsAdd      = isAdd,
                VssFile    = vssFile,
                VssVersion = vssVersion
            });
        }
Пример #4
0
        /// <summary>
        /// Attempts to connect to the SourceSafe Database and
        /// load the specified item, or version of the item, if specified.
        /// </summary>
        protected void ConnectToDatabase()
        {
            _database = new VSSDatabase();
            _database.Open(new FileInfo(DatabasePath).FullName, UserName, Password);

            _item = _database.get_VSSItem(Path, false);
            if (Version != null)
            {
                _item = _item.get_Version(Version);
            }
        }
Пример #5
0
        /// <summary>
        /// Opens the Source Safe database and sets the reference to the specified
        /// item and version.
        /// </summary>
        protected void Open()
        {
            try {
                _database = new VSSDatabase();
                _database.Open(DBPath.FullName, UserName, Password);
            } catch (Exception ex) {
                throw new BuildException(string.Format(CultureInfo.InvariantCulture,
                    "Failed to open database \"{0}\".", DBPath.FullName),
                    Location, ex);
            }

            try {
                // get the reference to the specified project item
                // and version
                _item = _database.get_VSSItem(Path, false);
                if (Version != null) {
                    _item = _item.get_Version(Version);
                }
            } catch (Exception ex) {
                throw new BuildException("The \"path\" and/or \"version\" is not valid.",
                    Location, ex);
            }
        }