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); } }
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); } }
/// <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); } }
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); } }
public void PullFromRemote(string remoteUrl, string directory, ScmCredentials credentials) { throw new NotImplementedException(); }
public bool RemoteRepositoryExists(string remoteUrl, ScmCredentials credentials) { throw new NotImplementedException(); }
public override void BackupWiki(string subdir, ScmCredentials credentials) { this.DefaultBackup(this.repo.WikiUrl, subdir, credentials); }
public override void BackupRepo(string subdir, ScmCredentials credentials) { this.DefaultBackup(this.repo.CloneUrl, subdir, credentials); }
public virtual void BackupIssues(string subdir, ScmCredentials credentials) { }
// these can be implemented in the child classes IF the given hoster has issues, a wiki... public virtual void BackupWiki(string subdir, ScmCredentials credentials) { }
// this MUST be implemented in the child classes public abstract void BackupRepo(string subdir, ScmCredentials credentials);
public override void BackupWiki(string subdir, ScmCredentials credentials) { this.wikiWasExecuted = true; }
public override void BackupRepo(string subdir, ScmCredentials credentials) { this.repoWasExecuted = true; }
public override void BackupIssues(string subdir, ScmCredentials credentials) { this.issuesWasExecuted = true; }