コード例 #1
0
        private void InitializeBranchVersions()
        {
            if (this.versions == null)
            {
                this.versions = new List <BranchVersion>();
            }
            else
            {
                this.versions.Clear();
            }
            this.versions.Add(new BranchVersion("master"));
            if (this.repository != null)
            {
                IEnumerable <string> versionTags = this.repository.FindTags(Moduni.BranchVersion.RegexVersion);
                BranchVersion        branchVersion;
                foreach (string versionTag in versionTags)
                {
                    branchVersion = new BranchVersion(versionTag);
                    this.versions.Add(branchVersion);
                    this.versions.Add(new BranchVersion(branchVersion.ToBranchString()));
                }

                this.SortVersionsByDescendingOrder();
            }
        }
コード例 #2
0
ファイル: GitRepository.cs プロジェクト: s4id/Moduni
        /// <summary>
        /// Retrieves the content of the file whose path is specified as an argument.
        /// </summary>
        /// <returns>The content of the file.</returns>
        /// <param name="relativePathToFile">The relative path to the file whose content will be retrieved.</param>
        /// <param name="branchVersion">The branch version from which the file is retrieved. If the argument is not provided, it is retrieved from
        /// the current branch.</param>
        public string GetFileContent(string relativePathToFile, BranchVersion branchVersion = default(BranchVersion))
        {
            string branchVersionName = branchVersion.ToString();

            if (branchVersionName == null)
            {
                branchVersionName = "master";
            }
            Commit commit = null;

            if (branchVersion.IsVersion)
            {
                LibGit2Sharp.Tag tag = this.gitRepositoryHandle.Tags.FirstOrDefault((LibGit2Sharp.Tag tagSearched) => tagSearched.FriendlyName == branchVersionName);
                if (tag != null)
                {
                    commit = this.gitRepositoryHandle.Lookup <Commit>(tag.Target.Id);
                }
            }
            else
            {
                commit = this.gitRepositoryHandle.Lookup <Commit>(branchVersionName);
            }
            if (commit != null)
            {
                Blob fileBlob = (Blob)commit[relativePathToFile].Target;
                return(fileBlob.GetContentText());
            }
            else
            {
                return(null);
            }
        }
コード例 #3
0
        /// <summary>
        /// Publishes a new version of the module whose number is specified as argument.
        /// </summary>
        /// <param name="newVersion">The number to identify the new version.</param>
        public void PublishVersion(BranchVersion newVersion)
        {
            string branchName = newVersion.ToBranchString();

            if (!this.repository.ContainsBranch(branchName))
            {
                this.repository.CreateBranch(branchName);
                this.versions.Add(new BranchVersion(branchName));
            }

            this.repository.AddTag(newVersion.ToString());
            this.versions.Add(newVersion);
            this.SortVersionsByDescendingOrder();
        }
コード例 #4
0
 /// <summary>
 /// Checkouts the version specified in the argument. The working copy should be in the same state as it was for
 /// this version.
 /// </summary>
 /// <param name="version">The version to checkout.</param>
 public void CheckoutBranchVersion(BranchVersion version)
 {
     this.CurrentBranchVersion = version;
 }
コード例 #5
0
 public string GetFileContent(string relativePathToFile, BranchVersion branchVersion = default(BranchVersion))
 {
     throw new NotImplementedException();
 }
コード例 #6
0
ファイル: ModuniModel.cs プロジェクト: s4id/Moduni
 public void PublishVersion(IModule modulePublished, string versionMessage, BranchVersion newVersion)
 {
     modulePublished.PublishVersion(newVersion);
 }