コード例 #1
0
ファイル: MainForm.cs プロジェクト: cyotek/SvnGitMigrate
 private void FullCheckout(SvnClient svn, Uri svnUri, SvnChangeset set, string workPath)
 {
     svn.CheckOut(svnUri, workPath, new SvnCheckOutArgs
     {
         Revision = set.Revision
     });
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: cyotek/SvnGitMigrate
 private void Checkout(Uri svnUri, SvnChangeset set, string workPath)
 {
     using (SvnClient svn = new SvnClient())
     {
         if (Directory.Exists(workPath))
         {
             try
             {
                 svn.Switch(workPath, new SvnUriTarget(svnUri, set.Revision));
             }
             catch (SvnFileSystemException)
             {
                 // this seems to happen when you try to switch to a branch
                 // without any file changes - revision 814 in Cyotek triggers this
                 // in this case, we do a full checkout which seems to succeed fine
                 ShellHelpers.DeletePath(workPath);
                 this.FullCheckout(svn, svnUri, set, workPath);
             }
         }
         else
         {
             this.FullCheckout(svn, svnUri, set, workPath);
         }
     }
 }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: cyotek/SvnGitMigrate
        private SvnChangesetCollection BuildRevisionsList(Uri svnUri)
        {
            SvnChangesetCollection sets;

            sets = new SvnChangesetCollection();

            using (SvnClient svn = new SvnClient())
            {
                svn.Log(svnUri, (o, args) =>
                {
                    SvnChangeset changeset;

                    changeset = new SvnChangeset
                    {
                        Author = new User {
                            Name = args.Author
                        },
                        Revision   = args.Revision,
                        Time       = args.Time,
                        Log        = args.LogMessage,
                        IsSelected = true
                    };

                    changeset.ChangedPaths.AddRange(args.ChangedPaths.Select(p => p.Path).ToArray());

                    sets.Add(changeset);
                    args.Detach();

                    args.Cancel = changesetBackgroundWorker.CancellationPending;
                });
            }

            return(sets);
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: cyotek/SvnGitMigrate
        private void Commit(string gitPath, SvnChangeset set)
        {
            CommitOptions commitOptions;

            commitOptions = new CommitOptions
            {
                AllowEmptyCommit = Settings.Default.AllowEmptyCommits
            };

            using (Repository repo = new Repository(gitPath))
            {
                Signature author;
                Signature committer;
                Commit    commit;

                Commands.Stage(repo, "*");

                author    = new Signature(set.Author.Name, set.Author.EmailAddress, set.Time);
                committer = author;

                commit = repo.Commit(set.Log, author, committer, commitOptions);
            }
        }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: cyotek/SvnGitMigrate
 private bool ShouldCheckout(SvnChangeset set, StringCollection includeGlobs, StringCollection excludeGlobs)
 {
     return(GlobMatcher.IsIncluded(set.ChangedPaths, includeGlobs) && !GlobMatcher.IsExcluded(set.ChangedPaths, excludeGlobs));
 }