コード例 #1
0
        public void MakeBackup(ConfigSource source, HosterRepository repo, string repoFolder)
        {
            if (this.scmFactory == null)
            {
                throw new InvalidOperationException(string.Format(Resource.BackupBase_IScmfactoryIsMissing, source.Hoster));
            }

            ScmCredentials credentials = null;

            if (repo.IsPrivate)
            {
                credentials = new ScmCredentials(source.AuthName, source.Password);
            }

            this.repo = repo;

            string subdir = Path.Combine(repoFolder, this.SubDirRepo);

            this.BackupRepo(subdir, credentials);

            if (this.repo.HasWiki)
            {
                subdir = Path.Combine(repoFolder, this.SubDirWiki);
                this.BackupWiki(subdir, credentials);
            }

            if (this.repo.HasIssues)
            {
                subdir = Path.Combine(repoFolder, this.SubDirIssues);
                this.BackupIssues(subdir, credentials);
            }
        }
コード例 #2
0
ファイル: BackupBase.cs プロジェクト: leifcr/scm-backup
        public void MakeBackup(ConfigSource source, HosterRepository repo, string repoFolder)
        {
            if (this.scmFactory == null)
            {
                throw new ArgumentNullException("!!");
            }

            ScmCredentials credentials = null;

            if (repo.IsPrivate)
            {
                credentials = new ScmCredentials(source.AuthName, source.Password);
            }

            this.repo = repo;

            string subdir = Path.Combine(repoFolder, this.SubDirRepo);

            this.BackupRepo(subdir, credentials);

            if (this.repo.HasWiki)
            {
                subdir = Path.Combine(repoFolder, this.SubDirWiki);
                this.BackupWiki(subdir, credentials);
            }

            if (this.repo.HasIssues)
            {
                subdir = Path.Combine(repoFolder, this.SubDirIssues);
                this.BackupIssues(subdir, credentials);
            }
        }
コード例 #3
0
        /// <summary>
        /// default implementation for backups if nothing special is needed
        /// </summary>
        protected void DefaultBackup(string cloneurl, string subdir, ScmCredentials credentials)
        {
            InitScm();
            scm.PullFromRemote(cloneurl, subdir, credentials);

            if (!scm.DirectoryIsRepository(subdir))
            {
                throw new InvalidOperationException(Resource.DirectoryNoRepo);
            }
        }
コード例 #4
0
        public override void BackupWiki(string subdir, ScmCredentials credentials)
        {
            InitScm();

            scm.PullFromRemote(this.repo.WikiUrl, subdir, credentials);

            if (!scm.DirectoryIsRepository(subdir))
            {
                throw new InvalidOperationException(Resource.DirectoryNoRepo);
            }
        }
コード例 #5
0
 public void PullFromRemote(string remoteUrl, string directory, ScmCredentials credentials)
 {
     throw new NotImplementedException();
 }
コード例 #6
0
 public bool RemoteRepositoryExists(string remoteUrl, ScmCredentials credentials)
 {
     throw new NotImplementedException();
 }
コード例 #7
0
 public override void BackupWiki(string subdir, ScmCredentials credentials)
 {
     this.DefaultBackup(this.repo.WikiUrl, subdir, credentials);
 }
コード例 #8
0
 public override void BackupRepo(string subdir, ScmCredentials credentials)
 {
     this.DefaultBackup(this.repo.CloneUrl, subdir, credentials);
 }
コード例 #9
0
 public virtual void BackupIssues(string subdir, ScmCredentials credentials)
 {
 }
コード例 #10
0
 // these can be implemented in the child classes IF the given hoster has issues, a wiki...
 public virtual void BackupWiki(string subdir, ScmCredentials credentials)
 {
 }
コード例 #11
0
 // this MUST be implemented in the child classes
 public abstract void BackupRepo(string subdir, ScmCredentials credentials);
コード例 #12
0
 public override void BackupWiki(string subdir, ScmCredentials credentials)
 {
     this.wikiWasExecuted = true;
 }
コード例 #13
0
 public override void BackupRepo(string subdir, ScmCredentials credentials)
 {
     this.repoWasExecuted = true;
 }
コード例 #14
0
 public override void BackupIssues(string subdir, ScmCredentials credentials)
 {
     this.issuesWasExecuted = true;
 }