Commits

Christian Specht  committed e6b5b3c

now that Bitbucket supports Git: ignore Git repositories because Hg can't copy them

(see #8 - this is not a good solution, but the fastest possible until Bitbucket
Backup really supports Git. At least the Hg repositories can still be backed up
this way..)

  • Participants
  • Parent commits 4fc5b22

Comments (0)

Files changed (1)

File src/BitbucketBackup/Program.cs

 
                 var repos =
                     from r in json["repositories"].Children()
-                    select new { RepoName = (string)r["slug"], HasWiki = (bool)r["has_wiki"] };
+                    select new { RepoName = (string)r["slug"], HasWiki = (bool)r["has_wiki"], Scm = (string)r["scm"] };
 
                 var baseUri = new Uri("https://bitbucket.org/" + config.UserName + "/");
 
                 foreach (var repo in repos)
                 {
-                    var repoUri = new Uri(baseUri, repo.RepoName);
-                    string repoPath = Path.Combine(config.BackupFolder, repo.RepoName);
+                    if (repo.Scm == "hg")
+                    {
+                        var repoUri = new Uri(baseUri, repo.RepoName);
+                        string repoPath = Path.Combine(config.BackupFolder, repo.RepoName);
 
-                    var updater = new RepositoryUpdater(repoUri, repoPath, config);
-                    updater.Update();
+                        var updater = new RepositoryUpdater(repoUri, repoPath, config);
+                        updater.Update();
 
-                    if (repo.HasWiki)
-                    {
-                        var wikiUri = new Uri(baseUri, repo.RepoName + "/wiki");
-                        string wikiPath = Path.Combine(config.BackupFolder, repo.RepoName + "-wiki");
+                        if (repo.HasWiki)
+                        {
+                            var wikiUri = new Uri(baseUri, repo.RepoName + "/wiki");
+                            string wikiPath = Path.Combine(config.BackupFolder, repo.RepoName + "-wiki");
 
-                        var wikiUpdater = new RepositoryUpdater(wikiUri, wikiPath, config);
-                        wikiUpdater.Update();
+                            var wikiUpdater = new RepositoryUpdater(wikiUri, wikiPath, config);
+                            wikiUpdater.Update();
+                        }
                     }
                 }