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..)

Comments (0)

Files changed (1)

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();
+                        }
                     }
                 }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.